From c8262e1f40c8308a47ff22ad92286f4c3c54425d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Fri, 29 Dec 2023 07:40:42 +0900 Subject: [PATCH] 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. --- src/catch2/meson.build | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 4b9f3e8e..cc45e641 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -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, )