diff options
| author | 2022-12-03 14:10:06 -0500 | |
|---|---|---|
| committer | 2022-12-03 14:10:06 -0500 | |
| commit | 75e16547f8977e8b2b07723b04bcc3cbe999d566 (patch) | |
| tree | 7a7795d68f636d1a3f4972c3ea36c1d50db564c5 /CMakeLists.txt | |
| parent | Merge pull request #9289 from liamwhite/fruit-company (diff) | |
| parent | CMake: Consolidate common PCH headers (diff) | |
| download | yuzu-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.txt | 16 |
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 | ||
| 44 | option(YUZU_TESTS "Compile tests" ON) | 44 | option(YUZU_TESTS "Compile tests" ON) |
| 45 | 45 | ||
| 46 | option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) | ||
| 47 | |||
| 46 | CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) | 48 | CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) |
| 47 | 49 | ||
| 48 | option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}") | 50 | option(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}") |
| 65 | endif() | 67 | endif() |
| 66 | 68 | ||
| 69 | if (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() | ||
| 76 | endif() | ||
| 77 | if (YUZU_USE_PRECOMPILED_HEADERS) | ||
| 78 | message(STATUS "Using Precompiled Headers.") | ||
| 79 | set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) | ||
| 80 | endif() | ||
| 81 | |||
| 82 | |||
| 67 | # Default to a Release build | 83 | # Default to a Release build |
| 68 | get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | 84 | get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) |
| 69 | if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) | 85 | if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE) |