Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

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.
Commit
c8262e1f40c8308a47ff22ad92286f4c3c54425d
Author
影月 零 ·
Committer
GitHub
Parents
08bdd43fcd89

Files · Download .tar.gz

Changes

 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,
 )