Handle linking to liblog when [cross] building for Android using meson. (#2784)

* Alter meson for Android cross builds.

* Handle liblog linking on Termux as well as the Android NDK.
This commit is contained in:
影月 零 2023-12-29 07:40:42 +09:00 committed by GitHub
parent 08bdd43fcd
commit c8262e1f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,8 @@ configure_file(
configuration: conf_data,
)
fs = import('fs')
benchmark_headers = [
'benchmark/catch_benchmark.hpp',
'benchmark/catch_benchmark_all.hpp',
@ -340,9 +342,19 @@ foreach file : headers
install_headers(file, subdir: join_paths(include_subdir, folder))
endforeach
catch2_dependencies = []
# Check if this is an Android NDK build.
if ((host_machine.system() == 'android') or
# Check if this is an Android Termux build.
(host_machine.system() == 'linux' and fs.is_dir('/data/data/com.termux')))
log_dep = meson.get_compiler('cpp').find_library('log')
catch2_dependencies += log_dep
endif
catch2 = static_library(
'Catch2',
sources,
dependencies: catch2_dependencies,
include_directories: '..',
install: true,
)