Skip to content

Commit 44b23f2

Browse files
authored
fix: Add option to disable tests and benchmarks with Meson (pantor#216)
Co-authored-by: Benedikt Bastin <[email protected]>
1 parent d462b9f commit 44b23f2

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

meson.build

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
project('inja', 'cpp', default_options: ['cpp_std=c++17'])
22

33

4-
#option('build_tests', type: 'boolean', value: true)
5-
#option('build_benchmark', type: 'boolean', value: true)
6-
7-
84
inja_dep = declare_dependency(
95
include_directories: include_directories('include', 'third_party/include')
106
)
117

128

13-
149
amalg_script = files('scripts/update_single_include.sh')
1510

1611
amalg_files = files(
@@ -23,27 +18,29 @@ amalg_tgt = run_target( 'amalg',
2318
command: amalg_script
2419
)
2520

26-
27-
inja_test = executable(
28-
'inja_test',
29-
'test/test.cpp',
30-
dependencies: inja_dep
31-
)
32-
33-
inja_single_test = executable(
34-
'inja_single_test',
35-
'test/test.cpp',
36-
'single_include/inja/inja.hpp',
37-
dependencies: [inja_dep]
38-
)
39-
40-
41-
inja_benchmark = executable(
42-
'inja_benchmark',
43-
'test/benchmark.cpp',
44-
dependencies: inja_dep
45-
)
46-
47-
48-
test('Inja unit test', inja_test)
49-
test('Inja single include test', inja_single_test)
21+
if get_option('build_tests')
22+
inja_test = executable(
23+
'inja_test',
24+
'test/test.cpp',
25+
dependencies: inja_dep
26+
)
27+
28+
inja_single_test = executable(
29+
'inja_single_test',
30+
'test/test.cpp',
31+
'single_include/inja/inja.hpp',
32+
dependencies: [inja_dep]
33+
)
34+
35+
test('Inja unit test', inja_test)
36+
test('Inja single include test', inja_single_test)
37+
endif
38+
39+
40+
if get_option('build_benchmark')
41+
inja_benchmark = executable(
42+
'inja_benchmark',
43+
'test/benchmark.cpp',
44+
dependencies: inja_dep
45+
)
46+
endif

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
option('build_tests', type: 'boolean', value: true)
2+
option('build_benchmark', type: 'boolean', value: true)

0 commit comments

Comments
 (0)