@@ -10,15 +10,20 @@ endif
10
10
11
11
# Platform detection
12
12
is_windows = host_machine .system() == ' windows'
13
- is_mingw = is_windows and cc.get_id() == ' gcc '
13
+ is_mingw = is_windows and cc.get_define( ' __MINGW32__ ' ) != ' '
14
14
15
15
if is_mingw
16
- # For mingw-w64, link statically against the UCRT.
17
- gcc_link_args = [' -lucrt' , ' -static' ]
18
- add_project_link_arguments (gcc_link_args, language : [' c' , ' cpp' ])
19
- # Force gcc to float64 long doubles for compatibility with MSVC
20
- # builds, for C only.
21
- add_project_arguments (' -mlong-double-64' , language : ' c' )
16
+ is_mingw_built_python = run_command (
17
+ py, [' -c' , ' import sysconfig; print(sysconfig.get_platform())' ],
18
+ check : true ).stdout().strip().startswith(' mingw' )
19
+ if not is_mingw_built_python
20
+ # For mingw-w64, link statically against the UCRT.
21
+ gcc_link_args = [' -lucrt' , ' -static' ]
22
+ add_project_link_arguments (gcc_link_args
618B
, language : [' c' , ' cpp' ])
23
+ # Force gcc to float64 long doubles for compatibility with MSVC
24
+ # builds, for C only.
25
+ add_project_arguments (' -mlong-double-64' , language : ' c' )
26
+ endif
22
27
# Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118)
23
28
add_project_arguments (' -D__USE_MINGW_ANSI_STDIO=1' , language : [' c' , ' cpp' ])
24
29
endif
0 commit comments