diff options
author | Henrik Gramner <gramner@twoorioles.com> | 2019-05-09 14:47:08 +0300 |
---|---|---|
committer | Henrik Gramner <henrik@gramner.com> | 2019-05-09 15:10:08 +0300 |
commit | 8f7af99687533d15a9b5d16abc7b9d7b0cd4dcd0 (patch) | |
tree | 93a20277ae7e0daf6b8e2f15ca245d76ec324dd2 | |
parent | 68e844aa1bb005a8ae21ebb0513cc03df1330f85 (diff) |
build: Use -mcmodel=small on 64-bit Windows
GCC (MinGW) uses -mcmodel=medium by default which results in somewhat
inefficient code, and there's no benefit for us in using that.
-rw-r--r-- | meson.build | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 8864527..35aabf2 100644 --- a/meson.build +++ b/meson.build @@ -81,6 +81,8 @@ cdata.set10('CONFIG_LOG', get_option('logging')) # Arguments in test_args will be used even on feature tests test_args = [] +optional_arguments = [] + # Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001) test_args += '-D_POSIX_C_SOURCE=200112L' add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c') @@ -96,10 +98,12 @@ if host_machine.system() == 'windows' cdata.set('fseeko', '_fseeki64') cdata.set('ftello', '_ftelli64') endif -endif -# On Windows, we use a compatibility layer to emulate pthread -if host_machine.system() == 'windows' + if (host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc') + optional_arguments += '-mcmodel=small' + endif + + # On Windows, we use a compatibility layer to emulate pthread thread_dependency = [] thread_compat_dep = declare_dependency(sources : files('src/win32/thread.c')) else @@ -176,7 +180,7 @@ endif # Compiler flags that should be set # But when the compiler does not supports them # it is not an error and silently tolerated -optional_arguments = [ +optional_arguments += [ '-Wundef', '-Werror=vla', '-Wno-maybe-uninitialized', |