From d9032ef3199a86c14bd4263f8750d682341b6696 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 24 Oct 2024 11:17:47 +0200 Subject: [PATCH] add sample toolchains and fix library names --- .cargo/config.toml | 3 +++ CMakeLists.txt | 12 ++++++++++-- TC-armv7-unknown-linux-gnueabihf.cmake | 5 +++++ TC-x86_64-pc-windows-gnu.cmake | 5 +++++ TC-x86_64-unknown-linux-gnu.cmake | 5 +++++ install/CMakeLists.txt | 5 ++++- install/cpack_project_config.cmake | 8 -------- 7 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 TC-armv7-unknown-linux-gnueabihf.cmake create mode 100644 TC-x86_64-pc-windows-gnu.cmake create mode 100644 TC-x86_64-unknown-linux-gnu.cmake diff --git a/.cargo/config.toml b/.cargo/config.toml index 5adae5e04..153e58df2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ rustflags = "-Ctarget-feature=-crt-static" [target.aarch64-unknown-linux-musl] rustflags = "-Ctarget-feature=-crt-static" + +[target.armv7-unknown-linux-gnueabihf] +linker = "armv7-linux-gnueabihf-gcc" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 592e291e9..656b31c38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,9 +175,17 @@ set_lib(dylibsd dylibd ${CMAKE_SHARED_LIBRARY_PREFIX}zenohcd${CMAKE_SHARED_LIBRA set_lib(staticlibsr staticlibr ${CMAKE_STATIC_LIBRARY_PREFIX}zenohc${CMAKE_STATIC_LIBRARY_SUFFIX}) set_lib(staticlibsd staticlibd ${CMAKE_STATIC_LIBRARY_PREFIX}zenohcd${CMAKE_STATIC_LIBRARY_SUFFIX}) if(WIN32) - set_lib(dylibsr implibr ${CMAKE_IMPORT_LIBRARY_PREFIX}zenohc${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) - set_lib(dylibsd implibd ${CMAKE_IMPORT_LIBRARY_PREFIX}zenohcd${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) + if (MINGW) + set_lib(dylibsr dylibr zenohc${CMAKE_SHARED_LIBRARY_SUFFIX}) + set_lib(dylibsd dylibd zenohcd${CMAKE_SHARED_LIBRARY_SUFFIX}) + set_lib(dylibsr implibr ${CMAKE_STATIC_LIBRARY_PREFIX}zenohc${CMAKE_IMPORT_LIBRARY_SUFFIX}) + set_lib(dylibsd implibd ${CMAKE_STATIC_LIBRARY_PREFIX}zenohcd${CMAKE_IMPORT_LIBRARY_SUFFIX}) + elseif(MSVC) + set_lib(dylibsr implibr ${CMAKE_STATIC_LIBRARY_PREFIX}zenohc${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) + set_lib(dylibsd implibd ${CMAKE_STATIC_LIBRARY_PREFIX}zenohcd${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) + endif() endif() + list(APPEND libsr ${dylibsr}) list(APPEND libsr ${staticlibsr}) list(APPEND libsd ${dylibsd}) diff --git a/TC-armv7-unknown-linux-gnueabihf.cmake b/TC-armv7-unknown-linux-gnueabihf.cmake new file mode 100644 index 000000000..846a53d6a --- /dev/null +++ b/TC-armv7-unknown-linux-gnueabihf.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR armv7) +set(ZENOHC_CUSTOM_TARGET armv7-unknown-linux-gnueabihf) +set(CMAKE_C_COMPILER armv7-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER armv7-linux-gnueabihf-g++) \ No newline at end of file diff --git a/TC-x86_64-pc-windows-gnu.cmake b/TC-x86_64-pc-windows-gnu.cmake new file mode 100644 index 000000000..bd8d38787 --- /dev/null +++ b/TC-x86_64-pc-windows-gnu.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) +set(ZENOHC_CUSTOM_TARGET x86_64-pc-windows-gnu) +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_CXX_COMPILER_TARGET x86_64-w64-mingw32-g++) \ No newline at end of file diff --git a/TC-x86_64-unknown-linux-gnu.cmake b/TC-x86_64-unknown-linux-gnu.cmake new file mode 100644 index 000000000..523c95d6d --- /dev/null +++ b/TC-x86_64-unknown-linux-gnu.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR x86_64) +set(ZENOHC_CUSTOM_TARGET x86_64-unknown-linux-gnu) +set(CMAKE_C_COMPILER x86_64-unknown-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER x86_64-unknown-linux-gnu-g++) \ No newline at end of file diff --git a/install/CMakeLists.txt b/install/CMakeLists.txt index 3b9e64d98..96c4ca48a 100644 --- a/install/CMakeLists.txt +++ b/install/CMakeLists.txt @@ -92,6 +92,7 @@ install_zenohc_lib("Debug" "DEBUG" zenohc) # # Configure CPack # +set(CPACK_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages") set(CPACK_PACKAGE_CHECKSUM MD5) set(CPACK_PACKAGE_VENDOR "The Eclipse Foundation") @@ -123,7 +124,9 @@ if(NOT CPACK_PACKAGE_VERSION) endif() endif() -set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") + +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}) set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cpack_project_config.cmake") include(CPack) diff --git a/install/cpack_project_config.cmake b/install/cpack_project_config.cmake index f6425b117..51c220aab 100644 --- a/install/cpack_project_config.cmake +++ b/install/cpack_project_config.cmake @@ -1,15 +1,7 @@ if(CPACK_GENERATOR MATCHES "DEB") # DEB package - if(NOT DEBARCH) - execute_process( - COMMAND dpkg --print-architecture - OUTPUT_VARIABLE DEBARCH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() message(STATUS "Configure DEB packaging for Linux ${DEBARCH}") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ZettaScale Zenoh Team, ") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEBARCH}) set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) set(CPACK_DEBIAN_LIB_PACKAGE_NAME lib${CPACK_PACKAGE_NAME})