From 2cce381afec1181d45f088e0b29c08c6200017a6 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sat, 5 Oct 2024 16:38:22 +0200 Subject: [PATCH] Added PCH support --- CMakeLists.txt | 10 +++++++++- Engine/Graphics/Camera.hpp | 2 +- Engine/Utils/3DMaths.inl | 2 -- Engine/Utils/MeshHelper.hpp | 2 +- srcs.list | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e07ae48..5e51645 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,15 @@ if(DISABLE_CPU_OPTI) endif() # targets declarations -add_executable(${PROJECT_NAME} ${MAIN_SCRS} ${UTILS_SCRS} ${MISC_SCRS} ${GAME_SCRS} ${GRAPHS_SCRS} ${SOUNDS_SCRS}) +add_executable(${PROJECT_NAME}) +target_precompile_headers(${PROJECT_NAME} PRIVATE + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:${CMAKE_CURRENT_SOURCE_DIR}/Engine/Utils/3DMaths.hpp>" +) +target_sources(${PROJECT_NAME} PUBLIC ${MAIN_SCRS} ${UTILS_SCRS} ${MISC_SCRS} ${GAME_SCRS} ${GRAPHS_SCRS} ${SOUNDS_SCRS}) target_link_libraries(${PROJECT_NAME} sfml::sfml) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}${BUILDNAME_SUFFIX} diff --git a/Engine/Graphics/Camera.hpp b/Engine/Graphics/Camera.hpp index a99bc00..862f866 100644 --- a/Engine/Graphics/Camera.hpp +++ b/Engine/Graphics/Camera.hpp @@ -1,6 +1,6 @@ #pragma once -#include "../Utils/3DMaths.hpp" +//#include "../Utils/3DMaths.hpp" // Using PCH instead class Camera final { diff --git a/Engine/Utils/3DMaths.inl b/Engine/Utils/3DMaths.inl index fd14a8b..d450e4a 100644 --- a/Engine/Utils/3DMaths.inl +++ b/Engine/Utils/3DMaths.inl @@ -1,7 +1,5 @@ #pragma once -#include "3DMaths.hpp" - inline void M3D_ScalarSinCos(float* pSin, float* pCos, float Value) noexcept { // Map Value to y in [-pi,pi], x = 2*pi*quotient + remainder. diff --git a/Engine/Utils/MeshHelper.hpp b/Engine/Utils/MeshHelper.hpp index 37450ea..f908d31 100644 --- a/Engine/Utils/MeshHelper.hpp +++ b/Engine/Utils/MeshHelper.hpp @@ -4,7 +4,7 @@ #include -#include "../Utils/3DMaths.hpp" +//#include "../Utils/3DMaths.hpp" // Using PCH instead #define MHELPER_INDICES_TRI_ADD(array, i1, i2, i3) \ diff --git a/srcs.list b/srcs.list index 803b912..9b70bd5 100644 --- a/srcs.list +++ b/srcs.list @@ -5,8 +5,8 @@ set(MAIN_SCRS icon.h ) set(UTILS_SCRS - Engine/Utils/3DMaths.inl - Engine/Utils/3DMaths.hpp + #Engine/Utils/3DMaths.inl + #Engine/Utils/3DMaths.hpp Engine/Utils/MeshHelper.hpp Engine/Utils/Timers.hpp Engine/Utils/Perfs.cpp