summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar liamwhite2022-12-03 14:10:06 -0500
committerGravatar GitHub2022-12-03 14:10:06 -0500
commit75e16547f8977e8b2b07723b04bcc3cbe999d566 (patch)
tree7a7795d68f636d1a3f4972c3ea36c1d50db564c5 /CMakeLists.txt
parentMerge pull request #9289 from liamwhite/fruit-company (diff)
parentCMake: Consolidate common PCH headers (diff)
downloadyuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.gz
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.xz
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.zip
Merge pull request #9300 from ameerj/pch
CMake: Use precompiled headers to improve compile times
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2fbe8806..cdf63a030 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,8 @@ option(YUZU_USE_BUNDLED_OPUS "Compile bundled opus" ON)
43 43
44option(YUZU_TESTS "Compile tests" ON) 44option(YUZU_TESTS "Compile tests" ON)
45 45
46option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
47
46CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) 48CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF)
47 49
48option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}") 50option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
@@ -64,6 +66,20 @@ elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "")
64 include("$ENV{VCPKG_TOOLCHAIN_FILE}") 66 include("$ENV{VCPKG_TOOLCHAIN_FILE}")
65endif() 67endif()
66 68
69if (YUZU_USE_PRECOMPILED_HEADERS)
70 if (MSVC AND CCACHE)
71 # buildcache does not properly cache PCH files, leading to compilation errors.
72 # See https://github.com/mbitsnbites/buildcache/discussions/230
73 message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH")
74 set(YUZU_USE_PRECOMPILED_HEADERS OFF)
75 endif()
76endif()
77if (YUZU_USE_PRECOMPILED_HEADERS)
78 message(STATUS "Using Precompiled Headers.")
79 set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
80endif()
81
82
67# Default to a Release build 83# Default to a Release build
68get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 84get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
69if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) 85if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)