From 436d20d66059fec86a0673ae16db74b3b7e400a7 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 26 Nov 2021 14:41:26 -0800 Subject: [PATCH] CMake: Adds option to enable time-trace compile option Useful for running something like aras-p/ClangBuildAnalyzer on the source and finding compile bottlenecks --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc1f73525..d6cc2ffae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ option(ENABLE_WERROR "Enables -Werror" FALSE) option(ENABLE_STATIC_PIE "Enables static-pie build" FALSE) option(ENABLE_JEMALLOC "Enables jemalloc allocator" TRUE) option(ENABLE_OFFLINE_TELEMETRY "Enables FEX offline telemetry" TRUE) +option(ENABLE_COMPILE_TIME_TRACE "Enables time trace compile option" FALSE) set (X86_C_COMPILER "x86_64-linux-gnu-gcc" CACHE STRING "c compiler for compiling x86 guest libs") set (X86_CXX_COMPILER "x86_64-linux-gnu-g++" CACHE STRING "c++ compiler for compiling x86 guest libs") @@ -77,6 +78,11 @@ if (ENABLE_XRAY) link_libraries(-fxray-instrument) endif() +if (ENABLE_COMPILE_TIME_TRACE) + add_compile_options(-ftime-trace) + link_libraries(-ftime-trace) +endif() + set (PTHREAD_LIB pthread) if (ENABLE_LLD) set (LD_OVERRIDE "-fuse-ld=lld")