Fix OProfile discovery and drop bfd dependency

Adds a cmake module to correctly discover OProfile and adjusts the
corresponding CMakeLists to make use of it. Additionally removes
linking against the bfd library when compiling with OProfile because
Dolphin does not use it.
This commit is contained in:
Christian Widmer 2015-10-06 17:28:29 +02:00
parent c4fe2cd287
commit b99d1a0a20
3 changed files with 25 additions and 6 deletions

View File

@ -512,13 +512,13 @@ if(NOT ANDROID)
endif(PORTAUDIO)
if(OPROFILING)
check_lib(OPROFILE "(no .pc for opagent)" opagent opagent.h)
check_lib(BFD "(no .pc for bfd)" bfd bfd.h)
if(OPROFILE_FOUND AND BFD_FOUND)
message("oprofile found, enabling profiling support")
include(FindOProfile)
if(OPROFILE_FOUND)
message("OProfile found, enabling profiling support")
add_definitions(-DUSE_OPROFILE=1)
include_directories(${OPROFILE_INCLUDE_DIRS})
else()
message(FATAL_ERROR "oprofile or bfd not found. Can't build profiling support.")
message(FATAL_ERROR "OProfile not found. Can't build profiling support.")
endif()
endif()
endif()

View File

@ -0,0 +1,19 @@
# - Try to find OProfile
# Once done this will define
# OPROFILE_FOUND - System has OProfile
# OPROFILE_INCLUDE_DIRS - The OProfile include directories
# OPROFILE_LIBRARIES - The libraries needed to use OProfile
find_path(OPROFILE_INCLUDE_DIR opagent.h)
find_library(OPROFILE_LIBRARY opagent
PATH_SUFFIXES oprofile)
set(OPROFILE_INCLUDE_DIRS ${OPROFILE_INCLUDE_DIR})
set(OPROFILE_LIBRARIES ${OPROFILE_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OProfile DEFAULT_MSG
OPROFILE_LIBRARY OPROFILE_INCLUDE_DIR)
mark_as_advanced(OPROFILE_INCLUDE_DIR OPROFILE_LIBRARY)

View File

@ -265,7 +265,7 @@ if(PORTAUDIO_FOUND)
endif(PORTAUDIO_FOUND)
if(OPROFILE_FOUND)
set(LIBS ${LIBS} opagent bfd)
set(LIBS ${LIBS} ${OPROFILE_LIBRARIES})
endif(OPROFILE_FOUND)
if(GDBSTUB)