8000 Merge pull request #24968 from lazka/mingw-python-build-fixes · numpy/numpy@29cbb1f · GitHub
[go: up one dir, main page]

Skip to content

Commit 29cbb1f

Browse files
authored
Merge pull request #24968 from lazka/mingw-python-build-fixes
BLD: mingw-w64 build fixes
2 parents b54e6f9 + 9123d43 commit 29cbb1f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

numpy/meson.build

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ endif
1010

1111
# Platform detection
1212
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__') != ''
1414

1515
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
2227
# Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118)
2328
add_project_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp'])
2429
endif

0 commit comments

Comments
 (0)
0