From 4c64b6edc86f7732f4a160b948b3386e4021a265 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 26 Aug 2018 18:14:46 +0200 Subject: cmake: add vapi build Change-Id: Id939a0cbe35601478ad262f49bb0a1abdb62aa45 Signed-off-by: Damjan Marion --- src/cmake/api.cmake | 7 +++++-- src/cmake/library.cmake | 2 +- src/cmake/plugin.cmake | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/api.cmake b/src/cmake/api.cmake index 644e80b8270..533448ad16e 100644 --- a/src/cmake/api.cmake +++ b/src/cmake/api.cmake @@ -50,11 +50,14 @@ function(vpp_generate_api_header file dir) vpp_generate_api_json_header (${file} ${dir}) endfunction() -function(vpp_add_api_files target) +function(vpp_add_api_files name) unset(header_files) + set(target ${name}_api_headers) + file(RELATIVE_PATH rpath ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) foreach(file ${ARGN}) vpp_generate_api_header (${file} core) - list (APPEND header_files ${file}.h ${file}.json) + list(APPEND header_files ${file}.h ${file}.json) + set_property(GLOBAL APPEND PROPERTY VPP_API_FILES ${rpath}/${file}) endforeach() add_custom_target(${target} DEPENDS ${header_files}) endfunction() diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake index 6aa0ae848f9..9ed53e9dba7 100644 --- a/src/cmake/library.cmake +++ b/src/cmake/library.cmake @@ -33,7 +33,7 @@ macro(add_vpp_library lib) endif() if(ARG_API_FILES) - vpp_add_api_files(${lib}_api_headers ${ARG_API_FILES}) + vpp_add_api_files(${lib} ${ARG_API_FILES}) foreach(file ${ARG_API_FILES}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h DESTINATION include/${lib}/${dir}) diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake index 4087325b0d6..a5b4bf51a16 100644 --- a/src/cmake/plugin.cmake +++ b/src/cmake/plugin.cmake @@ -20,9 +20,11 @@ macro(add_vpp_plugin name) ) set(plugin_name ${name}_plugin) set(api_headers) + file(RELATIVE_PATH rpath ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) foreach(f ${PLUGIN_API_FILES}) - vpp_generate_api_header(${f} plugins) - list(APPEND api_headers ${f}.h ${f}.json) + vpp_generate_api_header(${f} plugins) + list(APPEND api_headers ${f}.h ${f}.json) + set_property(GLOBAL APPEND PROPERTY VPP_API_FILES ${rpath}/${f}) endforeach() add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_headers}) add_dependencies(${plugin_name} vpp_version_h api_headers) -- cgit 1.2.3-korg