all repos — mgba @ 888d037b3d6103c2b13e17ee87659f75317385c2

mGBA Game Boy Advance Emulator

PGO options for GCC
Jeffrey Pfau jeffrey@endrift.com
Fri, 25 Jul 2014 00:01:49 -0700
commit

888d037b3d6103c2b13e17ee87659f75317385c2

parent

5189d9afd4fe629b0ee52bc56f45834b549922b9

1 files changed, 15 insertions(+), 0 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -20,6 +20,21 @@ include_directories(${CMAKE_SOURCE_DIR}/src/arm)

include_directories(${CMAKE_SOURCE_DIR}/src/gba) include_directories(${CMAKE_SOURCE_DIR}/src) +set(PGO_DIR "/tmp/gba-pgo/" CACHE PATH "Profiling-guided optimization profiles path") +mark_as_advanced(PGO_DIR) +set(PGO_PRE_FLAGS "-pg -fprofile-generate=${PGO_DIR}") +set(PGO_POST_FLAGS "-fprofile-use=${PGO_DIR}") + +if(PGO_STAGE EQUAL 1) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${PGO_PRE_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PGO_PRE_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_PRE_FLAGS}") +elseif(PGO_STAGE EQUAL 2) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${PGO_POST_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PGO_POST_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_POST_FLAGS}") +endif() + add_definitions(-DBINARY_NAME="${BINARY_NAME}" -DPROJECT_NAME="${PROJECT_NAME}") include(FindPkgConfig)