diff --git a/CMakeLists.txt b/CMakeLists.txt index f8ff113a9d..78144eb4ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,6 +204,17 @@ else() set(PORTAUDIO_FOUND FALSE) endif(PORTAUDIO) +option(OPROFILING "Enable profiling" OFF) +if(OPROFILING) + check_lib(OPROFILE opagent opagent.h) + check_lib(BFD bfd bfd.h) + if(OPROFILE_FOUND AND BFD_FOUND) + message("oprofile found, enabling profiling support") + add_definitions(-DUSE_OPROFILE=1) + else() + message(FATAL_ERROR "oprofile or bfd not found. Can't build profiling support.") + endif() +endif() ######################################## # Setup include directories (and make sure they are preferred over the Externals) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 6fe518cb83..0909c669b8 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -153,6 +153,10 @@ if(PORTAUDIO_FOUND) set(LIBS ${LIBS} portaudio) endif(PORTAUDIO_FOUND) +if(OPROFILE_FOUND) + set(LIBS ${LIBS} opagent bfd) +endif(OPROFILE_FOUND) + add_library(core STATIC ${SRCS}) target_link_libraries(core ${LIBS})