Recast: properly split PCH between library and editor

Both were using the same PCH, but the recast library doesn't need anything from SDL or ImGui, properly split them apart and cleaned up includes.
This commit is contained in:
Kawe Mazidjatari 2024-07-15 20:53:38 +02:00
parent 000703b3d9
commit b3ce300338
52 changed files with 52 additions and 115 deletions

View File

@ -20,12 +20,12 @@ add_sources( SOURCE_GROUP "Builder/Include"
add_sources( SOURCE_GROUP "Core"
"Editor.cpp"
"main.cpp"
"../thirdparty/recast/Pch.cpp"
"Pch.cpp"
)
add_sources( SOURCE_GROUP "Core/Include"
"include/Editor.h"
"../thirdparty/recast/Pch.h"
"include/Pch.h"
)
add_sources( SOURCE_GROUP "IO"
@ -96,7 +96,7 @@ target_compile_definitions( ${PROJECT_NAME} PRIVATE
"_TOOLS"
)
target_precompile_headers( ${PROJECT_NAME} PRIVATE
"${ENGINE_SOURCE_DIR}/thirdparty/recast/Pch.h"
"Include/Pch.h"
)
target_link_libraries( ${PROJECT_NAME} PRIVATE
"navsharedcommon"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/ChunkyTriMesh.h"
struct BoundsItem

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "DebugUtils/Include/DetourDebugDraw.h"
#include "DebugUtils/Include/RecastDebugDraw.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Shared/Include/SharedCommon.h"
#include "Detour/Include/DetourNode.h"
#include "DetourCrowd/Include/DetourCrowd.h"
@ -26,7 +25,7 @@
#include "NavEditor/Include/InputGeom.h"
#include "NavEditor/Include/Editor.h"
#include "NavEditor/Include/EditorInterfaces.h"
#include "thirdparty/recast/DetourCrowd/Include/DetourCrowdInternal.h"
#include "DetourCrowd/Include/DetourCrowdInternal.h"
static bool isectSegAABB(const float* sp, const float* sq,
const float* amin, const float* amax,

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAssert.h"
#include "Shared/Include/SharedCommon.h"

View File

@ -1,4 +1,3 @@
#include "Pch.h"
#include "Shared/Include/SharedCommon.h"
#include "Recast/Include/Recast.h"
#include "DebugUtils/Include/RecastDebugDraw.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "DebugUtils/Include/RecastDebugDraw.h"
#include "DebugUtils/Include/DetourDebugDraw.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "Detour/Include/DetourNavMesh.h"
#include "Detour/Include/DetourNavMeshBuilder.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Shared/Include/SharedAssert.h"
#include "Shared/Include/SharedCommon.h"
#include "Recast/Include/Recast.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/Filelist.h"
using std::vector;

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "pch.h"
#include "NavEditor/include/GameUtils.h"
#include "NavEditor/include/FileTypes.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "NavEditor/Include/InputGeom.h"
#include "NavEditor/Include/ChunkyTriMesh.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/MeshLoaderBsp.h"
bool rcMeshLoaderBsp::load(const std::string& /*filename*/)

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/MeshLoaderObj.h"
rcMeshLoaderObj::rcMeshLoaderObj() :

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/MeshLoaderPly.h"
bool rcMeshLoaderPly::load(const std::string& filename)

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Shared/Include/SharedCommon.h"
#include "Detour/Include/DetourNavMesh.h"
#include "DebugUtils/Include/DetourDebugDraw.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Shared/Include/SharedCommon.h"
#include "Recast/Include/Recast.h"
#include "Detour/Include/DetourNavMesh.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "DebugUtils/Include/RecastDebugDraw.h"
#include "DebugUtils/Include/DetourDebugDraw.h"

View File

@ -2,7 +2,7 @@
// *.pch will be the pre-compiled header
// Pch.obj will contain the pre-compiled type information
#include "Pch.h"
#include "Include/Pch.h"
// TODO: reference any additional headers you need in PCH.H
// and not in this file

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "NavEditor/Include/PerfTimer.h"
#if defined(WIN32)

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Shared/Include/SharedCommon.h"
#include "Detour/Include/DetourNavMesh.h"
#include "Detour/Include/DetourNavMeshQuery.h"

View File

@ -1,4 +1,3 @@
#include "Pch.h"
#include "NavEditor/Include/ValueHistory.h"
#ifdef WIN32

View File

@ -1,5 +1,5 @@
#ifndef RDPCH_H
#define RDPCH_H
#ifndef NAVEDITORPCH_H
#define NAVEDITORPCH_H
#define _USE_MATH_DEFINES
#include <math.h>
@ -66,4 +66,4 @@
#include "tier0/commonmacros.h"
#include "common/sdkdefs.h"
#endif // RDPCH_H
#endif // NAVEDITORPCH_H

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include "Pch.h"
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "DebugUtils/Include/RecastDebugDraw.h"

View File

@ -8,12 +8,14 @@ add_module( "lib" "navsharedcommon" "" ${FOLDER_CONTEXT} TRUE TRUE )
start_sources()
add_sources( SOURCE_GROUP "Source"
"Shared/Source/Pch.cpp"
"Shared/Source/SharedAlloc.cpp"
"Shared/Source/SharedAssert.cpp"
"Shared/Source/SharedCommon.cpp"
)
add_sources( SOURCE_GROUP "Include"
"Shared/Include/Pch.h"
"Shared/Include/SharedAlloc.h"
"Shared/Include/SharedAssert.h"
"Shared/Include/SharedCommon.h"
@ -24,7 +26,7 @@ end_sources()
whole_program_optimization()
target_precompile_headers( ${PROJECT_NAME} PRIVATE
"Pch.h"
"Shared/Include/Pch.h"
)
# -----------------------------------------------------------------------------

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <string.h>
#include "Shared/Include/SharedMath.h"
#include "Shared/Include/SharedCommon.h"
#include "DebugUtils/Include/DebugDraw.h"

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <math.h>
#include "DebugUtils/Include/DebugDraw.h"
#include "DebugUtils/Include/RecastDebugDraw.h"
#include "Recast/Include/Recast.h"

View File

@ -16,11 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "DebugUtils/Include/RecastDump.h"

View File

@ -16,10 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#include <string.h>
#include <stdio.h>
#include <new>
#include "Shared/Include/SharedMath.h"
#include "Shared/Include/SharedCommon.h"
#include "Shared/Include/SharedAlloc.h"

View File

@ -16,11 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <map>
#include "Shared/Include/SharedMath.h"
#include "Shared/Include/SharedCommon.h"
#include "Shared/Include/SharedAlloc.h"

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#include <string.h>
#include "Shared/Include/SharedMath.h"
#include "Detour/Include/DetourNavMeshQuery.h"
#include "Detour/Include/DetourNavMesh.h"
@ -25,7 +23,6 @@
#include "Shared/Include/SharedCommon.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"
#include <new>
/// @class dtQueryFilter
///

View File

@ -20,7 +20,6 @@
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"
#include "Shared/Include/SharedCommon.h"
#include <string.h>
#ifdef DT_POLYREF64
// From Thomas Wang, https://gist.github.com/badboy/6267743

View File

@ -26,6 +26,10 @@
#include "DetourProximityGrid.h"
#include "DetourPathQueue.h"
#ifndef V_ARRAYSIZE // Required for the game header below.
#define V_ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif // !V_ARRAYSIZE
#include "game/server/ai_navmesh.h"
/// The maximum number of neighbors that a crowd agent can take into account

View File

@ -16,11 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <string.h>
#include <float.h>
#include <stdlib.h>
#include <new>
#include "DetourCrowd\Include\DetourCrowd.h"
#include "DetourCrowd\Include\DetourCrowdInternal.h"
#include "DetourCrowd\Include\DetourObstacleAvoidance.h"

View File

@ -16,11 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <string.h>
#include <float.h>
#include <stdlib.h>
#include <new>
#include "DetourCrowd\Include\DetourCrowd.h"
#include "DetourCrowd\Include\DetourCrowdInternal.h"
#include "DetourCrowd\Include\DetourObstacleAvoidance.h"

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#include <string.h>
#include "DetourCrowd\Include\DetourLocalBoundary.h"
#include "Detour\Include\DetourNavMeshQuery.h"
#include "Shared\Include\SharedCommon.h"

View File

@ -21,9 +21,6 @@
#include "Shared\Include\SharedMath.h"
#include "Shared\Include\SharedAlloc.h"
#include "Shared\Include\SharedAssert.h"
#include <string.h>
#include <float.h>
#include <new>
static int sweepCircleCircle(const float* c0, const float r0, const float* v,
const float* c1, const float r1,

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <string.h>
#include "DetourCrowd\Include\DetourPathCorridor.h"
#include "Detour\Include\DetourNavMeshQuery.h"
#include "Shared\Include\SharedCommon.h"

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <string.h>
#include "DetourCrowd\Include\DetourPathQueue.h"
#include "Detour\Include\DetourNavMesh.h"
#include "Detour\Include\DetourNavMeshQuery.h"

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <string.h>
#include <new>
#include "Shared\Include\SharedMath.h"
#include "Shared\Include\SharedCommon.h"
#include "DetourCrowd\Include\DetourProximityGrid.h"

View File

@ -20,11 +20,6 @@
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
namespace
{
/// Allocates and constructs an object of the given type, returning a pointer.

View File

@ -16,12 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"

View File

@ -16,10 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"

View File

@ -19,8 +19,6 @@
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAssert.h"
#include <stdlib.h>
void rcFilterLowHangingWalkableObstacles(rcContext* context, const int walkableClimb, rcHeightfield& heightfield)
{
rdAssert(context);

View File

@ -16,12 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"

View File

@ -16,14 +16,9 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"
#include <algorithm>
struct rcEdge
{
unsigned short vert[2];

View File

@ -16,16 +16,9 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"
#include <algorithm>
static const unsigned RC_UNSET_HEIGHT = 0xffff;
#define REVERSE_DIRECTION 1

View File

@ -16,8 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <math.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"

View File

@ -16,12 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast/Include/Recast.h"
#include "Shared/Include/SharedAlloc.h"
#include "Shared/Include/SharedAssert.h"

View File

@ -0,0 +1,29 @@
#ifndef RDPCH_H
#define RDPCH_H
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#include <float.h>
#include <string.h>
#include <ctype.h>
#include <new>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include "thirdparty/fastlz/fastlz.h"
#endif // RDPCH_H

View File

@ -0,0 +1,8 @@
// Pch.cpp : source file that includes just the standard includes
// *.pch will be the pre-compiled header
// Pch.obj will contain the pre-compiled type information
#include "Shared/Include/Pch.h"
// TODO: reference any additional headers you need in PCH.H
// and not in this file

View File

@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//
#include <stdlib.h>
#include "Shared/Include/SharedAlloc.h"
static void *rdAllocDefault(size_t size, rdAllocHint)