Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
32 changes: 21 additions & 11 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ option(NEO_BUILD_WEAPON_PBK56S "Build PBK56S weapon" OFF)
option(NEO_BUILD_TIER1 "Build tier1 library" ON)
option(NEO_BUILD_MATHLIB "Build mathlib library" ON)
option(NEO_BUILD_VGUI_CONTROLS "Build vgui_controls library" ON)
option(NEO_BUILD_UTILS "Build utils" ON)
option(NEO_VMPI "Use VMPI in utils" ON)
option(NEO_COPY_LIBRARIES "Copy libraries to bin directory by default" ON)
option(NEO_EXTRA_ASSETS "Copy extra assets into game/neo" ON)
if (OS_LINUX)
Expand Down Expand Up @@ -62,6 +64,8 @@ message(STATUS "Build PBK56S weapon (INCLUDE_WEP_PBK): ${NEO_BUILD_WEAPON_PBK56S
message(STATUS "Build tier1 library: ${NEO_BUILD_TIER1}")
message(STATUS "Build mathlib library: ${NEO_BUILD_MATHLIB}")
message(STATUS "Build vgui_controls library: ${NEO_BUILD_VGUI_CONTROLS}")
message(STATUS "Build utils: ${NEO_BUILD_UTILS}")
message(STATUS "Use VMPI in utils: ${NEO_VMPI}")
message(STATUS "Copy libraries to bin directory by default: ${NEO_COPY_LIBRARIES}")
message(STATUS "Copy extra assets into game/neo: ${NEO_EXTRA_ASSETS}")
message(STATUS "Directory for output libraries: ${NEO_OUTPUT_LIBRARY_PATH}")
Expand Down Expand Up @@ -90,7 +94,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE FALSE)

set(SOURCESDK TRUE)
set(SOURCE_HAS_FREETYPE TRUE)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(
Expand All @@ -106,13 +109,6 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWith
add_compile_definitions(
NDEBUG
)

add_compile_options(
#-fno-strict-aliasing
-ffast-math
-fno-omit-frame-pointer
-ftree-vectorize
)
endif()

if(NEO_RAD_TELEMETRY_DISABLED)
Expand Down Expand Up @@ -189,7 +185,6 @@ if(OS_WINDOWS)
_ALLOW_RUNTIME_LIBRARY_MISMATCH
_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
_ALLOW_MSC_VER_MISMATCH
fopen=dont_use_fopen
_MBCS
)

Expand Down Expand Up @@ -236,7 +231,7 @@ if(OS_WINDOWS)
#/Z7 # DebugInformationFormat - C7 Compatible
#/Wp64 # Detect64bitPortabilityIssues
#/O2 # Optimization - Maximize Speed
/Ob2 # InlineFunctionExpansion - Any Suitable
#/Ob2 # InlineFunctionExpansion - Any Suitable
/Oi # EnableIntrinsicFunctions
/Ot # FavorSizeOrSpeed - Favor Fast Code
/GF # EnableStringPooling
Expand Down Expand Up @@ -324,7 +319,6 @@ if(OS_LINUX OR OS_MACOS)
-fdiagnostics-show-option
-Wformat -Wformat-security


-Usprintf
-Ustrncpy

Expand All @@ -338,6 +332,15 @@ if(OS_LINUX OR OS_MACOS)
#-fms-extensions
)

if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_compile_options(
#-fno-strict-aliasing
-ffast-math
-fno-omit-frame-pointer
-ftree-vectorize
)
endif()

# Disable option for older compiler in docker
if(NOT CMAKE_CXX_COMPILER_VERSION STREQUAL "4.8.4")
add_compile_options(
Expand Down Expand Up @@ -394,6 +397,7 @@ if(NEO_USE_CCACHE)
)
endif()

add_subdirectory(thirdparty)
add_subdirectory(lib)

if(NEO_GENERATE_GAMEDATA)
Expand All @@ -418,6 +422,7 @@ if(NOT NEO_DEDICATED)
endif()

add_subdirectory(game/server)
add_subdirectory(raytrace)

