From bd3164bacdb143e423b893a0cba65b0d00529cb5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 May 2022 02:03:17 +0200 Subject: [PATCH] enable lto --- CMakeLists.txt | 20 ++++++++++++++------ example_common | 2 +- fsfw | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa83b8c..73a7cfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,17 +13,23 @@ cmake_minimum_required(VERSION 3.13) # set(CMAKE_VERBOSE TRUE) +# Project Name +project(fsfw-example-hosted C CXX) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") if(NOT FSFW_OSAL) set(FSFW_OSAL host CACHE STRING "OS for the FSFW.") endif() -# Project Name -project(fsfw-example-hosted C CXX) +option(OBSW_ADD_FMT_TESTS "Add {fmt} library tests" OFF) +option(OBSW_ENABLE_IPO "Enable IPO/LTO optimization" ON) -find_package(fmt 8 CONFIG) -option(FSFW_ADD_FMT_TESTS "Add {fmt} library tests" ON) +include(CheckIPOSupported) +check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR) +if(NOT IPO_SUPPORTED) + message(STATUS "IPO/LTO not supported: ${IPO_ERROR}") +endif() ################################################################################ # Pre-Sources preparation @@ -106,12 +112,14 @@ add_subdirectory(${COMMON_PATH}) # Post-Sources preparation ################################################################################ +if(OBSW_ENABLE_IPO AND IPO_SUPPORTED) + set_property(TARGET ${TARGET_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +endif() + # Add libraries for all sources. target_link_libraries(${TARGET_NAME} PRIVATE ${LIB_FSFW_NAME} ${LIB_OS_NAME} - fmt::fmt - # ${LIB_FSFW_HAL_NAME} ) # Add include paths for all sources. diff --git a/example_common b/example_common index bdc27d7..503c630 160000 --- a/example_common +++ b/example_common @@ -1 +1 @@ -Subproject commit bdc27d72f40155ba1946b6ad71c97069c88ac1b7 +Subproject commit 503c6301c63848b38a9f9254e856614b473a27f0 diff --git a/fsfw b/fsfw index e8a5f1e..fb1d775 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e8a5f1e095f64743e388729de0c9f53ca2e1565c +Subproject commit fb1d775b524760bb3c299b47168604bad504f1f2