mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
use CMake LTO module, enable LTO for MSVC build
This commit is contained in:
parent
ca54e65886
commit
8a34e13dcc
2
.github/workflows/win_msvc.yml
vendored
2
.github/workflows/win_msvc.yml
vendored
@ -53,7 +53,7 @@ jobs:
|
|||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -G Ninja `
|
cmake -B build -G Ninja `
|
||||||
-DCMAKE_BUILD_TYPE=Release -DENABLE_WERROR=ON `
|
-DCMAKE_BUILD_TYPE=Release -DENABLE_WERROR=ON -DENABLE_LTO=ON`
|
||||||
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
|
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
|
||||||
-DVCPKG_TARGET_TRIPLET="${{ matrix.arch }}-windows-static-release" `
|
-DVCPKG_TARGET_TRIPLET="${{ matrix.arch }}-windows-static-release" `
|
||||||
-DVCPKG_OVERLAY_TRIPLETS="cmake/triplets"
|
-DVCPKG_OVERLAY_TRIPLETS="cmake/triplets"
|
||||||
|
@ -12,7 +12,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||||
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
|
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
|
|
||||||
project("Woof"
|
project("Woof"
|
||||||
VERSION 10.5.1
|
VERSION 10.5.1
|
||||||
|
@ -99,13 +99,11 @@ if(ENABLE_HARDENING)
|
|||||||
_checked_add_link_option(-Wl,-z,relro)
|
_checked_add_link_option(-Wl,-z,relro)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_LTO "Enable link time optimization" OFF)
|
include(CheckIPOSupported)
|
||||||
if(ENABLE_LTO)
|
check_ipo_supported(RESULT HAVE_LTO)
|
||||||
_checked_add_compile_option(-flto=auto)
|
|
||||||
_checked_add_compile_option(-ffat-lto-objects)
|
include(CMakeDependentOption)
|
||||||
_checked_add_link_option(-flto=auto)
|
cmake_dependent_option(ENABLE_LTO "Enable link time optimization" OFF "HAVE_LTO" OFF)
|
||||||
_checked_add_link_option(-ffat-lto-objects)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${FORCE_COLORED_OUTPUT})
|
if(${FORCE_COLORED_OUTPUT})
|
||||||
_checked_add_compile_option(-fdiagnostics-color=always F_DIAG_COLOR)
|
_checked_add_compile_option(-fdiagnostics-color=always F_DIAG_COLOR)
|
||||||
@ -118,5 +116,6 @@ function(target_woof_settings)
|
|||||||
foreach(target ${ARGN})
|
foreach(target ${ARGN})
|
||||||
target_compile_options(${target} PRIVATE ${COMMON_COMPILE_OPTIONS})
|
target_compile_options(${target} PRIVATE ${COMMON_COMPILE_OPTIONS})
|
||||||
target_link_options(${target} PRIVATE ${COMMON_LINK_OPTIONS})
|
target_link_options(${target} PRIVATE ${COMMON_LINK_OPTIONS})
|
||||||
|
set_target_properties(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user