cmake: improve vtune integration

Year is included in the path so search in order 2018/2017/2016

Not ideal but at least all logic is inside the FindVtune module
This commit is contained in:
Gregory Hainaut 2016-12-04 18:46:02 +01:00
parent 07d7905896
commit 0453e5cad8
6 changed files with 43 additions and 19 deletions

View File

@ -303,6 +303,9 @@ set(COMMON_FLAG "-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-bui
if (DISABLE_SVU)
set(COMMON_FLAG "${COMMON_FLAG} -DDISABLE_SVU")
endif()
if(USE_VTUNE)
set(COMMON_FLAG "${COMMON_FLAG} -DENABLE_VTUNE")
endif()
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
# -Wno-attributes: "always_inline function might not be inlinable" <= real spam (thousand of warnings!!!)
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.

33
cmake/FindVtune.cmake Normal file
View File

@ -0,0 +1,33 @@
# Find Intel's VTUNE tool
# VTUNE_FOUND found Vtune
# VTUNE_INCLUDE_DIRS include path to jitprofiling.h
# VTUNE_LIBRARIES path to vtune libs
find_path(VTUNE_INCLUDE_DIRS NAMES jitprofiling.h PATHS
/opt/intel/vtune_amplifier_xe_2018/include
/opt/intel/vtune_amplifier_xe_2017/include
/opt/intel/vtune_amplifier_xe_2016/include
)
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS
/opt/intel/vtune_amplifier_xe_2018/lib32
/opt/intel/vtune_amplifier_xe_2017/lib32
/opt/intel/vtune_amplifier_xe_2016/lib32
)
else()
find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS
/opt/intel/vtune_amplifier_xe_2018/lib64
/opt/intel/vtune_amplifier_xe_2017/lib64
/opt/intel/vtune_amplifier_xe_2016/lib64
)
endif()
# handle the QUIETLY and REQUIRED arguments and set VTUNE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vtune DEFAULT_MSG VTUNE_LIBRARIES VTUNE_INCLUDE_DIRS)
mark_as_advanced(VTUNE_FOUND VTUNE_INCLUDE_DIRS VTUNE_LIBRARIES)

View File

@ -12,6 +12,7 @@ endif()
find_package(LibLZMA)
find_package(OpenGL)
find_package(PNG)
find_package(Vtune)
# The requirement of wxWidgets is checked in SelectPcsx2Plugins module
# Does not require the module (allow to compile non-wx plugins)
# Force the unicode build (the variable is only supported on cmake 2.8.3 and above)
@ -156,6 +157,10 @@ if(SDL_FOUND AND NOT SDL2_API)
include_directories(${SDL_INCLUDE_DIR})
endif()
if(USE_VTUNE AND VTUNE_FOUND)
include_directories(${VTUNE_INCLUDE_DIRS})
endif()
if(wxWidgets_FOUND)
include(${wxWidgets_USE_FILE})
endif()

View File

@ -107,10 +107,5 @@ set(UtilitiesFinalLibs
${wxWidgets_LIBRARIES}
)
if(USE_VTUNE)
set(UtilitiesFinalFlags ${UtilitiesFinalFlags} -DENABLE_VTUNE)
include_directories("$ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/include")
endif()
add_pcsx2_lib(${Output} "${UtilitiesFinalSources}" "${UtilitiesFinalLibs}" "${UtilitiesFinalFlags}")
add_pcsx2_lib(${Output}_NO_TLS "${UtilitiesFinalSources}" "${UtilitiesFinalLibs}" "${UtilitiesFinalFlags} -DPCSX2_THREAD_LOCAL=0")

View File

@ -682,13 +682,7 @@ foreach(res_file IN ITEMS
endforeach()
if(USE_VTUNE)
set(pcsx2FinalFlags ${pcsx2FinalFlags} -DENABLE_VTUNE)
include_directories("$ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/include")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
set(pcsx2FinalLibs ${pcsx2FinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib32/libjitprofiling.a)
else()
set(pcsx2FinalLibs ${pcsx2FinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib64/libjitprofiling.a)
endif()
set(pcsx2FinalLibs ${pcsx2FinalLibs} ${VTUNE_LIBRARIES})
endif()
# Suppress all the system-specific predefined macros outside the reserved namespace.

View File

@ -204,13 +204,7 @@ if(LIBLZMA_FOUND)
endif()
if(USE_VTUNE)
set(GSdxFinalFlags ${GSdxFinalFlags} -DENABLE_VTUNE)
include_directories("$ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/include")
if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
set(GSdxFinalLibs ${GSdxFinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib32/libjitprofiling.a)
else()
set(GSdxFinalLibs ${GSdxFinalLibs} $ENV{VTUNE_AMPLIFIER_XE_2016_DIR}/lib64/libjitprofiling.a)
endif()
set(GSdxFinalLibs ${GSdxFinalLibs} ${VTUNE_LIBRARIES})
endif()
# Generate Glsl header file. Protect with REBUILD_SHADER to avoid build-dependency on PERL