Skip to content

Commit 89652ca

Browse files
mhhollomonpantor
authored andcommitted
Add meson target to update single include (#86)
- You can now update the single include file in a meson build by using the target 'amalg'. - The meson build also now builds the single include test suite. - cmake build updated to use the new script to update the single include.
1 parent da5bbb1 commit 89652ca

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ endif()
6767

6868
target_link_libraries(inja INTERFACE ${INJA_SELECTED_JSON_LIBRARY})
6969

70-
execute_process(COMMAND python3 amalgamate/amalgamate.py -c amalgamate/config.json -s include WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
70+
execute_process(COMMAND scripts/update_single_include.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
7171

7272

7373
if (COVERALLS)

amalgamate/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"project": "inja",
33
"target": "single_include/inja/inja.hpp",
44
"sources": [
5-
"../include/inja/inja.hpp"
5+
"inja/inja.hpp"
66
],
77
"include_paths": [
88
]

meson.build

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ inja_dep = declare_dependency(
1010
)
1111

1212

13+
14+
amalg_script = files('scripts/update_single_include.sh')
15+
16+
amalg_files = files(
17+
'include/inja/inja.hpp',
18+
'include/inja/renderer.hpp',
19+
'include/inja/environment.hpp',
20+
)
21+
22+
amalg_tgt = run_target( 'amalg',
23+
command: amalg_script
24+
)
25+
26+
1327
inja_test = executable(
1428
'inja_test',
1529
'test/unit.cpp',
@@ -18,6 +32,16 @@ inja_test = executable(
1832
dependencies: inja_dep
1933
)
2034

35+
inja_single_test = executable(
36+
'inja_single_test',
37+
'test/unit.cpp',
38+
'test/unit-files.cpp',
39+
'test/unit-renderer.cpp',
40+
'single_include/inja/inja.hpp',
41+
dependencies: [inja_dep]
42+
)
43+
44+
2145
inja_benchmark = executable(
2246
'inja_benchmark',
2347
'test/benchmark.cpp',
@@ -26,3 +50,4 @@ inja_benchmark = executable(
2650

2751

2852
test('Inja unit test', inja_test)
53+
test('Inja single include test', inja_single_test)

scripts/update_single_include.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
if [ "${MESON_SOURCE_ROOT}" != "" ]
4+
then
5+
cd ${MESON_SOURCE_ROOT}
6+
fi
7+
8+
python3 amalgamate/amalgamate.py -c amalgamate/config.json -s include -v yes

0 commit comments

Comments
 (0)