From f989061e2d651da7f2559aee2cfc41b1f20f4790 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 6 Jul 2024 09:33:31 +0200 Subject: [PATCH] Tier0: drop SDK specific code for tools Mathlib doesn't use some of the game-specific mutex stuff, but since our tools is now also including the mutex utilities, we have to block them out for _TOOLS as well. --- src/naveditor/CMakeLists.txt | 1 + src/public/tier0/threadtools.h | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/naveditor/CMakeLists.txt b/src/naveditor/CMakeLists.txt index c433f727..40d279a7 100644 --- a/src/naveditor/CMakeLists.txt +++ b/src/naveditor/CMakeLists.txt @@ -94,6 +94,7 @@ set_target_properties( ${PROJECT_NAME} PROPERTIES ) target_compile_definitions( ${PROJECT_NAME} PRIVATE "WIN32" + "_TOOLS" ) target_precompile_headers( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/thirdparty/recast/Pch.h" diff --git a/src/public/tier0/threadtools.h b/src/public/tier0/threadtools.h index e47e2379..3ecaa398 100644 --- a/src/public/tier0/threadtools.h +++ b/src/public/tier0/threadtools.h @@ -1,10 +1,15 @@ #ifndef THREADTOOLS_H #define THREADTOOLS_H #include "dbg.h" -#ifndef BUILDING_MATHLIB -#include "jobthread.h" + +#ifdef BUILDING_MATHLIB +#define _TOOLS #endif // BUILDING_MATHLIB +#ifndef _TOOLS +#include "jobthread.h" +#endif // _TOOLS + inline void ThreadSleep(unsigned nMilliseconds) { #ifdef _WIN32 @@ -115,7 +120,7 @@ FORCEINLINE ThreadId_t ThreadGetCurrentId() #endif } -#ifndef BUILDING_MATHLIB +#ifndef _TOOLS extern ThreadId_t* g_ThreadMainThreadID; extern ThreadId_t* g_ThreadServerFrameThreadID; @@ -128,7 +133,7 @@ PLATFORM_INTERFACE bool ThreadInMainOrServerFrameThread(); PLATFORM_INTERFACE bool ThreadCouldDoServerWork(); PLATFORM_INTERFACE void ThreadJoinServerJob(); -#endif // !BUILDING_MATHLIB +#endif // !_TOOLS #ifdef _WIN32 #define NOINLINE @@ -262,11 +267,11 @@ private: typedef CInterlockedIntT CInterlockedInt; typedef CInterlockedIntT CInterlockedUInt; -#ifndef BUILDING_MATHLIB +#ifndef _TOOLS //============================================================================= -#endif // !BUILDING_MATHLIB +#endif // !_TOOLS /////////////////////////////////////////////////////////////////////////////// class CThreadFastMutex @@ -557,7 +562,7 @@ void CThreadSpinRWLock::UnlockRead() #endif } -#ifndef BUILDING_MATHLIB +#ifndef _TOOLS /////////////////////////////////////////////////////////////////////////////// class VThreadTools : public IDetour { @@ -582,5 +587,5 @@ class VThreadTools : public IDetour }; /////////////////////////////////////////////////////////////////////////////// -#endif // !BUILDING_MATHLIB +#endif // !_TOOLS #endif // THREADTOOLS_H