diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ac1a60252..2a2ba65ce8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -858,6 +858,16 @@ target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAlloca target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h") target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h") +# Enable link-time optimization if compiler in current environment supports it +include(CheckIPOSupported) +check_ipo_supported(RESULT ipo_supported) +if(ipo_supported) + message(STATUS "IPO is supported") + set_property(TARGET shadps4 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +else() + message(WARNING "IPO is not supported") +endif() + if (APPLE) option(USE_SYSTEM_VULKAN_LOADER "Enables using the system Vulkan loader instead of directly linking with MoltenVK. Useful for loading validation layers." OFF) if (USE_SYSTEM_VULKAN_LOADER)