From a1d0b0ad80f5fce445ad561de6ad905b30a288ae Mon Sep 17 00:00:00 2001 From: David Wagner Date: Mon, 2 May 2016 18:40:22 +0200 Subject: [PATCH 1/3] CMake: homogenize how install-time interfaces are propagated There are two ways of propagating the post-install include requirements: either by adding an 'INCLUDES DESTINATION' argument to the 'install' directive or by adding an 'INTERFACE' argument to the 'target_include_directories' and using a generator expression to make it active at install-time only. This patch prefers changes for the latter since it is consistent with how build-time requirements are propagated. Signed-off-by: David Wagner --- parameter/CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt index 05c90af13..f92f26b2b 100644 --- a/parameter/CMakeLists.txt +++ b/parameter/CMakeLists.txt @@ -132,19 +132,22 @@ target_link_libraries(parameter target_include_directories(parameter PUBLIC $ - PUBLIC $) + PUBLIC $ + INTERFACE $ + INTERFACE $) install(TARGETS parameter EXPORT ParameterTargets - LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib - INCLUDES DESTINATION "include/parameter/client" "include/parameter/plugin") + LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) # Export an interface library for plugins to use (after the ParameterFramework # project is built and installed). It makes them link against libparameter and # use xmlserializer's and pfw_utilify's include directories. add_library(plugin INTERFACE) target_link_libraries(plugin INTERFACE parameter) -install(TARGETS plugin EXPORT ParameterTargets - INCLUDES DESTINATION "include/parameter/xmlserializer" "include/parameter/utility") +target_include_directories(plugin + INTERFACE $ + INTERFACE $) +install(TARGETS plugin EXPORT ParameterTargets) # Unfortunately, while the "plugin" interface library is suitable for external # plugins (built using the installed Parameter Framework) we want to build some # plugins before the whole project is installed. Therefore, they need to get From 529a730deaaf3c5d2f3a041c136d998bd2a101db Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 3 May 2016 14:50:59 +0200 Subject: [PATCH 2/3] CMake: Add missing destination for cparameter.lib on windows Signed-off-by: David Wagner --- bindings/c/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index c04ac3c9c..af5310c11 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -37,7 +37,7 @@ install(FILES ParameterFramework.h target_link_libraries(cparameter PRIVATE parameter pfw_utility) -install(TARGETS cparameter LIBRARY DESTINATION lib RUNTIME DESTINATION bin) +install(TARGETS cparameter LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) if(BUILD_TESTING) # Add unit test From bf2c083289a6cc5e823dda2114498c4657c818b6 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Mon, 2 May 2016 18:49:19 +0200 Subject: [PATCH 3/3] CMake: define installation components 'install' commands can receive 'COMPONENT' arguments (one per target file kind). Upon request, CMake can install only the files associated to a given component. This will be used to generate separate archives/pacakges/installers with CPack. The following components are declared: - runtime (libparameter and libremote-processor); - dev (everything necessary to develop a plugin or a client: headers, cmake package files, ...); - c (the C bindings, i.e. libcparameter); - cdev (everything necessary to develop a client using the C bindings); - python (the Python bindings); - eng (the various tools, XML schemas, ...); - runtime-deps (on windows only: the msvc redistributable files). Unfortunately, per-component debian package generation and automatic dependency discovery (using shlibdeps) do not work together before CMake 3.4. Also, per-component debian package dependency declaration has been added in CMake 3.4, so it is not possible yet to declare, for instance, that the 'dev' package depends on the 'runtime' package. However, the following works and generates one archive for each component: cpack -G TGZ -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON Signed-off-by: David Wagner --- .travis.yml | 4 ++++ bindings/c/CMakeLists.txt | 8 ++++++-- bindings/python/CMakeLists.txt | 5 +++-- cmake/CMakeLists.txt | 6 ++++-- cpack/CMakeLists.txt | 2 ++ parameter/CMakeLists.txt | 15 ++++++++++----- remote-process/CMakeLists.txt | 3 ++- remote-processor/CMakeLists.txt | 4 +++- schemas/CMakeLists.txt | 3 ++- test/test-platform/CMakeLists.txt | 2 +- tools/bash_completion/CMakeLists.txt | 3 ++- tools/xmlGenerator/CMakeLists.txt | 5 +++-- tools/xmlValidator/CMakeLists.txt | 2 +- utility/CMakeLists.txt | 3 ++- xmlserializer/CMakeLists.txt | 3 ++- 15 files changed, 47 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 927730174..343e1eec9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -118,6 +118,10 @@ script: cmake $MY_CMAKE_OPTIONS . && make && make install ); fi + # Check that all installed files are in a component (no "unspecified + # component" archive created) + - (cd build && cpack -G TGZ -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON && + [ ! -a '*-Unspecified.tar.gz' ]) # Keep this last - ( mkdir build_less_features && cd build_less_features && rm -rf $PREFIX/asio-1.10.6 && diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index af5310c11..f9dd3d0c0 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -33,11 +33,15 @@ generate_export_header(cparameter) install(FILES ParameterFramework.h "${CMAKE_CURRENT_BINARY_DIR}/cparameter_export.h" - DESTINATION "include/parameter/c") + DESTINATION "include/parameter/c" + COMPONENT c_dev) target_link_libraries(cparameter PRIVATE parameter pfw_utility) -install(TARGETS cparameter LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) +install(TARGETS cparameter + LIBRARY DESTINATION lib COMPONENT c + RUNTIME DESTINATION bin COMPONENT c + ARCHIVE DESTINATION lib COMPONENT c_dev) if(BUILD_TESTING) # Add unit test diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 580763389..bdb6513e0 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -89,7 +89,8 @@ execute_process(COMMAND print(sysconfig.get_python_lib(plat_specific=True, prefix=''))" OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) -install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH}) +install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH} COMPONENT python) # install the generated Python file as well -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH} + COMPONENT python) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 29ce10a3c..319616b02 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -43,8 +43,10 @@ export(EXPORT ParameterTargets install(EXPORT ParameterTargets DESTINATION lib/cmake/ParameterFramework FILE ParameterFrameworkTargets.cmake - NAMESPACE ParameterFramework::) + NAMESPACE ParameterFramework:: + COMPONENT dev) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ParameterFrameworkConfigVersion.cmake" - DESTINATION lib/cmake/ParameterFramework) + DESTINATION lib/cmake/ParameterFramework + COMPONENT dev) diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt index 516ce4d66..25d929867 100644 --- a/cpack/CMakeLists.txt +++ b/cpack/CMakeLists.txt @@ -47,6 +47,8 @@ set(CPACK_WIX_UPGRADE_GUID "47E60D10-B344-445D-A2F6-5684CC8B1D47") if (WIN32) # On windows, pack compiler provided libraries (MSVC redistributable) with the project + # Have cpack make a specific archive for them + set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT runtime_deps) include(InstallRequiredSystemLibraries) # TODO: pack libxml2.dll with the project endif() diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt index f92f26b2b..ca956f57e 100644 --- a/parameter/CMakeLists.txt +++ b/parameter/CMakeLists.txt @@ -137,7 +137,9 @@ target_include_directories(parameter INTERFACE $) install(TARGETS parameter EXPORT ParameterTargets - LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) + LIBRARY DESTINATION lib COMPONENT runtime + RUNTIME DESTINATION bin COMPONENT runtime + ARCHIVE DESTINATION lib COMPONENT dev) # Export an interface library for plugins to use (after the ParameterFramework # project is built and installed). It makes them link against libparameter and @@ -147,7 +149,7 @@ target_link_libraries(plugin INTERFACE parameter) target_include_directories(plugin INTERFACE $ INTERFACE $) -install(TARGETS plugin EXPORT ParameterTargets) +install(TARGETS plugin EXPORT ParameterTargets COMPONENT dev) # Unfortunately, while the "plugin" interface library is suitable for external # plugins (built using the installed Parameter Framework) we want to build some # plugins before the whole project is installed. Therefore, they need to get @@ -167,7 +169,8 @@ install(FILES include/ParameterMgrPlatformConnector.h include/SelectionCriterionInterface.h include/SelectionCriterionTypeInterface.h - DESTINATION "include/parameter/client") + DESTINATION "include/parameter/client" + COMPONENT dev) # Core (plugin) headers install(FILES "${CMAKE_CURRENT_BINARY_DIR}/parameter_export.h" @@ -194,6 +197,8 @@ install(FILES Syncer.h TypeElement.h VirtualSubsystem.h - DESTINATION "include/parameter/plugin") + DESTINATION "include/parameter/plugin" + COMPONENT dev) install(DIRECTORY log/include/log/ - DESTINATION "include/parameter/plugin/log") + DESTINATION "include/parameter/plugin/log" + COMPONENT dev) diff --git a/remote-process/CMakeLists.txt b/remote-process/CMakeLists.txt index e27a101e8..a7fc63b79 100644 --- a/remote-process/CMakeLists.txt +++ b/remote-process/CMakeLists.txt @@ -35,5 +35,6 @@ if(NETWORKING) target_link_libraries(remote-process PRIVATE remote-processor pfw_utility asio ${CMAKE_THREAD_LIBS_INIT}) - install(TARGETS remote-process RUNTIME DESTINATION bin) + install(TARGETS remote-process RUNTIME DESTINATION bin + COMPONENT eng) endif() diff --git a/remote-processor/CMakeLists.txt b/remote-processor/CMakeLists.txt index 5887bf5ea..d1d0d3257 100644 --- a/remote-processor/CMakeLists.txt +++ b/remote-processor/CMakeLists.txt @@ -43,4 +43,6 @@ find_package(Threads REQUIRED) target_link_libraries(remote-processor PRIVATE pfw_utility asio ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS remote-processor EXPORT ParameterTargets - LIBRARY DESTINATION lib RUNTIME DESTINATION bin) + LIBRARY DESTINATION lib COMPONENT runtime + RUNTIME DESTINATION bin COMPONENT runtime + ARCHIVE DESTINATION lib COMPONENT dev) diff --git a/schemas/CMakeLists.txt b/schemas/CMakeLists.txt index ba876fe5c..0b9dc6c1e 100644 --- a/schemas/CMakeLists.txt +++ b/schemas/CMakeLists.txt @@ -37,4 +37,5 @@ install(FILES ComponentLibrary.xsd Subsystem.xsd SystemClass.xsd W3cXmlAttributes.xsd - DESTINATION share/${PROJECT_NAME}/schemas) + DESTINATION share/${PROJECT_NAME}/schemas + COMPONENT eng) diff --git a/test/test-platform/CMakeLists.txt b/test/test-platform/CMakeLists.txt index 533de3c5a..5c54b4a7f 100644 --- a/test/test-platform/CMakeLists.txt +++ b/test/test-platform/CMakeLists.txt @@ -36,5 +36,5 @@ if(NETWORKING) # Workaround because asio is still leaking to test-platform target_link_libraries(test-platform PRIVATE asio) - install(TARGETS test-platform RUNTIME DESTINATION bin) + install(TARGETS test-platform RUNTIME DESTINATION bin COMPONENT eng) endif() diff --git a/tools/bash_completion/CMakeLists.txt b/tools/bash_completion/CMakeLists.txt index f2fb49111..435ee6917 100644 --- a/tools/bash_completion/CMakeLists.txt +++ b/tools/bash_completion/CMakeLists.txt @@ -27,4 +27,5 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. install(FILES remote-process - DESTINATION share/bash-completion/completions/) + DESTINATION share/bash-completion/completions/ + COMPONENT eng) diff --git a/tools/xmlGenerator/CMakeLists.txt b/tools/xmlGenerator/CMakeLists.txt index 72d1d95f2..a3567c5fe 100644 --- a/tools/xmlGenerator/CMakeLists.txt +++ b/tools/xmlGenerator/CMakeLists.txt @@ -29,7 +29,7 @@ add_executable(domainGeneratorConnector domainGeneratorConnector.cpp) target_link_libraries(domainGeneratorConnector PRIVATE parameter pfw_utility) -install(TARGETS domainGeneratorConnector RUNTIME DESTINATION bin) +install(TARGETS domainGeneratorConnector RUNTIME DESTINATION bin COMPONENT eng) install(PROGRAMS domainGenerator.sh @@ -40,4 +40,5 @@ install(PROGRAMS EddParser.py PFWScriptGenerator.py updateRoutageDomains.sh - DESTINATION bin) + DESTINATION bin + COMPONENT eng) diff --git a/tools/xmlValidator/CMakeLists.txt b/tools/xmlValidator/CMakeLists.txt index f44fed07e..536f94821 100644 --- a/tools/xmlValidator/CMakeLists.txt +++ b/tools/xmlValidator/CMakeLists.txt @@ -26,4 +26,4 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -install(PROGRAMS xmlValidator.py DESTINATION bin) +install(PROGRAMS xmlValidator.py DESTINATION bin COMPONENT eng) diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt index 8173ecaa3..035027585 100644 --- a/utility/CMakeLists.txt +++ b/utility/CMakeLists.txt @@ -46,7 +46,8 @@ install(FILES ErrorContext.hpp Utility.h convert.hpp - DESTINATION "include/parameter/utility") + DESTINATION "include/parameter/utility" + COMPONENT dev) if(BUILD_TESTING) # Add unit test diff --git a/xmlserializer/CMakeLists.txt b/xmlserializer/CMakeLists.txt index 91f51d2fe..ee263a5f7 100644 --- a/xmlserializer/CMakeLists.txt +++ b/xmlserializer/CMakeLists.txt @@ -69,4 +69,5 @@ install(FILES XmlSource.h XmlElement.h XmlSerializingContext.h - DESTINATION "include/parameter/xmlserializer") + DESTINATION "include/parameter/xmlserializer" + COMPONENT dev)