From db0a2bcc4a14759c992ca89661f687b87d93e923 Mon Sep 17 00:00:00 2001 From: "Ralph J. Steinhagen" <46007894+RalphSteinhagen@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:41:51 +0100 Subject: [PATCH] updated build system (#484) * updated build system * set relative path for exprtk * set optimisation flags to max '-O2' to alleviate CI build times * set absolute hash for pmt dependency N.B. performance difference between `-O2` vs. '-03' proved to be insignificant. Signed-off-by: rstein --- CMakeLists.txt | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ad8425a..731eebe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,9 +75,14 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(Clang|GNU|Intel)") # Add a build type that keeps runtime checks enabled set(CMAKE_CXX_FLAGS_RELWITHASSERT - "-O3" + "-O2" CACHE INTERNAL "Flags used by the compiler during release builds containing runtime checks.") + # Add a build type that keeps runtime checks enabled + set(CMAKE_CXX_FLAGS_RELEASE + "-O2" + CACHE INTERNAL "Flags used by the compiler during release builds.") + # The default value is often an empty string, but this is usually not desirable and one of the other standard build # types is usually more appropriate. if(NOT CMAKE_BUILD_TYPE) @@ -223,22 +228,18 @@ endif() # include header-only libraries that have been inlined to simplify builds w/o requiring access to the internet if(NOT (TARGET magic_enum)) add_library(magic_enum INTERFACE) - target_include_directories(magic_enum ${CMAKE_EXT_DEP_WARNING_GUARD} INTERFACE ${PROJECT_SOURCE_DIR}/third_party/magic_enum/) + target_include_directories(magic_enum ${CMAKE_EXT_DEP_WARNING_GUARD} + INTERFACE ${PROJECT_SOURCE_DIR}/third_party/magic_enum/) endif() # include exprtk header-only libraries available as a statically linked library to simplify/speed-up builds -include_directories("${CMAKE_SOURCE_DIR}/third_party") -include_directories("${CMAKE_SOURCE_DIR}/third_party/exprtk") -add_library(exprtk STATIC - "${CMAKE_SOURCE_DIR}/third_party/exprtk.cpp" # dummy source file - "${CMAKE_SOURCE_DIR}/third_party/exprtk.hpp" +add_library( + exprtk STATIC "${CMAKE_CURRENT_SOURCE_DIR}/third_party/exprtk.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/third_party/exprtk.cpp" # dummy source file ) -target_sources(exprtk PRIVATE "${CMAKE_SOURCE_DIR}/third_party/exprtk.hpp") -target_include_directories(exprtk PUBLIC - "${CMAKE_SOURCE_DIR}/third_party" - "${CMAKE_SOURCE_DIR}/third_party/exprtk" -) -target_compile_options(exprtk PRIVATE -O3) +target_include_directories(exprtk PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/third_party" + "${CMAKE_CURRENT_SOURCE_DIR}/third_party/exprtk") +target_compile_options(exprtk PRIVATE -O1) # include exprtk header-only - END include(FetchContent) @@ -250,7 +251,8 @@ FetchContent_Declare( FetchContent_Declare( pmt GIT_REPOSITORY https://github.com/gnuradio/pmt.git - GIT_TAG main) + GIT_TAG e1a46cb61decb044f6ab0a58a77211beb3630340 # latest as of 2023-12-06 +) FetchContent_Declare( ut