From c75dae8a6d5b6ed2e68e806c20766660d3c877f7 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 2 Jun 2026 09:44:14 +0200 Subject: [PATCH 1/2] meson: Allow SmallVector to compile on all Macs [why] Building on Apple often involves setting the target MacOS version Independent of compiler etc. This is done with clang's `-mmacosx-version-min` command line flag. Typically this is set to 10.9, as Apple switch from libstdc++ to libc++ with 10.9. With MacOS prior to 10.13 we need to enable the aligned allocation, with the switch `-faligned-allocation`: "Enable C++17 aligned allocation functions" With MacOS 10.13 and later the `-faligned-allocation` became standard, but it does not hurt to insist on it as some projects might have turned it off via `-fno-aligned-allocation`. This commit is driven by the need to build GUL via conda-build which targets all MacOS 10.9+. 10.9 (Mavericks, 2013) Minimum version we want to support 10.13 (High Sierra, 2017) Minimum version that has C++17 allocators [how] As we rely on these now, enable them if we can. Signed-off-by: Fini Jastrow --- src/meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/meson.build b/src/meson.build index 39dd8c3..392dc32 100644 --- a/src/meson.build +++ b/src/meson.build @@ -54,6 +54,9 @@ endif if meson.get_compiler('cpp').has_argument('-Wnrvo') # msvc: included in permissive- add_cpp_args += [ '-Wnrvo' ] endif +if meson.get_compiler('cpp').has_argument('-faligned-allocation') # Apple clang + add_cpp_args += [ '-faligned-allocation' ] +endif deps = dependency('threads') From f3bf0d8c6d97897f0962743737334328f5c22da8 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 2 Jun 2026 12:36:10 +0200 Subject: [PATCH 2/2] meson: Simplify evaluation of compiler options [Why] It has become quite verbose to first check and then eventually add the compiler option. Luckily for us, meson has a shortcut for this scenario, where we give it a list of candidates and receive a list of all supported options, which we can use directly. Signed-off-by: Fini Jastrow --- src/meson.build | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/meson.build b/src/meson.build index 392dc32..c4d712e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -45,18 +45,9 @@ add_cpp_args = [ ] if build_machine.system() == 'darwin' add_cpp_args += [ '-U_LIBCPP_ENABLE_ASSERTIONS' ] endif -if meson.get_compiler('cpp').has_argument('-Wshadow') # msvc doesnt have - add_cpp_args += [ '-Wshadow' ] -endif -if meson.get_compiler('cpp').has_argument('-Wconversion') # msvc doesnt have - add_cpp_args += [ '-Wconversion' ] -endif -if meson.get_compiler('cpp').has_argument('-Wnrvo') # msvc: included in permissive- - add_cpp_args += [ '-Wnrvo' ] -endif -if meson.get_compiler('cpp').has_argument('-faligned-allocation') # Apple clang - add_cpp_args += [ '-faligned-allocation' ] -endif + +add_cpp_args += meson.get_compiler('cpp').get_supported_arguments( + [ '-Wshadow', '-Wconversion', '-Wnrvo', '-faligned-allocation' ]) deps = dependency('threads')