From 3fac104158fcbdd7d6d7ffb34e5db77f1f9ebeb5 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 23 May 2019 00:14:19 +0300 Subject: meson: Create and use a dependency for libcamera and its headers Instead of manually adding the libcamera library and include path to every target that requires it, declare a dependency that groups the headers as source, the library and the include path, and use it through the project. This simplifies handling of the dependency. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/cam/meson.build | 5 ++--- src/libcamera/meson.build | 4 ++++ src/qcam/meson.build | 4 +--- test/camera/meson.build | 1 + test/ipa/meson.build | 2 ++ test/libtest/meson.build | 6 +++--- test/media_device/meson.build | 2 ++ test/meson.build | 2 ++ test/pipeline/ipu3/meson.build | 1 + test/v4l2_device/meson.build | 1 + test/v4l2_subdevice/meson.build | 1 + 11 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/cam/meson.build b/src/cam/meson.build index 85129509..3faddc6c 100644 --- a/src/cam/meson.build +++ b/src/cam/meson.build @@ -6,6 +6,5 @@ cam_sources = files([ ]) cam = executable('cam', cam_sources, - link_with : libcamera, - install : true, - include_directories : libcamera_includes) + dependencies : libcamera_dep, + install : true) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 8294ed35..0ebb25bc 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -65,3 +65,7 @@ libcamera = shared_library('camera', install : true, include_directories : includes, dependencies : libudev) + +libcamera_dep = declare_dependency(sources : libcamera_api, + include_directories : libcamera_includes, + link_with : libcamera) diff --git a/src/qcam/meson.build b/src/qcam/meson.build index 56b57a26..9f1fa75f 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -15,9 +15,7 @@ qt5_dep = dependency('qt5', if qt5_dep.found() qcam = executable('qcam', qcam_sources, - link_with : libcamera, install : true, - include_directories : libcamera_includes, - dependencies : qt5_dep, + dependencies : [libcamera_dep, qt5_dep], cpp_args : '-DQT_NO_KEYWORDS') endif diff --git a/test/camera/meson.build b/test/camera/meson.build index b01e7e02..35e97ce5 100644 --- a/test/camera/meson.build +++ b/test/camera/meson.build @@ -9,6 +9,7 @@ camera_tests = [ foreach t : camera_tests exe = executable(t[0], [t[1], 'camera_test.cpp'], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) test(t[0], exe, suite : 'camera', is_parallel : false) diff --git a/test/ipa/meson.build b/test/ipa/meson.build index 53015e38..ecde313c 100644 --- a/test/ipa/meson.build +++ b/test/ipa/meson.build @@ -5,6 +5,7 @@ ipa_modules_sources = [ foreach m : ipa_modules_sources shared_library(m, name_prefix : '', + dependencies : libcamera_dep, include_directories : test_includes_public) endforeach @@ -14,6 +15,7 @@ ipa_test = [ foreach t : ipa_test exe = executable(t[0], t[1], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) diff --git a/test/libtest/meson.build b/test/libtest/meson.build index e0893b70..ca762b44 100644 --- a/test/libtest/meson.build +++ b/test/libtest/meson.build @@ -2,15 +2,15 @@ libtest_sources = files([ 'test.cpp', ]) -libtest = static_library('libtest', libtest_sources) +libtest = static_library('libtest', libtest_sources, + dependencies : libcamera_dep) libtest_includes = include_directories('.') -test_libraries = [libcamera, libtest] +test_libraries = [libtest] test_includes_public = [ libtest_includes, - libcamera_includes, ] test_includes_internal = [ diff --git a/test/media_device/meson.build b/test/media_device/meson.build index 124f454e..6a0e4684 100644 --- a/test/media_device/meson.build +++ b/test/media_device/meson.build @@ -9,10 +9,12 @@ media_device_tests = [ ] lib_mdev_test = static_library('lib_mdev_test', lib_mdev_test_sources, + dependencies : libcamera_dep, include_directories : test_includes_internal) foreach t : media_device_tests exe = executable(t[0], t[1], + dependencies : libcamera_dep, link_with : [test_libraries, lib_mdev_test], include_directories : test_includes_internal) diff --git a/test/meson.build b/test/meson.build index ef413679..609aeab8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -21,6 +21,7 @@ internal_tests = [ foreach t : public_tests exe = executable(t[0], t[1], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_public) @@ -29,6 +30,7 @@ endforeach foreach t : internal_tests exe = executable(t[0], t[1], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) diff --git a/test/pipeline/ipu3/meson.build b/test/pipeline/ipu3/meson.build index 87074588..d02927c9 100644 --- a/test/pipeline/ipu3/meson.build +++ b/test/pipeline/ipu3/meson.build @@ -4,6 +4,7 @@ ipu3_test = [ foreach t : ipu3_test exe = executable(t[0], t[1], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) diff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build index 32556cf5..de540b1b 100644 --- a/test/v4l2_device/meson.build +++ b/test/v4l2_device/meson.build @@ -11,6 +11,7 @@ v4l2_device_tests = [ foreach t : v4l2_device_tests exe = executable(t[0], [t[1], 'v4l2_device_test.cpp'], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) test(t[0], exe, suite : 'v4l2_device', is_parallel : false) diff --git a/test/v4l2_subdevice/meson.build b/test/v4l2_subdevice/meson.build index 282f6e23..0521984b 100644 --- a/test/v4l2_subdevice/meson.build +++ b/test/v4l2_subdevice/meson.build @@ -5,6 +5,7 @@ v4l2_subdevice_tests = [ foreach t : v4l2_subdevice_tests exe = executable(t[0], [t[1], 'v4l2_subdevice_test.cpp'], + dependencies : libcamera_dep, link_with : test_libraries, include_directories : test_includes_internal) test(t[0], exe, suite : 'v4l2_subdevice', is_parallel : false) -- cgit v1.2.1