summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-04-22 10:04:40 +0300
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-04-22 10:51:48 +0300
commit81fbdf1e460fd198a53903cc8f250cc4508f25fe (patch)
treef1ab93dc07d9bc6e2d673e5559c4a335c56e3780 /meson.build
parent2867a98ad1767759405a5c71c6bee129de5afcde (diff)
pixelformats: Disable constexpr for older compilers
gcc 11 and earlier do not support constexpr strings and vectors. Add tests and ifdefs to only use constexpr on selected places for gcc 12+. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build14
1 files changed, 13 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 9789e8c..cec41f3 100644
--- a/meson.build
+++ b/meson.build
@@ -22,6 +22,18 @@ if cpp.has_argument('-Wno-c99-designator')
]
endif
+if cpp.compiles('#include <string>\n constexpr bool test(const std::string& x) { return x.empty(); }')
+ add_global_arguments('-DHAS_CONSTEXPR_STR', language : 'cpp')
+else
+ message('Compiler does not support constexpr strings')
+endif
+
+if cpp.compiles('#include <vector>\n constexpr bool test(const std::vector<int>& x) { return x.empty(); }')
+ add_global_arguments('-DHAS_CONSTEXPR_VEC', language : 'cpp')
+else
+ message('Compiler does not support constexpr vectors')
+endif
+
add_project_arguments(cpp_arguments, language : 'cpp')
libfmt_dep = dependency('fmt')
@@ -33,7 +45,7 @@ if libdrmomap_dep.found()
endif
if get_option('libutils')
- add_global_arguments('-DHAS_KMSXXUTIL', language : 'cpp')
+ add_global_arguments('-DHAS_KMSXXUTIL', language : 'cpp')
endif
subdir('kms++')