Patrick Williams | b9af875 | 2023-01-30 13:28:01 -0600 | [diff] [blame^] | 1 | From 9d3b374e75692da3d1d05344a1693c85a3098f47 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex@linutronix.de> |
| 3 | Date: Thu, 26 Jan 2023 20:29:46 +0100 |
| 4 | Subject: [PATCH] meson.build: allow (a subset of) tests in cross compile |
| 5 | settings |
| 6 | |
| 7 | There is no need to completely disable tests: most of them |
| 8 | do not require running target executables at build time, |
| 9 | and so can be built and installed. |
| 10 | |
| 11 | This requires inserting a couple of specific guards around |
| 12 | items that do require running target executables. |
| 13 | |
| 14 | Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/150] |
| 15 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 16 | --- |
| 17 | meson.build | 6 +++--- |
| 18 | tests/meson.build | 10 ++++++---- |
| 19 | 2 files changed, 9 insertions(+), 7 deletions(-) |
| 20 | |
| 21 | diff --git a/meson.build b/meson.build |
| 22 | index 8a16c8f..7c8b20f 100644 |
| 23 | --- a/meson.build |
| 24 | +++ b/meson.build |
| 25 | @@ -369,10 +369,10 @@ subdir('gdk-pixbuf') |
| 26 | # i18n |
| 27 | subdir('po') |
| 28 | |
| 29 | +if get_option('tests') |
| 30 | + subdir('tests') |
| 31 | +endif |
| 32 | if not meson.is_cross_build() |
| 33 | - if get_option('tests') |
| 34 | - subdir('tests') |
| 35 | - endif |
| 36 | subdir('thumbnailer') |
| 37 | endif |
| 38 | |
| 39 | diff --git a/tests/meson.build b/tests/meson.build |
| 40 | index 28c2525..c45e765 100644 |
| 41 | --- a/tests/meson.build |
| 42 | +++ b/tests/meson.build |
| 43 | @@ -4,7 +4,7 @@ |
| 44 | # gdk-pixbuf-pixdata from build directory because it needs all DLL locations in |
| 45 | # $PATH. Ideally we should use gnome.compile_resources() and let Meson deal with |
| 46 | # this problem: See https://github.com/mesonbuild/meson/issues/8266. |
| 47 | -if enabled_loaders.contains('png') and host_system != 'windows' |
| 48 | +if enabled_loaders.contains('png') and host_system != 'windows' and not meson.is_cross_build() |
| 49 | # Resources; we cannot use gnome.compile_resources() here, because we need to |
| 50 | # override the environment in order to use the utilities we just built instead |
| 51 | # of the system ones |
| 52 | @@ -166,9 +166,11 @@ endif |
| 53 | test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep, ] |
| 54 | test_args = [ '-k' ] |
| 55 | test_env = environment() |
| 56 | -test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) |
| 57 | -test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) |
| 58 | -test_env.set('GDK_PIXBUF_MODULE_FILE', loaders_cache.full_path()) |
| 59 | +if not meson.is_cross_build() |
| 60 | + test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) |
| 61 | + test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) |
| 62 | + test_env.set('GDK_PIXBUF_MODULE_FILE', loaders_cache.full_path()) |
| 63 | +endif |
| 64 | |
| 65 | foreach test_name, test_data: installed_tests |
| 66 | test_sources = [ test_name + '.c', 'test-common.c' ] |