Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BLD: mingw-w64 build fixes #24968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions numpy/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ endif

# Platform detection
is_windows = host_machine.system() == 'windows'
is_mingw = is_windows and cc.get_id() == 'gcc'
is_mingw = is_windows and cc.get_define('__MINGW32__') != ''

if is_mingw
# For mingw-w64, link statically against the UCRT.
gcc_link_args = ['-lucrt', '-static']
add_project_link_arguments(gcc_link_args, language: ['c', 'cpp'])
# Force gcc to float64 long doubles for compatibility with MSVC
# builds, for C only.
add_project_arguments('-mlong-double-64', language: 'c')
is_mingw_built_python = run_command(
py, ['-c', 'import sysconfig; print(sysconfig.get_platform())'],
check: true).stdout().strip().startswith('mingw')
if not is_mingw_built_python
# For mingw-w64, link statically against the UCRT.
gcc_link_args = ['-lucrt', '-static']
add_project_link_arguments(gcc_link_args, language: ['c', 'cpp'])
# Force gcc to float64 long doubles for compatibility with MSVC
# builds, for C only.
add_project_arguments('-mlong-double-64', language: 'c')
endif
# Make fprintf("%zd") work (see https://github.com/rgommers/scipy/issues/118)
add_project_arguments('-D__USE_MINGW_ANSI_STDIO=1', language: ['c', 'cpp'])
endif
Expand Down