[glib: 1/2] Only build tests if certain conditions are met.



commit e7b0d89aeb4c424de9a79d03103172f1ae56cf3e
Author: Adam Duskett <aduskett gmail com>
Date:   Tue Apr 16 10:19:41 2019 +0000

    Only build tests if certain conditions are met.
    
    Currently, there is no way to prevent tests from building using meson.
    When cross-compiling, building the tests isn't necessary.
    
    Instead, only build the tests on the following conditions:
    1) If not cross-compiling.
    2) If cross-compiling, and there is an exe wrapper.

 gio/meson.build     | 6 +++++-
 glib/meson.build    | 6 +++++-
 gobject/meson.build | 6 +++++-
 meson.build         | 6 +++++-
 4 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gio/meson.build b/gio/meson.build
index 4e5e021e9..f0e08b40f 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -994,4 +994,8 @@ if enable_systemtap
 endif
 
 subdir('fam')
-subdir('tests')
+# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
+build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
+if build_tests
+    subdir('tests')
+endif
\ No newline at end of file
diff --git a/glib/meson.build b/glib/meson.build
index df8be8e6d..40b58047d 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -459,4 +459,8 @@ if enable_systemtap
     install : true)
 endif
 
-subdir('tests')
+# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
+build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
+if build_tests
+  subdir('tests')
+endif
\ No newline at end of file
diff --git a/gobject/meson.build b/gobject/meson.build
index db8d3c4e9..81dcffda5 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -166,4 +166,8 @@ if enable_systemtap
     install : true)
 endif
 
-subdir('tests')
+# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
+build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
+if build_tests
+  subdir('tests')
+endif
\ No newline at end of file
diff --git a/meson.build b/meson.build
index 85433fb3b..621e35059 100644
--- a/meson.build
+++ b/meson.build
@@ -2045,7 +2045,11 @@ subdir('gthread')
 subdir('gmodule')
 subdir('gio')
 subdir('fuzzing')
-subdir('tests')
+# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
+build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
+if build_tests
+  subdir('tests')
+endif
 
 # xgettext is optional (on Windows for instance)
 if find_program('xgettext', required : get_option('nls')).found()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]