From c2cb092d8d38f92d669abf08c69b3e231e35e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Mon, 25 Dec 2023 13:44:22 +0900 Subject: [PATCH 1/2] Alter meson for Android cross builds. --- src/catch2/meson.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 4b9f3e8e4e..10bec6e78a 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -340,9 +340,16 @@ foreach file : headers install_headers(file, subdir: join_paths(include_subdir, folder)) endforeach +catch2_dependencies = [] +if (host_machine.system() == 'android') + 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, ) From c10f329e9d28dbb7cef27e5d6b3c6fab07a51217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E6=9C=88=20=E9=9B=B6?= Date: Tue, 26 Dec 2023 00:02:02 +0900 Subject: [PATCH 2/2] Handle liblog linking on Termux as well as the Android NDK. --- src/catch2/meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 10bec6e78a..cc45e6419a 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', @@ -341,7 +343,10 @@ foreach file : headers endforeach catch2_dependencies = [] -if (host_machine.system() == 'android') +# 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