summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-12-03 20:10:06 +0100
committerGitHub <noreply@github.com>2022-12-03 20:10:06 +0100
commit75e16547f8977e8b2b07723b04bcc3cbe999d566 (patch)
tree7a7795d68f636d1a3f4972c3ea36c1d50db564c5 /CMakeLists.txt
parentMerge pull request #9289 from liamwhite/fruit-company (diff)
parentCMake: Consolidate common PCH headers (diff)
downloadyuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.gz
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.bz2
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.lz
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.xz
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.tar.zst
yuzu-75e16547f8977e8b2b07723b04bcc3cbe999d566.zip
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)
option(YUZU_TESTS "Compile tests" ON)
+option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
+
CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF)
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
@@ -64,6 +66,20 @@ elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "")
include("$ENV{VCPKG_TOOLCHAIN_FILE}")
endif()
+if (YUZU_USE_PRECOMPILED_HEADERS)
+ if (MSVC AND CCACHE)
+ # buildcache does not properly cache PCH files, leading to compilation errors.
+ # See https://github.com/mbitsnbites/buildcache/discussions/230
+ message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH")
+ set(YUZU_USE_PRECOMPILED_HEADERS OFF)
+ endif()
+endif()
+if (YUZU_USE_PRECOMPILED_HEADERS)
+ message(STATUS "Using Precompiled Headers.")
+ set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
+endif()
+
+
# Default to a Release build
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)