aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-08-21 06:34:00 -0700
committerNeale Ranns <nranns@cisco.com>2018-08-22 08:06:55 +0000
commitffec78649735363778a192ad581020e7b73b472d (patch)
tree2b10ac5c187abeb2e7d1508c6b8f36d7e1a3a700
parent505ec22c64b294fe683a99958a65d7979c9ccaaf (diff)
CMake: install .json files in ROOT/share/... for papi.
Change-Id: I1a5325c5f026ba5e8d89608c285e934a6e1c16e6 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
-rw-r--r--src/CMakeLists.txt15
-rw-r--r--src/plugins/CMakeLists.txt6
2 files changed, 14 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e6054e10ac4..c0b4bba2084 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -148,7 +148,7 @@ function(vpp_generate_api_c_header file)
)
endfunction()
-function(vpp_generate_api_json_header file)
+function(vpp_generate_api_json_header file dir)
set (output_name ${CMAKE_CURRENT_BINARY_DIR}/${file}.json)
get_filename_component(output_dir ${output_name} DIRECTORY)
add_custom_command (OUTPUT ${output_name}
@@ -158,17 +158,24 @@ function(vpp_generate_api_json_header file)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
COMMENT "Generating API header ${output_name}"
)
+ install(FILES ${output_name} DESTINATION share/vpp/api/${dir}/)
endfunction()
-function(vpp_generate_api_header file)
+##############################################################################
+# generate the .h and .json files for a .api file
+# @param file - the name of the .api
+# @param dir - the install directory under ROOT/share/vpp/api to place the
+# generated .json file
+##############################################################################
+function(vpp_generate_api_header file dir)
vpp_generate_api_c_header (${file})
- vpp_generate_api_json_header (${file})
+ vpp_generate_api_json_header (${file} ${dir})
endfunction()
function(vpp_add_api_files target)
unset(header_files)
foreach(file ${ARGN})
- vpp_generate_api_header (${file})
+ vpp_generate_api_header (${file} core)
list (APPEND header_files ${file}.h ${file}.json)
endforeach()
add_custom_target(${target} DEPENDS ${header_files})
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 34d956d4f77..56cb6ef39fc 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -20,8 +20,8 @@ macro(add_vpp_plugin plugin_name)
set(api_headers)
foreach(f ${ARGN})
if(${f} MATCHES ".*\.api$")
- vpp_generate_api_header(${f})
- list(APPEND api_headers ${f}.h)
+ vpp_generate_api_header(${f} plugins)
+ list(APPEND api_headers ${f}.h ${f}.json)
endif()
endforeach()
add_library(${plugin_name} SHARED ${ARGN} ${api_headers})
@@ -36,7 +36,7 @@ macro(add_vpp_api_test_plugin plugin_name)
set(api_headers)
foreach(f ${ARGN})
if(${f} MATCHES ".*\.api$")
- vpp_generate_api_header(${f})
+ vpp_generate_api_header(${f} plugins)
list(APPEND api_headers ${f}.h)
endif()
endforeach()