Skip to content

Commit 6296481

Browse files
committed
fix: fix the gcc-15 msys2 problem inside meson
1 parent ee45a78 commit 6296481

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/helper/message_box.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
namespace helper {
1515

16-
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \
17-
|| defined(__MINGW64__)
16+
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
1817
// "WinUser.h" defines "#define MessageBox MessageBoxA"
1918
// which breaks this valid code, I love windows xD.
2019
#ifdef MessageBox

tools/options/meson.build

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,26 @@ graphics_lib = {
2323
'deps': [],
2424
}
2525

26+
c = meson.get_compiler('c')
27+
28+
# Detect if compiling in an MSYS2-based MinGW/Clang environment
29+
host_is_msys2 = host_machine.system() == 'windows' and c.get_argument_syntax() == 'gcc'
30+
31+
## since gcc-15 msys2 doesn't define "_WIN32" if it is a bug or intentional, but it is needed by a few things, e.g. spdlog
32+
if host_is_msys2
33+
add_global_arguments(
34+
'-D_WIN32',
35+
language: 'c',
36+
)
37+
add_global_arguments(
38+
'-D_WIN32',
39+
language: 'cpp',
40+
)
41+
endif
42+
2643
# check if running in CI, than we only support certain versions, this helps in checking if the Ci installs the correct tool version in e.g. msys2
2744
if get_option('run_in_ci')
2845

29-
c = meson.get_compiler('c')
3046

3147
system_name = host_machine.system()
3248

@@ -35,8 +51,6 @@ if get_option('run_in_ci')
3551

3652
endif
3753

38-
# Detect if compiling in an MSYS2-based MinGW/Clang environment
39-
host_is_msys2 = host_machine.system() == 'windows' and c.get_argument_syntax() == 'gcc'
4054
if host_is_msys2
4155
system_name = 'msys2'
4256
endif

0 commit comments

Comments
 (0)