aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt23
-rw-r--r--src/vlibmemory/CMakeLists.txt5
-rw-r--r--src/vnet/CMakeLists.txt9
3 files changed, 24 insertions, 13 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()
diff --git a/src/vlibmemory/CMakeLists.txt b/src/vlibmemory/CMakeLists.txt
index 3459f03db1b..a37fc9fe451 100644
--- a/src/vlibmemory/CMakeLists.txt
+++ b/src/vlibmemory/CMakeLists.txt
@@ -11,8 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-vpp_generate_api_header(memclnt.api)
-add_custom_target(vlibmemory_api_headers DEPENDS memclnt.api.h)
+vpp_add_api_files(vlibmemory_api_headers
+ memclnt.api
+)
add_library (vlibmemory SHARED
memory_api.c
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 1ae56183116..ec9fc2dcb67 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -424,7 +424,7 @@ set(VNET_SRCS
vxlan/vxlan.c
)
-set (VNET_API_FILES
+vpp_add_api_files(vnet_api_headers
vxlan-gpe/vxlan_gpe.api
ip/ip.api
ip/rd_cp.api
@@ -475,13 +475,6 @@ set (VNET_API_FILES
bfd/bfd.api
)
-set(VNET_API_HDRS)
-foreach (file ${VNET_API_FILES})
- vpp_generate_api_header(${file})
- list(APPEND VNET_API_HDRS ${file}.h)
-endforeach()
-add_custom_target(vnet_api_headers DEPENDS ${VNET_API_HDRS})
-
add_library(vnet SHARED ${VNET_SRCS})
vpp_library_set_multiarch_sources(vnet