diff --git a/CMakeLists.txt b/CMakeLists.txt index 582e14aa..637e48ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,8 +77,13 @@ function(rust_cargo_application) # TODO: Make sure RUSTFLAGS is not set. - # TODO: Let this be configurable, or based on Kconfig debug? - set(RUST_BUILD_TYPE debug) + if(CONFIG_DEBUG) + set(RUST_BUILD_TYPE "debug") + set(rust_build_type_arg "") + else() + set(RUST_BUILD_TYPE "release") + set(rust_build_type_arg "--release") + endif() set(BUILD_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${RUST_TARGET}/${RUST_BUILD_TYPE}") set(CARGO_TARGET_DIR "${CMAKE_CURRENT_BINARY_DIR}/rust/target") @@ -152,8 +157,7 @@ ${config_paths} INCLUDE_DEFINES="${include_defines}" WRAPPER_FILE="${WRAPPER_FILE}" cargo build - # TODO: release flag if release build - # --release + ${rust_build_type_arg} # Override the features according to the shield given. For a general case, # this will need to come from a variable or argument.