@@ -57,54 +57,6 @@ import('pkgconfig').generate(
5757 subdirs : [' .' ]
5858)
5959
60- if not meson .is_subproject()
61-
62- catch2_dep = dependency (' catch2' , required : get_option (' system-catch2' ))
63- if not catch2_dep.found()
64- catch2_dep = declare_dependency (compile_args : [' -DBUNDLED_CATCH2' ])
65- else
66- if catch2_dep.version().version_compare(' >=3.0' )
67- catch2_dep = [catch2_dep, declare_dependency (compile_args : [' -DCATCH3' ])]
68- endif
69- endif
70-
71- testlib = static_library (' testlib' , ' tests/catch_main.cpp' , dependencies : [catch2_dep])
72- testdep_socket = []
73- if host_machine .system() == ' sunos'
74- testdep_socket = cxx.find_library (' socket' )
75- endif
76-
77- test_cpp_args = []
78- feraiseexcept_test_code = '''
79- #define _GNU_SOURCE
80- #include <fenv.h>
81-
82- int main() {
83- feenableexcept(FE_DIVBYZERO);
84- feraiseexcept(FE_DIVBYZERO);
85- }
86- '''
87- if cxx.links(feraiseexcept_test_code,
88- name : ' feraiseexcept' )
89- test_cpp_args += [' -DTEST_ENABLE_FERAISEEXCEPT' ]
90- endif
91-
92- test_no_opts_cpp_args = []
93-
94- # The tests are by necessity made using undefined behavior (after all it needs to test what happens in situations that
95- # are, for good reason, undefined behavior).
96- # To make this a bit more likely to work, just disable link time optimization if possible.
97- if cxx.has_argument(' -fno-lto' )
98- test_no_opts_cpp_args += [' -fno-lto' , ' -O0' ]
99- endif
100-
101- verbose_kwargs = {}
102- if meson .version().version_compare(' >=0.62' )
103- verbose_kwargs += {' verbose' : true }
104- endif
105-
106- test (' tests' , executable (' tests' , ' tests/tests.cpp' , link_with : [testlib],
107- dependencies : [posixsignalmanager_dep, qt5_dep, librt, catch2_dep, testdep_socket],
108- cpp_args : test_cpp_args + test_no_opts_cpp_args),
109- kwargs : verbose_kwargs)
60+ if get_option (' tests' )
61+ subdir (' tests' )
11062endif
0 commit comments