summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-02-04 18:17:08 -0500
committerDavid Robillard <d@drobilla.net>2023-02-04 18:17:08 -0500
commit5fa282a1a0c0ebec5704f223be301892fba9bcbe (patch)
treecec8af3f21313187d8367e0eb828b8669e7ebd63 /meson.build
parent0634c9a6ac22d520ea63beab44ade590816f7f9e (diff)
downloadzix-5fa282a1a0c0ebec5704f223be301892fba9bcbe.tar.gz
zix-5fa282a1a0c0ebec5704f223be301892fba9bcbe.tar.bz2
zix-5fa282a1a0c0ebec5704f223be301892fba9bcbe.zip
Fix clang build on Windows
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build33
1 files changed, 32 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 0fecc7b..55e460f 100644
--- a/meson.build
+++ b/meson.build
@@ -32,6 +32,15 @@ if get_option('strict') and not meson.is_subproject()
endif
subdir('meson/suppressions')
+if host_machine.system() == 'windows'
+ # Restrict Windows API usage to Vista and earlier
+ if cc.get_id() == 'msvc'
+ add_project_arguments('/D_WIN32_WINNT=0x0600', language: ['c', 'cpp'])
+ else
+ add_project_arguments('-D_WIN32_WINNT=0x0600', language: ['c', 'cpp'])
+ endif
+endif
+
##########################
# Platform Configuration #
##########################
@@ -384,6 +393,16 @@ if not get_option('tests').disabled()
endif
endif
+ # Set warning suppression flags specific to tests
+ test_suppressions = []
+ if cc.get_id() in ['clang', 'emscripten']
+ if host_machine.system() == 'windows'
+ test_suppressions += [
+ '-Wno-format-nonliteral',
+ ]
+ endif
+ endif
+
common_test_sources = files('test/failing_allocator.c')
foreach test : sequential_tests
@@ -394,7 +413,7 @@ if not get_option('tests').disabled()
executable(
'test_@0@'.format(test),
sources,
- c_args: c_suppressions + program_c_args,
+ c_args: c_suppressions + program_c_args + test_suppressions,
dependencies: [zix_dep],
include_directories: include_dirs,
link_args: program_link_args,
@@ -455,6 +474,12 @@ if not get_option('tests').disabled()
]
endif
+ if host_machine.system() == 'windows'
+ header_suppressions += [
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
+
elif cc.get_id() == 'gcc'
header_suppressions += [
'-Wno-padded',
@@ -504,6 +529,12 @@ if not get_option('tests').disabled()
]
endif
+ if host_machine.system() == 'windows'
+ cpp_test_args += [
+ '-Wno-nonportable-system-include-path',
+ ]
+ endif
+
elif cpp.get_id() == 'gcc'
cpp_test_args = [
'-Wall',