diff options
author | Damjan Marion <damarion@cisco.com> | 2018-08-29 22:20:45 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-30 12:35:28 +0000 |
commit | 43b06063015abfa42bc9c5ab925cd6b7ea3cbf42 (patch) | |
tree | f7e1acfeae68735929ebaccf5fe1eb1b8f86ee0e /src/cmake | |
parent | ec2a9bbb89a4ec1ebf8982f1d611179cd84315b8 (diff) |
cmake: a bit of packaging work
Change-Id: I40332c2348c4aab873d726532f2ac3c4abde7ec9
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/cmake')
-rw-r--r-- | src/cmake/library.cmake | 23 | ||||
-rw-r--r-- | src/cmake/pack.cmake (renamed from src/cmake/deb.cmake) | 16 | ||||
-rw-r--r-- | src/cmake/plugin.cmake | 31 |
3 files changed, 52 insertions, 18 deletions
diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake index 66b4dffe575..0d1e97cb6a3 100644 --- a/src/cmake/library.cmake +++ b/src/cmake/library.cmake @@ -14,7 +14,7 @@ macro(add_vpp_library lib) cmake_parse_arguments(ARG "" - "" + "COMPONENT" "SOURCES;MULTIARCH_SOURCES;API_FILES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS" ${ARGN} ) @@ -27,7 +27,14 @@ macro(add_vpp_library lib) target_link_libraries(${lib} ${ARG_LINK_LIBRARIES}) endif() # install .so - install(TARGETS ${lib} DESTINATION ${VPP_LIB_DIR_NAME}) + if(NOT ARG_COMPONENT) + set(ARG_COMPONENT vpp) + endif() + install( + TARGETS ${lib} + DESTINATION ${VPP_LIB_DIR_NAME} + COMPONENT ${ARG_COMPONENT} + ) if(ARG_MULTIARCH_SOURCES) vpp_library_set_multiarch_sources(${lib} ${ARG_MULTIARCH_SOURCES}) @@ -37,7 +44,11 @@ macro(add_vpp_library lib) 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}) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h + DESTINATION include/${lib}/${dir} + COMPONENT vpp-dev + ) endforeach() endif() @@ -49,7 +60,11 @@ macro(add_vpp_library lib) if(ARG_INSTALL_HEADERS) foreach(file ${ARG_INSTALL_HEADERS}) get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} DESTINATION include/${lib}/${dir}) + install( + FILES ${file} + DESTINATION include/${lib}/${dir} + COMPONENT vpp-dev + ) endforeach() endif() endmacro() diff --git a/src/cmake/deb.cmake b/src/cmake/pack.cmake index 09c8ac6e0b2..328896610d0 100644 --- a/src/cmake/deb.cmake +++ b/src/cmake/pack.cmake @@ -18,13 +18,15 @@ set(CPACK_GENERATOR "DEB") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "VPP Team") set(CPACK_PACKAGE_NAME "vpp") set(CPACK_PACKAGE_VENDOR "fd.io") -set(CPACK_PACKAGE_VERSION "18.08") +set(CPACK_PACKAGE_VERSION "18.10") set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) -set(CPACK_DEBIAN_VPP_PACKAGE_NAME "vpp") -set(CPACK_DEBIAN_VPP_FILE_NAME "vpp.deb") -set(CPACK_DEBIAN_DEV_PACKAGE_NAME "vpp-dev") -set(CPACK_DEBIAN_DEV_FILE_NAME "vpp-dev.deb") -set(CPACK_DEBIAN_PLUGINS_PACKAGE_NAME "vpp-plugins") -set(CPACK_DEBIAN_PLUGINS_FILE_NAME "vpp-plugins.deb") + +get_cmake_property(components COMPONENTS) +foreach(lc ${components}) + string(TOUPPER ${lc} uc) + set(CPACK_DEBIAN_${uc}_PACKAGE_NAME "${lc}") + set(CPACK_DEBIAN_${uc}_FILE_NAME "${lc}.deb") +endforeach() + include(CPack) diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake index a0442394092..9f9a6460f0f 100644 --- a/src/cmake/plugin.cmake +++ b/src/cmake/plugin.cmake @@ -14,7 +14,7 @@ macro(add_vpp_plugin name) cmake_parse_arguments(PLUGIN "" - "LINK_FLAGS" + "LINK_FLAGS;COMPONENT" "SOURCES;API_FILES;MULTIARCH_SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;API_TEST_SOURCES" ${ARGN} ) @@ -26,8 +26,11 @@ macro(add_vpp_plugin name) vpp_generate_api_header(${f} plugins) list(APPEND api_headers ${f}.h ${f}.json) set_property(GLOBAL APPEND PROPERTY VPP_API_FILES ${rpath}/${f}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}.h DESTINATION - include/vpp_plugins/${name}/${dir}) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${f}.h + DESTINATION include/vpp_plugins/${name}/${dir} + COMPONENT vpp-dev + ) endforeach() add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_headers}) target_compile_options(${plugin_name} PRIVATE -Wall) @@ -47,9 +50,16 @@ macro(add_vpp_plugin name) if(PLUGIN_INSTALL_HEADERS) foreach(file ${PLUGIN_INSTALL_HEADERS}) get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} DESTINATION include/vpp_plugins/${name}/${dir}) + install( + FILES ${file} + DESTINATION include/vpp_plugins/${name}/${dir} + COMPONENT vpp-dev + ) endforeach() endif() + if(NOT PLUGIN_COMPONENT) + set(PLUGIN_COMPONENT vpp-plugin-misc) + endif() if(PLUGIN_API_TEST_SOURCES) set(test_plugin_name ${name}_test_plugin) add_library(${test_plugin_name} SHARED ${PLUGIN_API_TEST_SOURCES} ${api_headers}) @@ -57,9 +67,16 @@ macro(add_vpp_plugin name) set_target_properties(${test_plugin_name} PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/vpp_api_test_plugins) - install(TARGETS ${test_plugin_name} DESTINATION ${VPP_LIB_DIR_NAME}/vpp_api_test_plugins COMPONENT - plugins) + install( + TARGETS ${test_plugin_name} + DESTINATION ${VPP_LIB_DIR_NAME}/vpp_api_test_plugins + COMPONENT ${PLUGIN_COMPONENT} + ) endif() - install(TARGETS ${plugin_name} DESTINATION ${VPP_LIB_DIR_NAME}/vpp_plugins COMPONENT plugins) + install( + TARGETS ${plugin_name} + DESTINATION ${VPP_LIB_DIR_NAME}/vpp_plugins + COMPONENT ${PLUGIN_COMPONENT} + ) endmacro() |