cmake: add an option to control PGO

This commit is contained in:
Gregory Hainaut 2015-11-14 09:47:29 +01:00
parent 07ec92175f
commit 837b62d5e8
2 changed files with 22 additions and 8 deletions

View File

@ -276,6 +276,13 @@ if(NOT DEFINED OPTIMIZATION_FLAG)
endif()
endif()
if (NOT DEFINED PGO)
set(PGO "none")
set(GCOV_LIBRARIES "")
else()
set(GCOV_LIBRARIES "-lgcov")
endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG}")
# c++ only flags

View File

@ -27,6 +27,12 @@ if(NOT USE_CLANG)
set(pcsx2FinalFlags ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
endif()
if ("${PGO}" STREQUAL "generate")
set(pcsx2FinalFlags ${pcsx2FinalFlags} -fprofile-generate)
elseif("${PGO}" STREQUAL "use")
set(pcsx2FinalFlags ${pcsx2FinalFlags} -fprofile-use)
endif()
# Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG)
@ -634,6 +640,7 @@ set(pcsx2FinalLibs
${GTK2_LIBRARIES}
${ZLIB_LIBRARIES}
${AIO_LIBRARIES}
${GCOV_LIBRARIES}
)
# additonal include directories