diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2018-08-20 07:41:52 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-20 15:05:07 +0000 |
commit | 5ff0e0b1864fa646accea1ee344cbd8db07605fe (patch) | |
tree | 7f6155f5b1641c4e23c8d27fecfbc6a6e649fb82 /src/CMakeLists.txt | |
parent | 23722e6bfa9e67e87de9b09d14fafe84d2a8f029 (diff) |
CMake: generate .json from .api files
Change-Id: Ic18aa0fb42a72b5e0ebbfbebdefc7582cb46b5ea
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84971c77ac6..e6054e10ac4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,7 +136,7 @@ endif() ############################################################################## # API ############################################################################## -function(vpp_generate_api_header file) +function(vpp_generate_api_c_header file) set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.h) get_filename_component(output_dir ${output_name} DIRECTORY) add_custom_command (OUTPUT ${output_name} @@ -144,15 +144,32 @@ function(vpp_generate_api_header file) COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} --output ${output_name} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} - COMMENT "Generating API header ${file}.h" + COMMENT "Generating API header ${output_name}" + ) +endfunction() + +function(vpp_generate_api_json_header file) + set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.json) + get_filename_component(output_dir ${output_name} DIRECTORY) + add_custom_command (OUTPUT ${output_name} + COMMAND mkdir -p ${output_dir} + COMMAND ${CMAKE_SOURCE_DIR}/tools/vppapigen/vppapigen + ARGS --includedir ${CMAKE_SOURCE_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/${file} JSON --output ${output_name} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} + COMMENT "Generating API header ${output_name}" ) endfunction() +function(vpp_generate_api_header file) + vpp_generate_api_c_header (${file}) + vpp_generate_api_json_header (${file}) +endfunction() + function(vpp_add_api_files target) unset(header_files) foreach(file ${ARGN}) vpp_generate_api_header (${file}) - list (APPEND header_files ${file}.h) + list (APPEND header_files ${file}.h ${file}.json) endforeach() add_custom_target(${target} DEPENDS ${header_files}) endfunction() |