Build libraries with -Ofast for debug builds

To offset some of the performance overhead of using debug builds, we now optimize all libraries using `-Ofast` while building Skyline itself with `-O0`.
This commit is contained in:
PixelyIon 2021-10-31 03:16:21 +05:30
parent 4b80e1f91c
commit 96027f0f09

View File

@ -12,6 +12,9 @@ set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -Wno-unused-command-line-argument")
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -fno-stack-protector -DNDEBUG")
# Build all libraries with -Ofast but with default debug data (-g) for debug builds
set(CMAKE_CXX_FLAGS_DEBUG "-Ofast")
# libcxx
set(ANDROID_STL "none")
set(LIBCXX_INCLUDE_TESTS OFF)
@ -95,6 +98,9 @@ set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
add_subdirectory("libraries/boost")
# Build Skyline with full debugging data and -Og for debug builds
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -glldb -gdwarf-5")
# Skyline
add_library(skyline SHARED
${source_DIR}/emu_jni.cpp