CMake/MSVC: Fix PCH disabled build

This commit is contained in:
Scott Mansell 2023-01-29 21:51:41 +13:00
parent 1956ce151f
commit 854a73dee0
3 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,9 @@
#pragma once
#include <Windows.h>
#include <string>
#include "Common/CommonTypes.h"
namespace WindowsRegistry
{

View File

@ -4,9 +4,11 @@
#include "Common/CPUDetect.h"
#ifdef _WIN32
#include <windows.h>
#include <processthreadsapi.h>
#endif
#include <algorithm>
#include <cstring>
#include <string>
#include <thread>

View File

@ -2,6 +2,12 @@
# Instead of having one PCH per module, dolphin has one PCH shared between all modules.
# So we need to implement PCH manually, rather than using the PCH support built into cmake
# linking against this interface libary will cause targets to enable PCH
add_library(use_pch INTERFACE)
# Uncomment this return to disable PCH
#return()
add_library(build_pch pch.h pch.cpp)
# fmt/format.h is included in the PCH
@ -30,8 +36,7 @@ add_custom_target(force_build_pch
DEPENDS $<TARGET_FILE_DIR:build_pch>/dolphin.pch
)
# linking against this interface libary will cause targets to enable PCH
add_library(use_pch INTERFACE)
# link the pch into anything that depends on use_pch
target_link_libraries(use_pch INTERFACE build_pch)
# targets which use the pch need these compile options