Add build option to enable gprof-based profiling instrumentation.

This commit is contained in:
Adam Reichold
2016-02-21 15:44:41 +01:00
parent afec724b72
commit ca1c1a03d7

View File

@@ -99,6 +99,7 @@ option (WITH_BZIP "Build with Bzip2 support" ON)
option (WITH_MYFILE_MMAP "Build using memory mapped file" ON)
option (WITH_LTO "Build with link-time optimizations" OFF)
option (WITH_SAN "Build with run-time sanitizer" OFF)
option (WITH_PROF "Build with profiling instrumentation" OFF)
option (OPTION_OMP "Build with OpenMP support" ON)
option (STRICT_MUTEX "True (recommended): MyMutex will behave like POSIX Mutex; False: MyMutex will behave like POSIX RecMutex; Note: forced to ON for Debug builds" ON)
option (TRACE_MYRWMUTEX "Trace RT's custom R/W Mutex (Debug builds only); redirecting std::out to a file is strongly recommended!" OFF)
@@ -281,6 +282,12 @@ if (WITH_SAN)
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${WITH_SAN}")
endif (WITH_SAN)
if (WITH_PROF)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
endif (WITH_PROF)
if (OPTION_OMP)
find_package(OpenMP)
if (OPENMP_FOUND)