File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,26 @@ option(ENABLE_TSAN "Enable Thread Sanitizer" OFF)
9696option (ENABLE_ASAN "Enable Address Sanitizer" OFF )
9797option (PHLEX_USE_FORM "Enable experimental integration with FORM" OFF )
9898option (ENABLE_COVERAGE "Enable code coverage instrumentation" OFF )
99+ option (ENABLE_BUILD_PROFILING "Enable monitoring of compile and link operations" OFF )
100+
101+ # ##############################################################################
102+ # Enable collection of compile/link statistics.
103+ #
104+ # If lld is available but not default for the current toolset, then use
105+ # `-DCMAKE_LINKER_TYPE=LLD`
106+ if (ENABLE_BUILD_PROFILING)
107+ set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time" )
108+ set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK "${CMAKE_COMMAND} -E time" )
109+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" )
110+ add_compile_options ("-ftime-trace" )
111+ endif ()
112+ if (CMAKE_CXX_COMPILER_LINKER_ID STREQUAL "LLD" )
113+ message (STATUS "LLD detected (Phlex build) - Enabling tracing" )
114+ add_link_options ("-Wl,--time-trace" )
115+ add_link_options ("-Wl,--print-archive-stats=-" )
116+ endif ()
117+ endif ()
118+ # ##############################################################################
99119
100120add_compile_options (
101121 -Wall
You can’t perform that action at this time.
0 commit comments