From 39229af19516a023cbc43875fe7e828e4c43c84d Mon Sep 17 00:00:00 2001 From: Jonathan GUILLOT Date: Tue, 8 Oct 2024 10:31:08 +0200 Subject: [PATCH] Move development files in a Debian -dev package Install targets and files in default Runtime and Development CMake components to determine files included in the two Debian packages. Move to CMake minimum version to 3.12 to allow using NAMELINK_COMPONENT option in install() allowing adding .so files in a separate component, Developement here. Use CPack to build the two Debian packages. --- CMakeLists.txt | 12 +++++++++--- devLib/CMakeLists.txt | 6 ++---- gpio/CMakeLists.txt | 6 ++---- pins/CMakeLists.txt | 2 -- wiringPi/CMakeLists.txt | 6 ++---- wiringPiD/CMakeLists.txt | 2 -- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f44163..18cbd11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.12) project(WiringPiLib) # Read version from version.h @@ -37,11 +37,17 @@ set(CPACK_PACKAGE_VERSION_PATCH "") set(CPACK_GENERATOR "DEB") set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Grazer Computer Club - GC2 ") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libcrypt1") -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +set(CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS "libc6, libcrypt1") +set(CPACK_DEBIAN_RUNTIME_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/debian-template/wiringPi/DEBIAN/postinst" "${CMAKE_CURRENT_SOURCE_DIR}/debian-template/wiringPi/DEBIAN/postrm") +set(CPACK_DEB_COMPONENT_INSTALL TRUE) +set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-dev") +set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON) +set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_DEPENDS "${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}") + # Check for arm or arm64 architecture # Let CMake determine a value otherwise if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") diff --git a/devLib/CMakeLists.txt b/devLib/CMakeLists.txt index 4f3fcf9..027d197 100644 --- a/devLib/CMakeLists.txt +++ b/devLib/CMakeLists.txt @@ -1,6 +1,4 @@ # CMakeLists.txt for devLib - -cmake_minimum_required(VERSION 3.10) project(devLib) # Source files @@ -34,6 +32,6 @@ target_link_libraries(wiringPiDev PRIVATE wiringPi) set_target_properties(wiringPiDev PROPERTIES VERSION ${WIRINGPI_VERSION} SOVERSION ${WIRINGPI_VERSION_MAJOR}) # Install headers -install(FILES ${HEADERS} DESTINATION include) +install(FILES ${HEADERS} DESTINATION include COMPONENT Development) # Install the library -install(TARGETS wiringPiDev LIBRARY DESTINATION lib) +install(TARGETS wiringPiDev LIBRARY DESTINATION lib COMPONENT Runtime NAMELINK_COMPONENT Development) diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt index faf30e2..6cd1dfd 100644 --- a/gpio/CMakeLists.txt +++ b/gpio/CMakeLists.txt @@ -1,6 +1,4 @@ # CMakeLists.txt for gpio - -cmake_minimum_required(VERSION 3.10) project(gpio) find_package(PkgConfig REQUIRED) @@ -24,7 +22,7 @@ add_executable(gpio ${SRC}) target_link_libraries(gpio wiringPi wiringPiDev Threads::Threads m PkgConfig::libcrypt) # Install the executable -install(TARGETS gpio DESTINATION bin) +install(TARGETS gpio DESTINATION bin COMPONENT Runtime) # Install man page -install(FILES gpio.1 DESTINATION share/man/man1) +install(FILES gpio.1 DESTINATION share/man/man1 COMPONENT Runtime) diff --git a/pins/CMakeLists.txt b/pins/CMakeLists.txt index a7e29a9..858df3f 100644 --- a/pins/CMakeLists.txt +++ b/pins/CMakeLists.txt @@ -1,6 +1,4 @@ # CMakeLists.txt for pins - -cmake_minimum_required(VERSION 3.10) project(pins LANGUAGES NONE) # Source file diff --git a/wiringPi/CMakeLists.txt b/wiringPi/CMakeLists.txt index f54c61f..5ed92d4 100644 --- a/wiringPi/CMakeLists.txt +++ b/wiringPi/CMakeLists.txt @@ -1,6 +1,4 @@ # CMakeLists.txt for wiringPi - -cmake_minimum_required(VERSION 3.10) project(WiringPi) # Source files @@ -55,6 +53,6 @@ target_include_directories(wiringPi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) # Add -lm to link with the math library target_link_libraries(wiringPi PUBLIC m crypt) # Install headers -install(FILES ${HEADERS} DESTINATION include) +install(FILES ${HEADERS} DESTINATION include COMPONENT Development) # Install the library -install(TARGETS wiringPi LIBRARY DESTINATION lib) +install(TARGETS wiringPi LIBRARY DESTINATION lib COMPONENT Runtime NAMELINK_COMPONENT Development) diff --git a/wiringPiD/CMakeLists.txt b/wiringPiD/CMakeLists.txt index 26f44c2..c280088 100644 --- a/wiringPiD/CMakeLists.txt +++ b/wiringPiD/CMakeLists.txt @@ -1,6 +1,4 @@ # CMakeLists.txt for wiringPiD - -cmake_minimum_required(VERSION 3.10) project(wiringPiD) # Source files