CMake: Use precompiled headers
This commit is contained in:
parent
5695ae6bdd
commit
37bc5118ea
|
@ -43,6 +43,8 @@ option(YUZU_USE_BUNDLED_OPUS "Compile bundled opus" ON)
|
||||||
|
|
||||||
option(YUZU_TESTS "Compile tests" 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)
|
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}")
|
option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}")
|
||||||
|
|
|
@ -82,8 +82,9 @@ if (MSVC)
|
||||||
/wd4324 # 'struct_name': structure was padded due to __declspec(align())
|
/wd4324 # 'struct_name': structure was padded due to __declspec(align())
|
||||||
)
|
)
|
||||||
|
|
||||||
if (USE_CCACHE)
|
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cachable format
|
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cachable format
|
||||||
|
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
|
||||||
add_compile_options(/Z7)
|
add_compile_options(/Z7)
|
||||||
else()
|
else()
|
||||||
add_compile_options(/Zi)
|
add_compile_options(/Zi)
|
||||||
|
@ -151,6 +152,10 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(audio_core)
|
add_subdirectory(audio_core)
|
||||||
|
|
|
@ -31,6 +31,7 @@ add_library(audio_core STATIC
|
||||||
out/audio_out.h
|
out/audio_out.h
|
||||||
out/audio_out_system.cpp
|
out/audio_out_system.cpp
|
||||||
out/audio_out_system.h
|
out/audio_out_system.h
|
||||||
|
precompiled_headers.h
|
||||||
renderer/adsp/adsp.cpp
|
renderer/adsp/adsp.cpp
|
||||||
renderer/adsp/adsp.h
|
renderer/adsp/adsp.h
|
||||||
renderer/adsp/audio_renderer.cpp
|
renderer/adsp/audio_renderer.cpp
|
||||||
|
@ -229,3 +230,7 @@ if(ENABLE_SDL2)
|
||||||
target_link_libraries(audio_core PRIVATE SDL2)
|
target_link_libraries(audio_core PRIVATE SDL2)
|
||||||
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(audio_core PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -95,6 +95,7 @@ add_library(common STATIC
|
||||||
param_package.h
|
param_package.h
|
||||||
parent_of_member.h
|
parent_of_member.h
|
||||||
point.h
|
point.h
|
||||||
|
precompiled_headers.h
|
||||||
quaternion.h
|
quaternion.h
|
||||||
reader_writer_queue.h
|
reader_writer_queue.h
|
||||||
ring_buffer.h
|
ring_buffer.h
|
||||||
|
@ -183,3 +184,8 @@ else()
|
||||||
target_link_libraries(common PRIVATE
|
target_link_libraries(common PRIVATE
|
||||||
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
|
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(common PRIVATE precompiled_headers.h)
|
||||||
|
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -771,6 +771,7 @@ add_library(core STATIC
|
||||||
memory.h
|
memory.h
|
||||||
perf_stats.cpp
|
perf_stats.cpp
|
||||||
perf_stats.h
|
perf_stats.h
|
||||||
|
precompiled_headers.h
|
||||||
reporter.cpp
|
reporter.cpp
|
||||||
reporter.h
|
reporter.h
|
||||||
telemetry_session.cpp
|
telemetry_session.cpp
|
||||||
|
@ -825,3 +826,7 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
||||||
)
|
)
|
||||||
target_link_libraries(core PRIVATE dynarmic)
|
target_link_libraries(core PRIVATE dynarmic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(core PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <boost/container/flat_map.hpp> // used by service.h which is heavily included
|
||||||
|
#include <boost/intrusive/rbtree.hpp> // used by k_auto_object.h which is heavily included
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -4,6 +4,7 @@
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||||
|
|
||||||
add_executable(yuzu-room
|
add_executable(yuzu-room
|
||||||
|
precompiled_headers.h
|
||||||
yuzu_room.cpp
|
yuzu_room.cpp
|
||||||
yuzu_room.rc
|
yuzu_room.rc
|
||||||
)
|
)
|
||||||
|
@ -25,3 +26,7 @@ target_link_libraries(yuzu-room PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS yuzu-room)
|
install(TARGETS yuzu-room)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(yuzu-room PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -34,6 +34,7 @@ add_library(input_common STATIC
|
||||||
input_poller.h
|
input_poller.h
|
||||||
main.cpp
|
main.cpp
|
||||||
main.h
|
main.h
|
||||||
|
precompiled_headers.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -63,3 +64,7 @@ target_link_libraries(input_common PRIVATE usb)
|
||||||
|
|
||||||
create_target_directory_groups(input_common)
|
create_target_directory_groups(input_common)
|
||||||
target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
|
target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -8,6 +8,7 @@ add_library(network STATIC
|
||||||
network.h
|
network.h
|
||||||
packet.cpp
|
packet.cpp
|
||||||
packet.h
|
packet.h
|
||||||
|
precompiled_headers.h
|
||||||
room.cpp
|
room.cpp
|
||||||
room.h
|
room.h
|
||||||
room_member.cpp
|
room_member.cpp
|
||||||
|
@ -23,3 +24,7 @@ if (ENABLE_WEB_SERVICE)
|
||||||
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
|
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(network PRIVATE web_service)
|
target_link_libraries(network PRIVATE web_service)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(network PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -230,6 +230,7 @@ add_library(shader_recompiler STATIC
|
||||||
ir_opt/texture_pass.cpp
|
ir_opt/texture_pass.cpp
|
||||||
ir_opt/verification_pass.cpp
|
ir_opt/verification_pass.cpp
|
||||||
object_pool.h
|
object_pool.h
|
||||||
|
precompiled_headers.h
|
||||||
profile.h
|
profile.h
|
||||||
program_header.h
|
program_header.h
|
||||||
runtime_info.h
|
runtime_info.h
|
||||||
|
@ -258,3 +259,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
create_target_directory_groups(shader_recompiler)
|
create_target_directory_groups(shader_recompiler)
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(shader_recompiler PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
||||||
|
#include "frontend/maxwell/translate/impl/impl.h"
|
|
@ -11,6 +11,7 @@ add_executable(tests
|
||||||
common/unique_function.cpp
|
common/unique_function.cpp
|
||||||
core/core_timing.cpp
|
core/core_timing.cpp
|
||||||
core/internal_network/network.cpp
|
core/internal_network/network.cpp
|
||||||
|
precompiled_headers.h
|
||||||
tests.cpp
|
tests.cpp
|
||||||
video_core/buffer_base.cpp
|
video_core/buffer_base.cpp
|
||||||
input_common/calibration_configuration_job.cpp
|
input_common/calibration_configuration_job.cpp
|
||||||
|
@ -22,3 +23,7 @@ target_link_libraries(tests PRIVATE common core input_common)
|
||||||
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 Threads::Threads)
|
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 Threads::Threads)
|
||||||
|
|
||||||
add_test(NAME tests COMMAND tests)
|
add_test(NAME tests COMMAND tests)
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(tests PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -84,6 +84,7 @@ add_library(video_core STATIC
|
||||||
gpu_thread.h
|
gpu_thread.h
|
||||||
memory_manager.cpp
|
memory_manager.cpp
|
||||||
memory_manager.h
|
memory_manager.h
|
||||||
|
precompiled_headers.h
|
||||||
pte_kind.h
|
pte_kind.h
|
||||||
query_cache.h
|
query_cache.h
|
||||||
rasterizer_accelerated.cpp
|
rasterizer_accelerated.cpp
|
||||||
|
@ -300,3 +301,7 @@ endif()
|
||||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
||||||
target_link_libraries(video_core PRIVATE dynarmic)
|
target_link_libraries(video_core PRIVATE dynarmic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(video_core PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -4,6 +4,7 @@
|
||||||
add_library(web_service STATIC
|
add_library(web_service STATIC
|
||||||
announce_room_json.cpp
|
announce_room_json.cpp
|
||||||
announce_room_json.h
|
announce_room_json.h
|
||||||
|
precompiled_headers.h
|
||||||
telemetry_json.cpp
|
telemetry_json.cpp
|
||||||
telemetry_json.h
|
telemetry_json.h
|
||||||
verify_login.cpp
|
verify_login.cpp
|
||||||
|
@ -17,3 +18,7 @@ add_library(web_service STATIC
|
||||||
|
|
||||||
create_target_directory_groups(web_service)
|
create_target_directory_groups(web_service)
|
||||||
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib cpp-jwt)
|
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib cpp-jwt)
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(web_service PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -186,6 +186,7 @@ add_executable(yuzu
|
||||||
multiplayer/state.cpp
|
multiplayer/state.cpp
|
||||||
multiplayer/state.h
|
multiplayer/state.h
|
||||||
multiplayer/validation.h
|
multiplayer/validation.h
|
||||||
|
precompiled_headers.h
|
||||||
startup_checks.cpp
|
startup_checks.cpp
|
||||||
startup_checks.h
|
startup_checks.h
|
||||||
uisettings.cpp
|
uisettings.cpp
|
||||||
|
@ -405,3 +406,7 @@ endif()
|
||||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
||||||
target_link_libraries(yuzu PRIVATE dynarmic)
|
target_link_libraries(yuzu PRIVATE dynarmic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(yuzu PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
|
@ -24,6 +24,7 @@ add_executable(yuzu-cmd
|
||||||
emu_window/emu_window_sdl2_gl.h
|
emu_window/emu_window_sdl2_gl.h
|
||||||
emu_window/emu_window_sdl2_vk.cpp
|
emu_window/emu_window_sdl2_vk.cpp
|
||||||
emu_window/emu_window_sdl2_vk.h
|
emu_window/emu_window_sdl2_vk.h
|
||||||
|
precompiled_headers.h
|
||||||
yuzu.cpp
|
yuzu.cpp
|
||||||
yuzu.rc
|
yuzu.rc
|
||||||
)
|
)
|
||||||
|
@ -55,3 +56,7 @@ if (MSVC)
|
||||||
include(CopyYuzuSDLDeps)
|
include(CopyYuzuSDLDeps)
|
||||||
copy_yuzu_SDL_deps(yuzu-cmd)
|
copy_yuzu_SDL_deps(yuzu-cmd)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
|
target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h)
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "common/assert.h"
|
Reference in New Issue