mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
b8b9789a69
- 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.
30 lines
880 B
CMake
30 lines
880 B
CMake
################################################################################
|
|
#
|
|
# :: APIDSL regeneration
|
|
#
|
|
################################################################################
|
|
|
|
find_program(APIDSL NAMES
|
|
apidsl
|
|
apidsl.native
|
|
apidsl.byte
|
|
${CMAKE_SOURCE_DIR}/../apidsl/apigen.native)
|
|
find_program(ASTYLE NAMES
|
|
astyle)
|
|
|
|
function(apidsl)
|
|
if(APIDSL AND ASTYLE)
|
|
foreach(in_file ${ARGN})
|
|
get_filename_component(dirname ${in_file} DIRECTORY)
|
|
get_filename_component(filename ${in_file} NAME_WE)
|
|
set(out_file ${CMAKE_SOURCE_DIR}/${dirname}/${filename}.h)
|
|
add_custom_command(
|
|
OUTPUT ${out_file}
|
|
COMMAND "${APIDSL}" "${CMAKE_SOURCE_DIR}/${in_file}"
|
|
| "${ASTYLE}" --options="${CMAKE_SOURCE_DIR}/other/astyle/astylerc"
|
|
> "${out_file}"
|
|
DEPENDS ${in_file})
|
|
endforeach()
|
|
endif()
|
|
endfunction()
|