if(NEO_COPY_LIBRARIES)
set(COPY_ALL_LIBS_FLAG ALL)
Expand Down Expand Up @@ -573,3 +578,8 @@ if(NEO_EXTRA_ASSETS)
"${neo_assets_SOURCE_DIR}/neo"
"${CMAKE_SOURCE_DIR}/../game/neo")
endif()

if(NEO_BUILD_UTILS)
add_subdirectory(fgdlib)
add_subdirectory(utils)
endif()
File renamed without changes.
22 changes: 22 additions & 0 deletions src/cmake/FindLibZ.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
if(OS_WINDOWS)
set(LIBZ_LIBRARY_NAME libz.lib)
elseif(OS_LINUX OR OS_MACOS)
return() # TODO Linux
endif()

find_file(LIBZ_LIBRARY
NAMES ${LIBZ_LIBRARY_NAME}
PATHS "${LIBPUBLIC}"
NO_CACHE
NO_DEFAULT_PATH
REQUIRED
)

mark_as_advanced(LIBZ_LIBRARY)

add_library(libz_libz STATIC IMPORTED GLOBAL)
add_library(libz::libz ALIAS libz_libz)

set_target_properties(libz_libz PROPERTIES
IMPORTED_LOCATION "${LIBZ_LIBRARY}"
)
7 changes: 6 additions & 1 deletion src/cmake/FindTier0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ elseif(OS_LINUX OR OS_MACOS)
)
endif()

set_target_properties(tier0_tier0 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/public/tier0")
target_include_directories(tier0_tier0
INTERFACE
"${CMAKE_SOURCE_DIR}/common"
"${CMAKE_SOURCE_DIR}/public"
"${CMAKE_SOURCE_DIR}/public/tier0"
)
11 changes: 10 additions & 1 deletion src/cmake/FindTier2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@ add_library(tier2::tier2 ALIAS tier2_tier2)

set_target_properties(tier2_tier2 PROPERTIES
IMPORTED_LOCATION "${TIER2_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/public/tier2"
)

target_include_directories(tier2_tier2
INTERFACE
"${CMAKE_SOURCE_DIR}/public/tier2"
)

target_link_libraries(tier2_tier2
INTERFACE
tier1::tier1
)
11 changes: 10 additions & 1 deletion src/cmake/FindTier3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@ add_library(tier3::tier3 ALIAS tier3_tier3)

set_target_properties(tier3_tier3 PROPERTIES
IMPORTED_LOCATION "${TIER3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/public/tier3"
)

target_include_directories(tier3_tier3
INTERFACE
"${CMAKE_SOURCE_DIR}/public/tier3"
)

target_link_libraries(tier3_tier3
INTERFACE
tier2::tier2
)
5 changes: 4 additions & 1 deletion src/cmake/FindVSTDLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ elseif(OS_LINUX OR OS_MACOS)
)
endif()

