mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-27 18:21:54 +01: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 }}
|
||||
restore-keys: |
|
||||
${{ 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
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
if: ${{ matrix.target == 'msvc' }}
|
||||
|
@ -40,8 +40,10 @@ endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(IS_DEBUG_BUILD ON)
|
||||
set(IS_RELEASE_BUILD OFF)
|
||||
else()
|
||||
set(IS_DEBUG_BUILD OFF)
|
||||
set(IS_RELEASE_BUILD ON)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SDL2 "Enable using SDL2" ON)
|
||||
@ -73,7 +75,7 @@ CMAKE_DEPENDENT_OPTION(CITRA_ENABLE_BUNDLE_TARGET "Enable the distribution bundl
|
||||
|
||||
# Compile options
|
||||
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_WARNINGS_AS_ERRORS "Enable warnings as errors" ON)
|
||||
|
||||
|
@ -5,6 +5,10 @@ include_directories(.)
|
||||
set_property(DIRECTORY APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
|
||||
|
||||
if (ENABLE_LTO)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
# Set compilation flags
|
||||
if (MSVC)
|
||||
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 PRIVATE SoundTouch teakra)
|
||||
set_target_properties(audio_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||
add_definitions(-DSOUNDTOUCH_INTEGER_SAMPLES)
|
||||
|
||||
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 PRIVATE libzstd_static)
|
||||
set_target_properties(citra_common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
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 PRIVATE Boost::boost Boost::serialization Boost::iostreams httplib)
|
||||
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)
|
||||
target_link_libraries(citra_core PRIVATE web_service)
|
||||
|
@ -43,7 +43,6 @@ endif()
|
||||
|
||||
create_target_directory_groups(input_common)
|
||||
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)
|
||||
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
||||
|
@ -23,7 +23,6 @@ if (ENABLE_WEB_SERVICE)
|
||||
endif()
|
||||
|
||||
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)
|
||||
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 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)
|
||||
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
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_link_libraries(web_service PRIVATE citra_common network json-headers httplib cpp-jwt)
|
||||
target_link_libraries(web_service PUBLIC ${OPENSSL_LIBS})
|
||||
set_target_properties(web_service PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||
if (ANDROID)
|
||||
target_link_libraries(web_service PRIVATE ifaddrs)
|
||||
elseif(WIN32)
|
||||
|
Loading…
Reference in New Issue
Block a user