Mercurial > hg > orthanc
changeset 2175:bed8e7ad8bab
ENABLE_PROFILING cmake option
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Nov 2016 12:58:43 +0100 |
parents | 8453d3a26421 |
children | fead5549aaa7 |
files | CMakeLists.txt Resources/CMake/Compiler.cmake |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Nov 23 16:12:04 2016 +0100 +++ b/CMakeLists.txt Thu Nov 24 12:58:43 2016 +0100 @@ -33,6 +33,7 @@ SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists") SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc") SET(ENABLE_PKCS11 OFF CACHE BOOL "Enable PKCS#11 for HTTPS client authentication using hardware security modules and smart cards") +SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof") # Advanced parameters to fine-tune linking against system libraries SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
--- a/Resources/CMake/Compiler.cmake Wed Nov 23 16:12:04 2016 +0100 +++ b/Resources/CMake/Compiler.cmake Thu Nov 24 12:58:43 2016 +0100 @@ -164,6 +164,23 @@ endif() +if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING) + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message(WARNING "Enabling profiling on a non-debug build will not produce full information") + endif() + + if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") + else() + message(FATAL_ERROR "Don't know how to enable profiling on your configuration") + endif() +endif() + + if (STATIC_BUILD) add_definitions(-DORTHANC_STATIC=1) else()