set_target_properties(vstdlib_vstdlib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/public/vstdlib")
target_include_directories(vstdlib_vstdlib
INTERFACE
"${CMAKE_SOURCE_DIR}/public/vstdlib"
)
56 changes: 56 additions & 0 deletions src/fgdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
add_library(fgdlib STATIC)

add_library(fgdlib::fgdlib ALIAS fgdlib)

set_target_properties(fgdlib PROPERTIES PREFIX "")

target_include_directories(fgdlib
PRIVATE
${CMAKE_SOURCE_DIR}/utils/common
)

if(OS_WINDOWS)
target_compile_options(fgdlib
PRIVATE
/wd4091
/wd4316
/wd4355
/wd4577
/wd5033
/wd5054
/wd5055
)
elseif(OS_LINUX)

endif()

target_link_libraries(fgdlib
PRIVATE
tier1::tier1
mathlib::mathlib
)

target_sources_grouped(
TARGET fgdlib
NAME "Source Files"
FILES
gamedata.cpp
gdclass.cpp
gdvar.cpp
inputoutput.cpp
wckeyvalues.cpp
)

target_sources_grouped(
TARGET fgdlib
NAME "Header Files"
FILES
${CMAKE_SOURCE_DIR}/public/fgdlib/fgdlib.h
${CMAKE_SOURCE_DIR}/public/fgdlib/gamedata.h
${CMAKE_SOURCE_DIR}/public/fgdlib/gdclass.h
${CMAKE_SOURCE_DIR}/public/fgdlib/gdvar.h
${CMAKE_SOURCE_DIR}/public/fgdlib/helperinfo.h
${CMAKE_SOURCE_DIR}/public/fgdlib/ieditortexture.h
${CMAKE_SOURCE_DIR}/public/fgdlib/inputoutput.h
${CMAKE_SOURCE_DIR}/public/fgdlib/wckeyvalues.h
)
16 changes: 10 additions & 6 deletions src/fgdlib/gamedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
//
//=============================================================================

#ifdef WIN32
#include <windows.h>
#include <tier0/dbg.h>
#include <io.h>
#include <WorldSize.h>
#include "fgdlib/GameData.h"
#include "fgdlib/HelperInfo.h"
#endif

#include <tier0/dbg.h>
#include <worldsize.h>
#include "fgdlib/gamedata.h"
#include "fgdlib/helperinfo.h"
#include "KeyValues.h"
#include "filesystem_tools.h"
#include "tier1/strtools.h"
Expand All @@ -24,6 +27,7 @@ const int MAX_ERRORS = 5;

static GameDataMessageFunc_t g_pMsgFunc = NULL;

extern IFileSystem *g_pFullFileSystem;

//-----------------------------------------------------------------------------
// Sets the function used for emitting error messages while loading gamedata files.
Expand Down Expand Up @@ -88,7 +92,7 @@ static bool DoGetToken(TokenReader &tr, char **ppszStore, int nSize, trtoken_t t
// We didn't get the expected token type but no expected
// string was specified.
//
char *pszTokenName;
const char *pszTokenName;
switch (ttexpecting)
{
case IDENT:
Expand Down Expand Up @@ -280,7 +284,7 @@ BOOL GameData::Load(const char *pszFilename)
{
TokenReader tr;

if(GetFileAttributes(pszFilename) == 0xffffffff)
if(!g_pFullFileSystem->FileExists( pszFilename )) // TODO check if works correctly
return FALSE;

if(!tr.Open(pszFilename))
Expand Down
4 changes: 2 additions & 2 deletions src/fgdlib/gdclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//=============================================================================

#include "fgdlib/GameData.h" // FGDLIB: eliminate dependency
#include "fgdlib/GDClass.h"
#include "fgdlib/gamedata.h" // FGDLIB: eliminate dependency
#include "fgdlib/gdclass.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
Expand Down
8 changes: 4 additions & 4 deletions src/fgdlib/gdvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//=============================================================================

#include "fgdlib/fgdlib.h"
#include "fgdlib/GameData.h"
#include "fgdlib/WCKeyValues.h"
#include "fgdlib/gamedata.h"
#include "fgdlib/wckeyvalues.h"
#include "fgdlib/gdvar.h"

#ifdef _WIN32
Expand All @@ -18,7 +18,7 @@
typedef struct
{
GDIV_TYPE eType; // The enumeration of this type.
char *pszName; // The name of this type.
const char *pszName; // The name of this type.
trtoken_t eStoreAs; // How this type is stored (STRING, INTEGER, etc).
} TypeMap_t;

Expand Down Expand Up @@ -64,7 +64,7 @@ static TypeMap_t TypeMap[] =
};


char *GDinputvariable::m_pszEmpty = "";
const char *GDinputvariable::m_pszEmpty = "";


//-----------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/fgdlib/inputoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


#include <tier0/dbg.h>
#include "fgdlib/InputOutput.h"
#include "fgdlib/inputoutput.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
Expand All @@ -15,11 +15,11 @@
typedef struct
{
InputOutputType_t eType; // The enumeration of this type.
char *pszName; // The name of this type.
const char *pszName; // The name of this type.
} TypeMap_t;


char *CClassInputOutputBase::g_pszEmpty = "";
const char *CClassInputOutputBase::g_pszEmpty = "";


//-----------------------------------------------------------------------------
Expand Down
Loading
Loading