summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-26 02:44:29 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-26 14:52:56 +0300
commit9fd172f496ddf3794dda45e8b7c3f713418be970 (patch)
treeb6588b770b3e48e8ee4d63e195d2f4416700987b /meson.build
parentbdee8833e2775c4f0968c19312650e1e889f812c (diff)
android: Fix file system library usage on gcc 7 and 8
On gcc versions older than 9, the file system library, used by the Android camera HAL configuration file parser, is implemented in a separate static library. Furthermore, on gcc 7, it's provided in the std::experimental namespace. This breaks compilation of the HAL on gcc 7, and linking on gcc 8. Fix the compilation issue by conditionally including <experimental/filesystem> and creating a namespace alias in std, and the link issue by linking to libstdc++fs on gcc versions older than 9. The inclusion of <experimental/filesystem> is a bit of a hack, and when we'll start using the file system library in another compilation unit, we should then move all this to an internal helper to abstract the compiler version. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build8
1 files changed, 8 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 6626fa7e..2e7dffb7 100644
--- a/meson.build
+++ b/meson.build
@@ -76,6 +76,14 @@ if cc.get_id() == 'gcc'
error('gcc version is too old, libcamera requires 7.0 or newer')
endif
+ # On gcc 7 and 8, the file system library is provided in a separate static
+ # library.
+ if cc.version().version_compare('<9')
+ cpp_arguments += [
+ '-lstdc++fs',
+ ]
+ 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. Silence them.