Skip to content

Commit b48b40b

Browse files
committed
[BUILD] add precompile header support
1 parent 85f62b1 commit b48b40b

21 files changed

Lines changed: 18 additions & 30 deletions

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ link_libraries(
8080
)
8181

8282

83-
# Include precomp header list and main sources
84-
include(${CMAKE_SOURCE_DIR}/cmake/precomp-headers.cmake) # PRECOMP_HEADERS
83+
# Include core source and precomp header
84+
set(PCH_FILE ${CMAKE_SOURCE_DIR}/src/precomp/pch.h)
8585
include(${CMAKE_SOURCE_DIR}/cmake/core-sources.cmake) # CORE_SOURCES
8686

8787

@@ -90,6 +90,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/core-sources.cmake) # CORE_SOURCES
9090
add_executable(OpenSHC.exe WIN32 ${CORE_SOURCES})
9191
set_target_properties(OpenSHC.exe PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
9292
target_compile_definitions(OpenSHC.exe PRIVATE OPEN_SHC_EXE)
93+
target_precompile_headers(OpenSHC.exe PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
9394

9495
# Checks if a binkw32_real is present and uses this instead; only checks on reconfigure
9596
if(EXISTS "${CRUSADER_DIR}/binkw32_real.dll")
@@ -110,6 +111,7 @@ set(OPEN_SHC_DLL_DEST "${CRUSADER_DIR}/ucp/modules/${OPEN_SHC_NAME}-${OPEN_SHC_V
110111
add_library(OpenSHC.dll SHARED ${CORE_SOURCES})
111112
set_target_properties(OpenSHC.dll PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
112113
target_compile_definitions(OpenSHC.dll PRIVATE OPEN_SHC_DLL)
114+
target_precompile_headers(OpenSHC.dll PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
113115

114116
# Using module folder as runtime output to properly place the dll and other libs
115117
set_target_properties(OpenSHC.dll PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OPEN_SHC_DLL_DEST})

cmake/precomp-headers.cmake

Lines changed: 0 additions & 3 deletions
This file was deleted.

create-include-lists.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ set(VAR_NAME "GENERATED_FILES")
5656

5757
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/cmake")
5858

59-
# precompile headers
60-
generate_file_list("${CMAKE_CURRENT_LIST_DIR}" "src/precomp/*.h" "${CMAKE_CURRENT_LIST_DIR}/cmake/precomp-headers.cmake" PRECOMP_HEADERS)
61-
6259
# core sources
6360
generate_file_list("${CMAKE_CURRENT_LIST_DIR}" "src/core/*.c;src/core/*.cpp" "${CMAKE_CURRENT_LIST_DIR}/cmake/core-sources.cmake" CORE_SOURCES)
6461

src/core/MainDeclaration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#include "framework.h"
4-
53
namespace Main {
4+
65
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, int nCmdShow);
6+
77
}

src/core/MainResolver.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include "FunctionResolver.h"
4-
53
#include "MainDeclaration.h"
64

75
namespace Main_Func {

src/core/Resolver.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
#include "FunctionResolver.h"
2-
#include "StructResolver.h"
31

42
#include "ucp3.h"
53

6-
#include "framework.h"
7-
84
#include <sstream>
95

106
// TODO?: When in doubt regarding the transition to full exe: Add other logging system.

src/core/StructTest.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include "StructResolver.h"
43
#include "ViewportRenderState.h"
54

65
MACRO_STRUCT_RESOLVER(ViewportRenderState, false, 0x100) ViewportRenderState_Struct;

src/core/ViewportRenderState.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "ViewportRenderState.h"
2-
#include "StructResolver.h"
32
#include "ViewportRenderState.func.h"
43

54
#include "windowslib.h"

src/core/ViewportRenderState.func.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include "FunctionResolver.h"
43
#include "ViewportRenderState.h"
54

65
namespace ViewportRenderState_Func {

src/core/ViewportRenderState.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#pragma once
22

33
#include "ViewportRenderStateStruct.h"
4-
#include "common.h"
5-
#include "framework.h"
64

75
struct UnitRenderHelpStructure {
86
int param_1;

0 commit comments

Comments
 (0)