mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-22 12:10:05 +00:00
build: Enable link time optimization in release builds. (#6887)
This commit is contained in:
parent
edf157200d
commit
f2e0748a22
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -158,6 +158,11 @@ jobs:
|
|||||||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}
|
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-${{ matrix.target }}-
|
${{ runner.os }}-${{ matrix.target }}-
|
||||||
|
- name: Increase Pagefile size
|
||||||
|
uses: al-cheb/configure-pagefile-action@v1.2
|
||||||
|
with:
|
||||||
|
minimum-size: 2GB
|
||||||
|
maximum-size: 6GB
|
||||||
- name: Set up MSVC
|
- name: Set up MSVC
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
if: ${{ matrix.target == 'msvc' }}
|
if: ${{ matrix.target == 'msvc' }}
|
||||||
|
@ -40,8 +40,10 @@ endif()
|
|||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
set(IS_DEBUG_BUILD ON)
|
set(IS_DEBUG_BUILD ON)
|
||||||
|
set(IS_RELEASE_BUILD OFF)
|
||||||
else()
|
else()
|
||||||
set(IS_DEBUG_BUILD OFF)
|
set(IS_DEBUG_BUILD OFF)
|
||||||
|
set(IS_RELEASE_BUILD ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_SDL2 "Enable using SDL2" ON)
|
option(ENABLE_SDL2 "Enable using SDL2" ON)
|
||||||
@ -73,7 +75,7 @@ CMAKE_DEPENDENT_OPTION(CITRA_ENABLE_BUNDLE_TARGET "Enable the distribution bundl
|
|||||||
|
|
||||||
# Compile options
|
# Compile options
|
||||||
CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF)
|
CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF)
|
||||||
option(ENABLE_LTO "Enable link time optimization" OFF)
|
option(ENABLE_LTO "Enable link time optimization" ${IS_RELEASE_BUILD})
|
||||||
option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
||||||
option(CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON)
|
option(CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON)
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ include_directories(.)
|
|||||||
set_property(DIRECTORY APPEND PROPERTY
|
set_property(DIRECTORY APPEND PROPERTY
|
||||||
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
|
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
|
||||||
|
|
||||||
|
if (ENABLE_LTO)
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set compilation flags
|
# Set compilation flags
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
|
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
|
||||||
|
@ -49,7 +49,6 @@ create_target_directory_groups(audio_core)
|
|||||||
|
|
||||||
target_link_libraries(audio_core PUBLIC citra_common citra_core)
|
target_link_libraries(audio_core PUBLIC citra_common citra_core)
|
||||||
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
target_link_libraries(audio_core PRIVATE SoundTouch teakra)
|
||||||
set_target_properties(audio_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
add_definitions(-DSOUNDTOUCH_INTEGER_SAMPLES)
|
add_definitions(-DSOUNDTOUCH_INTEGER_SAMPLES)
|
||||||
|
|
||||||
if(ENABLE_MF)
|
if(ENABLE_MF)
|
||||||
|
@ -167,7 +167,6 @@ create_target_directory_groups(citra_common)
|
|||||||
|
|
||||||
target_link_libraries(citra_common PUBLIC fmt::fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams)
|
target_link_libraries(citra_common PUBLIC fmt::fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams)
|
||||||
target_link_libraries(citra_common PRIVATE libzstd_static)
|
target_link_libraries(citra_common PRIVATE libzstd_static)
|
||||||
set_target_properties(citra_common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
target_link_libraries(citra_common PRIVATE xbyak)
|
target_link_libraries(citra_common PRIVATE xbyak)
|
||||||
|
@ -480,7 +480,6 @@ create_target_directory_groups(citra_core)
|
|||||||
target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core)
|
target_link_libraries(citra_core PUBLIC citra_common PRIVATE audio_core network video_core)
|
||||||
target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost::iostreams httplib)
|
target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost::iostreams httplib)
|
||||||
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt::fmt lodepng open_source_archives)
|
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt::fmt lodepng open_source_archives)
|
||||||
set_target_properties(citra_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
|
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(citra_core PRIVATE web_service)
|
target_link_libraries(citra_core PRIVATE web_service)
|
||||||
|
@ -43,7 +43,6 @@ endif()
|
|||||||
|
|
||||||
create_target_directory_groups(input_common)
|
create_target_directory_groups(input_common)
|
||||||
target_link_libraries(input_common PUBLIC citra_core PRIVATE citra_common ${Boost_LIBRARIES})
|
target_link_libraries(input_common PUBLIC citra_core PRIVATE citra_common ${Boost_LIBRARIES})
|
||||||
set_target_properties(input_common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
|
|
||||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||||
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
||||||
|
@ -23,7 +23,6 @@ if (ENABLE_WEB_SERVICE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(network PRIVATE citra_common enet Boost::serialization httplib)
|
target_link_libraries(network PRIVATE citra_common enet Boost::serialization httplib)
|
||||||
set_target_properties(network PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
|
|
||||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||||
target_precompile_headers(network PRIVATE precompiled_headers.h)
|
target_precompile_headers(network PRIVATE precompiled_headers.h)
|
||||||
|
@ -143,7 +143,6 @@ create_target_directory_groups(video_core)
|
|||||||
target_link_libraries(video_core PUBLIC citra_common citra_core)
|
target_link_libraries(video_core PUBLIC citra_common citra_core)
|
||||||
target_link_libraries(video_core PRIVATE Boost::serialization dds-ktx json-headers nihstro-headers tsl::robin_map)
|
target_link_libraries(video_core PRIVATE Boost::serialization dds-ktx json-headers nihstro-headers tsl::robin_map)
|
||||||
target_link_libraries(video_core PRIVATE vulkan-headers vma glad sirit SPIRV glslang)
|
target_link_libraries(video_core PRIVATE vulkan-headers vma glad sirit SPIRV glslang)
|
||||||
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
target_link_libraries(video_core PUBLIC xbyak)
|
target_link_libraries(video_core PUBLIC xbyak)
|
||||||
|
@ -17,7 +17,6 @@ create_target_directory_groups(web_service)
|
|||||||
target_compile_definitions(web_service PUBLIC -DENABLE_WEB_SERVICE)
|
target_compile_definitions(web_service PUBLIC -DENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(web_service PRIVATE citra_common network json-headers httplib cpp-jwt)
|
target_link_libraries(web_service PRIVATE citra_common network json-headers httplib cpp-jwt)
|
||||||
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
||||||
set_target_properties(web_service PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
target_link_libraries(web_service PRIVATE ifaddrs)
|
target_link_libraries(web_service PRIVATE ifaddrs)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
|
Loading…
Reference in New Issue
Block a user