summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-22 17:19:31 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-25 02:03:09 +0300
commitb869d4463ef38934da35ffaf287870541e0dee47 (patch)
treedbf2f31612ca28eb82a8cabe0c846886d6f23d14 /meson.build
parentf976eb5cb63f0c5e802dbd4faefa82eb927c2f47 (diff)
meson: Switch to C++17
Due to popular request, move from C++14 to C++17. This will allow dropping some custom constructs (such as a custom utils::clamp), benefiting from new language features, and dropping gcc 5 and 6 from the compilation tests. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build33
1 files changed, 22 insertions, 11 deletions
diff --git a/meson.build b/meson.build
index ec54e68f..f27b7646 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,7 @@ project('libcamera', 'c', 'cpp',
default_options : [
'werror=true',
'warning_level=2',
- 'cpp_std=c++14',
+ 'cpp_std=c++17',
],
license : 'LGPL 2.1+')
@@ -45,6 +45,10 @@ c_arguments = []
cpp_arguments = []
if cc.get_id() == 'clang'
+ if cc.version().version_compare('<5')
+ error('clang version is too old, libcamera requires 5.0 or newer')
+ endif
+
# Turn _FORTIFY_SOURCE by default on optimised builds (as it requires -O1
# or higher). This is needed on clang only as gcc enables it by default.
if get_option('optimization') != '0'
@@ -62,6 +66,23 @@ if cc.get_id() == 'clang'
endif
endif
+if cc.get_id() == 'gcc'
+ if cc.version().version_compare('<7')
+ error('gcc version is too old, libcamera requires 7.0 or newer')
+ endif
+
+ # gcc 7.1 introduced processor-specific ABI breakages related to parameter
+ # passing on ARM platforms. This generates a large number of messages
+ # during compilation with gcc >=7.1 until gcc 9. Silence them.
+ if (host_machine.cpu_family() == 'arm' and
+ cc.version().version_compare('>=7.1') and
+ cc.version().version_compare('<9'))
+ cpp_arguments += [
+ '-Wno-psabi',
+ ]
+ endif
+endif
+
# We use C99 designated initializers for arrays as C++ has no equivalent
# feature. Both gcc and clang support this extension, but recent
# versions of clang generate a warning that needs to be disabled.
@@ -71,16 +92,6 @@ if cc.has_argument('-Wno-c99-designator')
]
endif
-# gcc 7.1 introduced processor-specific ABI breakages related to parameter
-# passing on ARM platforms. This generates a large number of messages during
-# compilation with gcc >=7.1 until gcc 9. Silence them.
-if (host_machine.cpu_family() == 'arm' and cc.get_id() == 'gcc' and
- cc.version().version_compare('>=7.1') and cc.version().version_compare('<9'))
- cpp_arguments += [
- '-Wno-psabi',
- ]
-endif
-
c_arguments += common_arguments
cpp_arguments += common_arguments