mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 10:30:02 +02:00
adding LTO to tests
This commit is contained in:
parent
77e610f5a5
commit
b0a5a76065
@ -70,7 +70,11 @@ find_package(ClangFormat)
|
||||
#Enable LTO if available
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
||||
message(STATUS "SLS_LTO_AVAILABLE:" ${SLS_LTO_AVAILABLE})
|
||||
if (SLS_LTO_AVAILABLE)
|
||||
message(STATUS "Building with link time optimization")
|
||||
else()
|
||||
message(STATUS "Link time optimization is not available")
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
@ -7,9 +7,9 @@ function(enable_cxx_warning flag target)
|
||||
check_cxx_compiler_flag(${flag} ${flag_name})
|
||||
if(${flag_name})
|
||||
target_compile_options(${target} INTERFACE ${flag})
|
||||
message("Adding: ${flag} to ${target}")
|
||||
message(STATUS "Adding: ${flag} to ${target}")
|
||||
else()
|
||||
message("Flag: ${flag} not supported")
|
||||
message(STATUS "Flag: ${flag} not supported")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -18,9 +18,9 @@ function(enable_c_warning flag target)
|
||||
check_c_compiler_flag(${flag} ${flag_name})
|
||||
if(${flag_name})
|
||||
target_compile_options(${target} INTERFACE ${flag})
|
||||
message("Adding: ${flag} to ${target}")
|
||||
message(STATUS "Adding: ${flag} to ${target}")
|
||||
else()
|
||||
message("Flag: ${flag} not supported")
|
||||
message(STATUS "Flag: ${flag} not supported")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -31,10 +31,10 @@ function(disable_cxx_warning flag target)
|
||||
|
||||
if(${flag_name})
|
||||
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
||||
message("Adding: ${neg_flag} to ${target}")
|
||||
message(STATUS "Adding: ${neg_flag} to ${target}")
|
||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||
else()
|
||||
message("Warning: ${flag} not supported no need to disable")
|
||||
message(STATUS "Warning: ${flag} not supported no need to disable")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -43,10 +43,10 @@ function(disable_c_warning flag target)
|
||||
check_c_compiler_flag(${flag} ${flag_name})
|
||||
if(${flag_name})
|
||||
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
||||
message("Adding: ${neg_flag} to ${target}")
|
||||
message(STATUS "Adding: ${neg_flag} to ${target}")
|
||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||
else()
|
||||
message("Warning: ${flag} not supported no need to disable")
|
||||
message(STATUS "Warning: ${flag} not supported no need to disable")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -39,7 +39,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
set_target_properties(${exe} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
if(SLS_LTO_AVAILABLE)
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
||||
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
|
@ -110,7 +110,7 @@ target_link_libraries(slsDetectorGui PUBLIC
|
||||
set_target_properties(slsDetectorGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
if(SLS_LTO_AVAILABLE)
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
||||
set_property(TARGET slsDetectorGui PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
|
@ -104,7 +104,7 @@ if (SLS_USE_RECEIVER_BINARIES)
|
||||
set_target_properties(slsReceiver PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
if(SLS_LTO_AVAILABLE)
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
||||
set_property(TARGET slsReceiver PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
@ -124,7 +124,7 @@ if (SLS_USE_RECEIVER_BINARIES)
|
||||
set_target_properties(slsMultiReceiver PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
if(SLS_LTO_AVAILABLE)
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
||||
set_property(TARGET slsMultiReceiver PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
|
@ -43,6 +43,10 @@ if (SLS_USE_RECEIVER)
|
||||
endif (SLS_USE_RECEIVER)
|
||||
|
||||
|
||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
||||
set_property(TARGET tests PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
set_target_properties(tests PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user