From bf8caa1c0a1df5d9552507aa00511f2ff3f64c1a Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 16 Oct 2024 05:09:53 +0200 Subject: [PATCH 1/2] [#460] Add Rust feature flags to cmake --- CMakeLists.txt | 36 +++++++++++++++++++++++++++++++++++ Cargo.Bazel.lock | 2 +- iceoryx2-ffi/c/CMakeLists.txt | 9 ++++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e531358f..5dc52d37f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,19 @@ macro(add_param) message(STATUS " ${ADD_PARAM_NAME}: ${${ADD_PARAM_NAME}} (Description: ${ADD_PARAM_DESCRIPTION})") endmacro() +set(IOX2_RUST_FEATURES "") +macro(add_rust_feature) + set(ONE_VALUE_ARGS NAME DESCRIPTION DEFAULT_VALUE RUST_FEATURE) + cmake_parse_arguments(ADD_RUST_FEATURE "" "${ONE_VALUE_ARGS}" "" ${ARGN}) + + option(${ADD_RUST_FEATURE_NAME} ${ADD_RUST_FEATURE_DESCRIPTION} ${ADD_RUST_FEATURE_DEFAULT_VALUE}) + message(STATUS " ${ADD_RUST_FEATURE_NAME}: ${${ADD_RUST_FEATURE_NAME}} (Description: ${ADD_RUST_FEATURE_DESCRIPTION})") + + if(${ADD_RUST_FEATURE_NAME}) + list(APPEND IOX2_RUST_FEATURES ${ADD_RUST_FEATURE_RUST_FEATURE}) + endif() +endmacro() + message(STATUS "iceoryx2 options:") add_option( @@ -68,6 +81,29 @@ add_param( DEFAULT_VALUE "" ) +message(STATUS "iceoryx2 Rust feature flags:") + +add_rust_feature( + NAME IOX2_FEATURE_DEV_PERMISSIONS + DESCRIPTION "The permissions of all resources will be set to read, write, execute for everyone." + DEFAULT_VALUE OFF + RUST_FEATURE "iceoryx2/dev_permissions" +) + +add_rust_feature( + NAME IOX2_FEATURE_LOGGER_LOG + DESCRIPTION "Enables https://crates.io/crates/log as default logger" + DEFAULT_VALUE OFF + RUST_FEATURE "iceoryx2/logger_log" +) + +add_rust_feature( + NAME IOX2_FEATURE_LOGGER_TRACING + DESCRIPTION "Enables https://crates.io/crates/tracing as default logger" + DEFAULT_VALUE OFF + RUST_FEATURE "iceoryx2/logger_tracing" +) + if(SANITIZERS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined") diff --git a/Cargo.Bazel.lock b/Cargo.Bazel.lock index 3e1c921e9..646eff1d8 100644 --- a/Cargo.Bazel.lock +++ b/Cargo.Bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "f4b0efe0add514e7053794a25f1bdfb4b5425e10bb77c6212ba5157d14fca9d3", + "checksum": "d7b1759c5d28cbeb3fff8b9da5ca81261aa8c593891b9eff7d3c554d07b4c8dd", "crates": { "addr2line 0.24.2": { "name": "addr2line", diff --git a/iceoryx2-ffi/c/CMakeLists.txt b/iceoryx2-ffi/c/CMakeLists.txt index a9efbbe39..bd6b952c8 100644 --- a/iceoryx2-ffi/c/CMakeLists.txt +++ b/iceoryx2-ffi/c/CMakeLists.txt @@ -64,10 +64,17 @@ if(WIN32) list(APPEND ICEORYX2_C_LIB_ARTIFACTS ${ICEORYX2_C_SHARED_LIB_DLL_FILE}) endif() +set(RUST_FEATURE_FLAGS "") +list(LENGTH IOX2_RUST_FEATURES IOX2_RUST_FEATURES_COUNT) +if(IOX2_RUST_FEATURES_COUNT GREATER 0) + list(JOIN IOX2_RUST_FEATURES "," RUST_FEATURE_FLAGS_STRING) + set(RUST_FEATURE_FLAGS "--features=${RUST_FEATURE_FLAGS_STRING}") +endif() + # run cargo add_custom_target( iceoryx2-build-step ALL - COMMAND cargo build ${RUST_BUILD_TYPE_FLAG} --package iceoryx2-ffi --target-dir=${RUST_TARGET_DIR} ${RUST_TARGET_TRIPLET_FLAG} + COMMAND cargo build ${RUST_BUILD_TYPE_FLAG} ${RUST_FEATURE_FLAGS} --package iceoryx2-ffi --target-dir=${RUST_TARGET_DIR} ${RUST_TARGET_TRIPLET_FLAG} BYPRODUCTS ${ICEORYX2_C_INCLUDE_DIR}/iox2/iceoryx2.h ${ICEORYX2_C_STATIC_LIB_LINK_FILE} From a390fe3918dd1f5161d570099ef85585dfea07ff Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 16 Oct 2024 05:11:47 +0200 Subject: [PATCH 2/2] [#460] Update release notes --- doc/release-notes/iceoryx2-unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release-notes/iceoryx2-unreleased.md b/doc/release-notes/iceoryx2-unreleased.md index ca3ef937b..3f289f100 100644 --- a/doc/release-notes/iceoryx2-unreleased.md +++ b/doc/release-notes/iceoryx2-unreleased.md @@ -13,6 +13,7 @@ * Add Event-Multiplexer `WaitSet` [#390](https://github.com/eclipse-iceoryx/iceoryx2/issues/390) * Add `PeriodicTimer` into POSIX building blocks [#425](https://github.com/eclipse-iceoryx/iceoryx2/issues/425) +* Developer permissions for resources [#460](https://github.com/eclipse-iceoryx/iceoryx2/issues/460) ### Bugfixes