summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2020-04-30 16:03:03 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2020-04-30 16:15:01 +0200
commit365e61968f188ae5e63d8e54f1b1bd59346525da (patch)
tree08e7a41306b2e1283e45a768d3b280b8bdaa82a1 /tests
parente3f94cfc3cbc25c13cd87b5921811823fcc7ae99 (diff)
Add support for building cairomm with Meson
cairomm can be built with either Autotools or Meson. See MR !2
Diffstat (limited to 'tests')
-rw-r--r--tests/meson.build47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..530eb73
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,47 @@
+# tests
+
+# input: cairomm_dep, build_tests, can_test, test_dep, USE_SHARED_BOOST
+
+cairomm_tests_extra_cppargs = []
+if USE_SHARED_BOOST
+ cairomm_tests_extra_cppargs += ['-DBOOST_ALL_DYN_LINK']
+endif
+
+test_programs = [
+# [[dir-name], exe-name, [sources], [cpp-flags]]
+ [[], 'test-context', ['test-context.cc'], []],
+ [[], 'test-font-face', ['test-font-face.cc'], []],
+ [[], 'test-font-options', ['test-font-options.cc'], []],
+ [[], 'test-matrix', ['test-matrix.cc'], []],
+ [[], 'test-scaled-font', ['test-scaled-font.cc'], []],
+ [[], 'test-surface', ['test-surface.cc'],
+ ['-DPNG_STREAM_FILE="' + meson.current_source_dir() / 'png-stream-test.png"']],
+ [[], 'test-user-font', ['test-user-font.cc'], []],
+]
+
+if can_test
+ foreach ex : test_programs
+ dir = ''
+ foreach dir_part : ex[0]
+ dir = dir / dir_part
+ endforeach
+ ex_name = (dir / ex[1]).underscorify()
+ ex_sources = []
+ foreach src : ex[2]
+ ex_sources += dir / src
+ endforeach
+
+ boost_test_modname_flag = [ '-DBOOST_TEST_MODULE=@0@'.format(ex[1]) ]
+ exe_file = executable(ex_name, ex_sources,
+ cpp_args: ex[3] + boost_test_modname_flag + cairomm_tests_extra_cppargs,
+ dependencies: [cairomm_dep, test_dep],
+ gui_app: false,
+ build_by_default: build_tests,
+ )
+
+ # If exe_file is a test program, it is built by default unconditionally.
+ if build_tests
+ test(ex_name, exe_file)
+ endif
+ endforeach
+endif