From e797a3357647f740442f226a0fe0d7dbacb9d4de Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 10 Jan 2017 22:44:22 +0000 Subject: [PATCH] fixed the profile building functionality; the cflags aren't 100% the same as release but at least one of those is breaking JNI when we profile, so this will do pig... --- CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8be7fea5..1fe5e207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,19 +84,26 @@ elseif (UNIX) # release specific cflags - optimizations beyond the default for both types is mostly just -O flags set(CMAKE_CXX_FLAGS_RELEASE "-DDEBUG_LEVEL=0 -DPRODUCTION=1") + # we use fewer, if any, crazy optimizations for profile generation, and likewise release flags for the minsizerel + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}") + # Ofast doesn't work with gcc builds if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast \ - -fno-signed-zeros -freciprocal-math -ffp-contract=fast \ - -fno-threadsafe-statics -fslp-vectorize-aggressive -fslp-vectorize \ - -fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \ - -fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \ - -finline-hint-functions -fno-unroll-loops") + -fno-signed-zeros -freciprocal-math -ffp-contract=fast \ + -fno-threadsafe-statics -fslp-vectorize-aggressive -fslp-vectorize \ + -fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \ + -fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \ + -finline-hint-functions -fno-unroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb") # RELWITHDEBINFO is used for building bins that produce profdata files - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-instr-generate") + # we only need the basics of our heavy optimizations here, i think - that and one of these flags + # breaks JNI when we profile + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-functions \ + -finline-hint-functions -fprofile-instr-generate") # MINSIZEREL is used for profiled, flto builds set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto -fwhole-program-vtables")