diff options
author | Mattijs Korpershoek <mkorpershoek@baylibre.com> | 2023-10-12 10:59:22 +0200 |
---|---|---|
committer | Mattijs Korpershoek <mkorpershoek@baylibre.com> | 2023-10-13 16:31:13 +0200 |
commit | 949336ae4c6a49bcbe20810bd000828c5e1be670 (patch) | |
tree | e65787641feca8ee07797960ba4d402680c17334 | |
parent | f6b0e5b1de401e9dc9a5f622903c160f66c9719e (diff) |
subprojects: Add Android VNDK to compile test the HAL
The Android HAL has quite some Android-specific dependencies (such as
libhardware) which are not part of regular linux distributions.
To compile-test the HAL on a Linux x86 system, we have added some stubs.
This means that each time we add a new Android specific dependency, we need to
write an associated stub for it, which can get tricky, especially for complex
C++ classes such as GraphicBufferAllocator.
It would be easier if we could import the includes and the required libraries we
need from Android so that we can build-test the HAL.
The Vendor Native Development Kit (VNDK) provides all the libraries
that a vendor service (such as the libcamera HAL) can link against.
Add the VNDK as a subproject of libcamera and add the necessary meson bits so
that we can compile test the Android HAL on linux without having to stub
anything.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
-rw-r--r-- | subprojects/.gitignore | 1 | ||||
-rw-r--r-- | subprojects/packagefiles/vndk/meson.build | 23 | ||||
-rw-r--r-- | subprojects/vndk.wrap | 12 |
3 files changed, 36 insertions, 0 deletions
diff --git a/subprojects/.gitignore b/subprojects/.gitignore index 04b6271f..703f5d95 100644 --- a/subprojects/.gitignore +++ b/subprojects/.gitignore @@ -4,3 +4,4 @@ /libyaml /libyuv /packagecache +/vndk diff --git a/subprojects/packagefiles/vndk/meson.build b/subprojects/packagefiles/vndk/meson.build new file mode 100644 index 00000000..b5999f16 --- /dev/null +++ b/subprojects/packagefiles/vndk/meson.build @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: CC0-1.0 + +project('vndk', 'cpp', + version : 'vndk-v34') + +cpu_family = host_machine.cpu_family() +if cpu_family != 'x86_64' + error('vndk only supports x86_64 cpu_family') +endif + +prebuild_libraries = [ + meson.current_source_dir() / cpu_family / 'arch-x86_64/shared/llndk-stub', + meson.current_source_dir() / cpu_family / 'arch-x86_64/shared/vndk-sp', + meson.current_source_dir() / cpu_family / 'arch-x86_64/shared/vndk-core', +] + +include_base = cpu_family / 'include' + +cxx = meson.get_compiler('cpp') +libhardware_dep = declare_dependency( + dependencies : cxx.find_library('hardware', dirs : prebuild_libraries), + include_directories : include_directories(include_base / 'hardware/libhardware/')) +meson.override_dependency('libhardware', libhardware_dep) diff --git a/subprojects/vndk.wrap b/subprojects/vndk.wrap new file mode 100644 index 00000000..70002ddc --- /dev/null +++ b/subprojects/vndk.wrap @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: CC0-1.0 + +[wrap-git] +directory = vndk +url = https://android.googlesource.com/platform/prebuilts/vndk/v34 +# main +revision = 930e27bad98e1b51602db2ad98984bf2426b4f21 +depth = 1 +patch_directory = vndk + +[provide] +dependency_names = libhardware |