libcamera/base: Validate internal headers as private

Headers which must not be exposed as part of the public libcamera API
should include base/private.h.

Any interface which includes the private.h header will only be able to
build if the libcamera_private dependency is used (or the
libcamera_base_private dependency directly).

Build targets which are intended to use the private API's will use the
libcamera_private to handle the automatic definition of the inclusion
guard.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham
2021-06-25 16:11:11 +01:00
parent b71e8c2f39
commit e228c290c9
35 changed files with 79 additions and 24 deletions
+8
View File
@@ -21,10 +21,15 @@ libcamera_base_deps = [
dependency('threads'),
]
# Internal components must use the libcamera_base_private dependency to enable
# the use of headers which must not be exposed to the libcamera public api.
libcamera_base_args = [ '-DLIBCAMERA_BASE_PRIVATE' ]
libcamera_base_lib = shared_library('libcamera-base',
[libcamera_base_sources, libcamera_base_headers],
name_prefix : '',
install : true,
cpp_args : libcamera_base_args,
include_directories : libcamera_includes,
dependencies : libcamera_base_deps)
@@ -39,3 +44,6 @@ pkg_mod.generate(libcamera_base_lib,
version : '1.0',
description : 'Camera support base utility library',
subdirs : 'libcamera')
libcamera_base_private = declare_dependency(dependencies : libcamera_base,
compile_args : libcamera_base_args)
+8 -1
View File
@@ -112,6 +112,7 @@ endif
libcamera_deps = [
libatomic,
libcamera_base,
libcamera_base_private,
libdl,
libgnutls,
liblttng,
@@ -143,9 +144,15 @@ libcamera_dep = declare_dependency(sources : [
libcamera_generated_ipa_headers,
],
include_directories : libcamera_includes,
dependencies: libcamera_base,
dependencies : libcamera_base,
link_with : libcamera)
# Internal dependency for components and plugins which can use private APIs
libcamera_private = declare_dependency(dependencies : [
libcamera_dep,
libcamera_base_private,
])
pkg_mod = import('pkgconfig')
pkg_mod.generate(libcamera,
libraries : libcamera_base_lib,
+1 -1
View File
@@ -21,7 +21,7 @@ foreach mojom : ipa_mojoms
[worker, libcamera_generated_ipa_headers],
install : true,
install_dir : proxy_install_dir,
dependencies : libcamera_dep)
dependencies : libcamera_private)
endforeach
config_h.set('IPA_PROXY_DIR',