summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-21 10:51:58 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-10-02 23:54:03 +0100
commitb8b9789a6975266433904b0ab4d381a9f3317986 (patch)
tree22a472dcc207a712fc7bb8abf44c54dd211431bc /cmake
parent66e1bb4510f69e3361ff95ebeaae42ee51a70675 (diff)
Rebuild apidsl'd headers in cmake.
- Moved apidsl headers next to their generated versions. In the future, perhaps all (or most) headers will be apidsl-generated, so the sources should stay together. - Try to find apidsl/apigen binary and astyle binary and use it for the format test. Don't run the format test if these can't be found.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ApiDsl.cmake29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/ApiDsl.cmake b/cmake/ApiDsl.cmake
new file mode 100644
index 00000000..777714ab
--- /dev/null
+++ b/cmake/ApiDsl.cmake
@@ -0,0 +1,29 @@
1################################################################################
2#
3# :: APIDSL regeneration
4#
5################################################################################
6
7find_program(APIDSL NAMES
8 apidsl
9 apidsl.native
10 apidsl.byte
11 ${CMAKE_SOURCE_DIR}/../apidsl/apigen.native)
12find_program(ASTYLE NAMES
13 astyle)
14
15function(apidsl)
16 if(APIDSL AND ASTYLE)
17 foreach(in_file ${ARGN})
18 get_filename_component(dirname ${in_file} DIRECTORY)
19 get_filename_component(filename ${in_file} NAME_WE)
20 set(out_file ${CMAKE_SOURCE_DIR}/${dirname}/${filename}.h)
21 add_custom_command(
22 OUTPUT ${out_file}
23 COMMAND "${APIDSL}" "${CMAKE_SOURCE_DIR}/${in_file}"
24 | "${ASTYLE}" --options="${CMAKE_SOURCE_DIR}/other/astyle/astylerc"
25 > "${out_file}"
26 DEPENDS ${in_file})
27 endforeach()
28 endif()
29endfunction()