From 93e72b695e477ac1efc22a0bdddb177199cf2fb9 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 12 May 2020 00:58:34 +0300 Subject: libcamera: Move internal headers to include/libcamera/internal/ The libcamera internal headers are located in src/libcamera/include/. The directory is added to the compiler headers search path with a meson include_directories() directive, and internal headers are included with (e.g. for the internal semaphore.h header) #include "semaphore.h" All was well, until libcxx decided to implement the C++20 synchronization library. The __threading_support header gained a #include to include the pthread's semaphore support. As include_directories() adds src/libcamera/include/ to the compiler search path with -I, the internal semaphore.h is included instead of the pthread version. Needless to say, the compiler isn't happy. Three options have been considered to fix this issue: - Use -iquote instead of -I. The -iquote option instructs gcc to only consider the header search path for headers included with the "" version. Meson unfortunately doesn't support this option. - Rename the internal semaphore.h header. This was deemed to be the beginning of a long whack-a-mole game, where namespace clashes with system libraries would appear over time (possibly dependent on particular system configurations) and would need to be constantly fixed. - Move the internal headers to another directory to create a unique namespace through path components. This causes lots of churn in all the existing source files through the all project. The first option would be best, but isn't available to us due to missing support in meson. Even if -iquote support was added, we would need to fix the problem before a new version of meson containing the required support would be released. The third option is thus the only practical solution available. Bite the bullet, and do it, moving headers to include/libcamera/internal/. Signed-off-by: Laurent Pinchart Acked-by: Jacopo Mondi --- src/ipa/libipa/ipa_interface_wrapper.cpp | 4 ++-- src/ipa/libipa/ipa_interface_wrapper.h | 2 +- src/ipa/meson.build | 1 - src/ipa/raspberrypi/cam_helper.cpp | 4 ++-- src/ipa/raspberrypi/cam_helper.hpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 8 ++++---- src/ipa/rkisp1/rkisp1.cpp | 4 ++-- src/ipa/vimc/vimc.cpp | 4 ++-- 8 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src/ipa') diff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp index 21d8c98b..90f270c0 100644 --- a/src/ipa/libipa/ipa_interface_wrapper.cpp +++ b/src/ipa/libipa/ipa_interface_wrapper.cpp @@ -14,8 +14,8 @@ #include -#include "byte_stream_buffer.h" -#include "camera_sensor.h" +#include "libcamera/internal/byte_stream_buffer.h" +#include "libcamera/internal/camera_sensor.h" /** * \file ipa_interface_wrapper.h diff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h index 56507aaf..b426034d 100644 --- a/src/ipa/libipa/ipa_interface_wrapper.h +++ b/src/ipa/libipa/ipa_interface_wrapper.h @@ -11,7 +11,7 @@ #include -#include "control_serializer.h" +#include "libcamera/internal/control_serializer.h" namespace libcamera { diff --git a/src/ipa/meson.build b/src/ipa/meson.build index ab73c347..5a5de267 100644 --- a/src/ipa/meson.build +++ b/src/ipa/meson.build @@ -6,7 +6,6 @@ ipa_sysconf_dir = join_paths(get_option('sysconfdir'), 'libcamera', 'ipa') ipa_includes = [ libcamera_includes, - libcamera_internal_includes, ] config_h.set('IPA_CONFIG_DIR', diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 7f05d2c6..a0c73f99 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -11,11 +11,11 @@ #include #include +#include "libcamera/internal/v4l2_videodevice.h" + #include "cam_helper.hpp" #include "md_parser.hpp" -#include "v4l2_videodevice.h" - using namespace RPi; static std::map cam_helpers; diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp index 0c8aa29a..6877f473 100644 --- a/src/ipa/raspberrypi/cam_helper.hpp +++ b/src/ipa/raspberrypi/cam_helper.hpp @@ -11,7 +11,7 @@ #include "camera_mode.h" #include "md_parser.hpp" -#include "v4l2_videodevice.h" +#include "libcamera/internal/v4l2_videodevice.h" namespace RPi { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 3bcc0815..46b24453 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -22,6 +22,10 @@ #include #include +#include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/log.h" +#include "libcamera/internal/utils.h" + #include #include "agc_algorithm.hpp" @@ -44,10 +48,6 @@ #include "sdn_status.h" #include "sharpen_status.h" -#include "camera_sensor.h" -#include "log.h" -#include "utils.h" - namespace libcamera { /* Configure the sensor with these values initially. */ diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index bfa88418..4f6e0342 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -22,8 +22,8 @@ #include #include -#include "log.h" -#include "utils.h" +#include "libcamera/internal/log.h" +#include "libcamera/internal/utils.h" namespace libcamera { diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index 9271f2d8..3fa6be65 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -19,8 +19,8 @@ #include -#include "file.h" -#include "log.h" +#include "libcamera/internal/file.h" +#include "libcamera/internal/log.h" namespace libcamera { -- cgit v1.2.1