-
Notifications
You must be signed in to change notification settings - Fork 12
maintenance/enable build profiling #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0bc4cb
826d5af
8a09630
dff7b8a
ac59b96
df6cf3e
356a737
1f413c1
3598df2
12984fb
fb2153b
bcffb4a
5fc99e6
a37cb2e
4d4accd
9821b54
cb78d90
6512cc7
d3a57d9
ad2c0ab
421f4ca
9ec4e66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,21 @@ FetchContent_Declare( | |||||||||||||||
| FIND_PACKAGE_ARGS | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| # ############################################################################## | ||||||||||||||||
| # Initial compilation flags for build types we care about | ||||||||||||||||
| if(NOT CMAKE_CXX_FLAGS_DEBUG) | ||||||||||||||||
| set(CMAKE_CXX_FLAGS_DEBUG "-Og -g" CACHE STRING "" FORCE) | ||||||||||||||||
| endif() | ||||||||||||||||
|
|
||||||||||||||||
| if(NOT CMAKE_CXX_FLAGS_RELEASE) | ||||||||||||||||
| set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g0 -DNDEBUG" CACHE STRING "" FORCE) | ||||||||||||||||
| endif() | ||||||||||||||||
|
|
||||||||||||||||
| if(NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||||||||||||||||
| set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -fno-omit-frame-pointer -g -DNDEBUG" CACHE STRING "" FORCE) | ||||||||||||||||
| endif() | ||||||||||||||||
| # ############################################################################## | ||||||||||||||||
|
|
||||||||||||||||
| # Make cetmodules available | ||||||||||||||||
| FetchContent_MakeAvailable(cetmodules) | ||||||||||||||||
| find_package(cetmodules 4.01.01 REQUIRED) | ||||||||||||||||
|
|
@@ -58,11 +73,34 @@ set(CTEST_TEST_TIMEOUT 90 CACHE STRING "Per-test timeout (s) for CTest") | |||||||||||||||
| FetchContent_MakeAvailable(Catch2 GSL mimicpp) | ||||||||||||||||
|
|
||||||||||||||||
| include(Modules/private/CreateCoverageTargets.cmake) | ||||||||||||||||
| include(Modules/private/PhlexSymbolVisibility.cmake) | ||||||||||||||||
| include(Modules/private/PhlexOptimization.cmake) | ||||||||||||||||
|
|
||||||||||||||||
| option(ENABLE_TSAN "Enable Thread Sanitizer" OFF) | ||||||||||||||||
| option(ENABLE_ASAN "Enable Address Sanitizer" OFF) | ||||||||||||||||
| option(PHLEX_USE_FORM "Enable experimental integration with FORM" OFF) | ||||||||||||||||
| option(ENABLE_COVERAGE "Enable code coverage instrumentation" OFF) | ||||||||||||||||
| option(ENABLE_BUILD_PROFILING "Enable monitoring of compile and link operations" OFF) | ||||||||||||||||
|
|
||||||||||||||||
| # ############################################################################## | ||||||||||||||||
| # Enable collection of compile/link statistics. | ||||||||||||||||
| # | ||||||||||||||||
| # If lld is available but not default for the current toolset, then use | ||||||||||||||||
| # `-DCMAKE_LINKER_TYPE=LLD` | ||||||||||||||||
| if (ENABLE_BUILD_PROFILING) | ||||||||||||||||
| set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time") | ||||||||||||||||
| set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CMAKE_COMMAND} -E time") | ||||||||||||||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") | ||||||||||||||||
| add_compile_options("-ftime-trace") | ||||||||||||||||
| endif() | ||||||||||||||||
| if(CMAKE_CXX_COMPILER_LINKER_ID STREQUAL "LLD") | ||||||||||||||||
| message(STATUS "LLD detected (Phlex build) - Enabling tracing") | ||||||||||||||||
| add_link_options("-Wl,--time-trace") | ||||||||||||||||
| add_link_options("-Wl,--Map=phlex_link.map") | ||||||||||||||||
|
Comment on lines
+96
to
+99
|
||||||||||||||||
| if(CMAKE_CXX_COMPILER_LINKER_ID STREQUAL "LLD") | |
| message(STATUS "LLD detected (Phlex build) - Enabling tracing") | |
| add_link_options("-Wl,--time-trace") | |
| add_link_options("-Wl,--Map=phlex_link.map") | |
| if(CMAKE_CXX_COMPILER_LINKER_ID STREQUAL "LLD" AND NOT APPLE) | |
| message(STATUS "LLD detected (Phlex build) - Enabling tracing") | |
| add_link_options("-Wl,--time-trace") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhlexOptimization.cmakederives default values forPHLEX_ENABLE_IPO/PHLEX_HIDE_SYMBOLSfromCMAKE_BUILD_TYPE, butCMAKE_BUILD_TYPEis only defaulted later in this file (toRelWithDebInfo). As a result, when users don’t set a build type explicitly, these options will default as if the build type were empty (OFF) even though the project later forcesRelWithDebInfo. Consider setting the defaultCMAKE_BUILD_TYPEbefore includingPhlexOptimization.cmake, or reworking the option-default logic so it reflects the eventual default build type.