[v2,02/13] config: Move global configuration to base
diff mbox series

Message ID 20240423103034.364150-3-mzamazal@redhat.com
State Superseded
Headers show
Series
  • Add global configuration file
Related show

Commit Message

Milan Zamazal April 23, 2024, 10:30 a.m. UTC
Global configuration may be used by some components from base, most
notably logging.  This means the configuration must also be present in
base.  And YAML object and parsing too.  Let's move that all there.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/{ => base}/global_configuration.cpp |  0
 src/libcamera/base/meson.build                    | 15 +++++++++++++++
 src/libcamera/{ => base}/yaml_parser.cpp          |  0
 src/libcamera/meson.build                         | 15 ---------------
 4 files changed, 15 insertions(+), 15 deletions(-)
 rename src/libcamera/{ => base}/global_configuration.cpp (100%)
 rename src/libcamera/{ => base}/yaml_parser.cpp (100%)

Patch
diff mbox series

diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/base/global_configuration.cpp
similarity index 100%
rename from src/libcamera/global_configuration.cpp
rename to src/libcamera/base/global_configuration.cpp
diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
index 7a7fd7e4..b71d3e23 100644
--- a/src/libcamera/base/meson.build
+++ b/src/libcamera/base/meson.build
@@ -9,6 +9,7 @@  libcamera_base_sources = files([
     'event_notifier.cpp',
     'file.cpp',
     'flags.cpp',
+    'global_configuration.cpp',
     'log.cpp',
     'message.cpp',
     'mutex.cpp',
@@ -20,10 +21,12 @@  libcamera_base_sources = files([
     'timer.cpp',
     'unique_fd.cpp',
     'utils.cpp',
+    'yaml_parser.cpp',
 ])
 
 libdw = dependency('libdw', required : false)
 libunwind = dependency('libunwind', required : false)
+libyaml = dependency('yaml-0.1', required : false)
 
 if cc.has_header_symbol('execinfo.h', 'backtrace')
     config_h.set('HAVE_BACKTRACE', 1)
@@ -37,11 +40,23 @@  if libunwind.found()
     config_h.set('HAVE_UNWIND', 1)
 endif
 
+# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.
+if not libyaml.found()
+    cmake = import('cmake')
+
+    libyaml_vars = cmake.subproject_options()
+    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})
+    libyaml_vars.append_compile_args('c', '-Wno-unused-value')
+    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)
+    libyaml = libyaml_wrap.dependency('yaml')
+endif
+
 libcamera_base_deps = [
     libatomic,
     libdw,
     libthreads,
     libunwind,
+    libyaml,
 ]
 
 # Internal components must use the libcamera_base_private dependency to enable
diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/base/yaml_parser.cpp
similarity index 100%
rename from src/libcamera/yaml_parser.cpp
rename to src/libcamera/base/yaml_parser.cpp
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index b81c75b8..fb1ce3fc 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -21,7 +21,6 @@  libcamera_sources = files([
     'framebuffer.cpp',
     'framebuffer_allocator.cpp',
     'geometry.cpp',
-    'global_configuration.cpp',
     'ipa_controls.cpp',
     'ipa_data_serializer.cpp',
     'ipa_interface.cpp',
@@ -49,7 +48,6 @@  libcamera_sources = files([
     'v4l2_pixelformat.cpp',
     'v4l2_subdevice.cpp',
     'v4l2_videodevice.cpp',
-    'yaml_parser.cpp',
 ])
 
 libcamera_sources += libcamera_public_headers
@@ -81,7 +79,6 @@  if not cc.has_function('dlopen')
     libdl = cc.find_library('dl')
 endif
 libudev = dependency('libudev', required : get_option('udev'))
-libyaml = dependency('yaml-0.1', required : false)
 
 # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first.
 libcrypto = dependency('gnutls', required : false)
@@ -117,17 +114,6 @@  if libudev.found()
     ])
 endif
 
-# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP.
-if not libyaml.found()
-    cmake = import('cmake')
-
-    libyaml_vars = cmake.subproject_options()
-    libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})
-    libyaml_vars.append_compile_args('c', '-Wno-unused-value')
-    libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars)
-    libyaml = libyaml_wrap.dependency('yaml')
-endif
-
 control_sources = []
 
 controls_mode_files = {
@@ -183,7 +169,6 @@  libcamera_deps += [
     libdl,
     liblttng,
     libudev,
-    libyaml,
 ]
 
 # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.