diff --git a/README.md b/README.md index 8a201afe1..ac7d87a14 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,12 @@ shaders\fxc\sdk_screenspaceeffect_vs20.vcs 10.41 ``` +## Unity build + +By default, this project uses Unity Build to speed up compilation times. However, if you need to disable it for development +reasons, set the CMake options `NEO_UNITY_BUILD_CLIENT_SERVER` or `NEO_UNITY_BUILD_OTHERS` to `OFF`. This will disable +Unity Build for client/server libraries and vgui2/tier1/mathlib libraries, respectively. + ## Credits * [NeotokyoRevamp/neo](https://github.com/NeotokyoRevamp/neo) - Original fork source * [ValveSoftware/source-sdk-2013](https://github.com/ValveSoftware/source-sdk-2013) - Source SDK 2013 (2025 TF2 SDK Update) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd36b5686..5bda91539 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,6 +53,8 @@ option(NEO_ENABLE_CPACK "Enable CPack" OFF) option(NEO_USE_MEM_DEBUG "Enable USE_MEM_DEBUG defines" OFF) option(NEO_GENERATE_GAMEDATA "Generate SourceMod gamedata" ${NEO_DEDICATED}) option(NEO_BUILD_LAUNCHER "Build the Steam mod launcher" ON) +option(NEO_UNITY_BUILD_CLIENT_SERVER "Enable unity build for client/server libraries" ON) +option(NEO_UNITY_BUILD_OTHERS "Enable unity build for vgui2, tier1, and mathlib libraries" ON) set(NEO_MOD_APPID "3172910" CACHE STRING "Steam appid for the mod launcher's steam_appid.txt") message(STATUS "Treat compile warnings as errors: ${CMAKE_COMPILE_WARNING_AS_ERROR}") @@ -80,8 +82,20 @@ message(STATUS "Use separate build info on Linux: ${NEO_USE_SEPARATE_BUILD_INFO} message(STATUS "Enable CPack: ${NEO_ENABLE_CPACK}") message(STATUS "Build the Steam mod launcher: ${NEO_BUILD_LAUNCHER}") message(STATUS "Mod launcher appid override: ${NEO_MOD_APPID}") +message(STATUS "Enable unity build for client/server libraries (NEO_UNITY_BUILD_CLIENT_SERVER): ${NEO_UNITY_BUILD_CLIENT_SERVER}") +message(STATUS "Enable unity build for vgui2, tier1, and mathlib libraries (NEO_UNITY_BUILD_OTHERS): ${NEO_UNITY_BUILD_OTHERS}") message("") +set(UNITY_BUILD_DEF_OTHERS) +if (NEO_UNITY_BUILD_OTHERS) + set(UNITY_BUILD_DEF_OTHERS NEO_UNITY) +endif () + +set(UNITY_BUILD_DEF_CLIENT_SERVER) +if (NEO_UNITY_BUILD_CLIENT_SERVER) + set(UNITY_BUILD_DEF_CLIENT_SERVER NEO_UNITY) +endif () + if(NEO_COPY_LIBRARIES) file(MAKE_DIRECTORY "${NEO_OUTPUT_LIBRARY_PATH}") endif() diff --git a/src/game/client/CMakeLists.txt b/src/game/client/CMakeLists.txt index 9273ef749..7fbb698e4 100644 --- a/src/game/client/CMakeLists.txt +++ b/src/game/client/CMakeLists.txt @@ -2,7 +2,7 @@ add_library(client SHARED) set_target_properties(client PROPERTIES PREFIX "" - UNITY_BUILD ON + UNITY_BUILD ${NEO_UNITY_BUILD_CLIENT_SERVER} UNITY_BUILD_MODE GROUP ) @@ -49,6 +49,7 @@ target_compile_definitions(client VECTOR VERSION_SAFE_STEAM_API_INTERFACES NEXT_BOT + ${UNITY_BUILD_DEF_CLIENT_SERVER} ) target_link_libraries(client diff --git a/src/game/client/neo/c_neo_killer_damage_infos.cpp b/src/game/client/neo/c_neo_killer_damage_infos.cpp index a8c183ce8..a60b5c26b 100644 --- a/src/game/client/neo/c_neo_killer_damage_infos.cpp +++ b/src/game/client/neo/c_neo_killer_damage_infos.cpp @@ -2,6 +2,8 @@ #include #include "strtools.h" +#include "vgui/ILocalize.h" +#include "tier3/tier3.h" #include "c_neo_player.h" #include "neo_gamerules.h" diff --git a/src/game/client/neo/ui/neo_hud_killer_info.cpp b/src/game/client/neo/ui/neo_hud_killer_info.cpp index 1da827597..953e1032c 100644 --- a/src/game/client/neo/ui/neo_hud_killer_info.cpp +++ b/src/game/client/neo/ui/neo_hud_killer_info.cpp @@ -7,6 +7,7 @@ #include "c_neo_player.h" #include "neo_gamerules.h" #include "vgui/ILocalize.h" +#include "ui/neo_theme.h" #include "inputsystem/iinputsystem.h" #include "IGameUIFuncs.h" #include "igamesystem.h" diff --git a/src/game/client/viewpostprocess.cpp b/src/game/client/viewpostprocess.cpp index c6bcb2713..d0793cabd 100644 --- a/src/game/client/viewpostprocess.cpp +++ b/src/game/client/viewpostprocess.cpp @@ -87,7 +87,7 @@ ConVar mat_tonemap_algorithm( "mat_tonemap_algorithm", "1", FCVAR_CHEAT, "0 = Or ConVar mat_tonemap_percent_target( "mat_tonemap_percent_target", "60.0", FCVAR_CHEAT ); ConVar mat_tonemap_percent_bright_pixels( "mat_tonemap_percent_bright_pixels", "2.0", FCVAR_CHEAT ); ConVar mat_tonemap_min_avglum( "mat_tonemap_min_avglum", "3.0", FCVAR_CHEAT ); -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build extern ConVar mat_fullbright; #else ConVar mat_fullbright( "mat_fullbright", "0", FCVAR_CHEAT ); diff --git a/src/game/server/CMakeLists.txt b/src/game/server/CMakeLists.txt index da026598c..eb9a89088 100644 --- a/src/game/server/CMakeLists.txt +++ b/src/game/server/CMakeLists.txt @@ -2,7 +2,7 @@ add_library(server SHARED) set_target_properties(server PROPERTIES PREFIX "" - UNITY_BUILD ON + UNITY_BUILD ${NEO_UNITY_BUILD_CLIENT_SERVER} UNITY_BUILD_MODE GROUP ) @@ -65,6 +65,7 @@ target_compile_definitions(server sprintf=use_Q_snprintf_instead_of_sprintf strncpy=use_Q_strncpy_instead NEXT_BOT + ${UNITY_BUILD_DEF_CLIENT_SERVER} ) target_link_libraries(server diff --git a/src/game/server/NextBot/Player/NextBotPlayerLocomotion.cpp b/src/game/server/NextBot/Player/NextBotPlayerLocomotion.cpp index d3f71e934..012a7afdb 100644 --- a/src/game/server/NextBot/Player/NextBotPlayerLocomotion.cpp +++ b/src/game/server/NextBot/Player/NextBotPlayerLocomotion.cpp @@ -10,6 +10,7 @@ #include "NextBotUtil.h" #include "NextBotPlayer.h" #include "NextBotPlayerLocomotion.h" +#include "bot/neo_bot.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" diff --git a/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp b/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp index 02bdd2a77..77ff22516 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp +++ b/src/game/server/neo/bot/behavior/neo_bot_command_follow.cpp @@ -3,6 +3,7 @@ #include "bot/neo_bot.h" #include "bot/behavior/neo_bot_command_follow.h" #include "bot/behavior/neo_bot_throw_weapon_at_player.h" +#include "bot/behavior/neo_bot_attack.h" #include "nav_mesh.h" // memdbgon must be the last include file in a .cpp file!!! diff --git a/src/game/server/neo/bot/behavior/neo_bot_ctg_enemy.h b/src/game/server/neo/bot/behavior/neo_bot_ctg_enemy.h index 152cad945..8ae07df41 100644 --- a/src/game/server/neo/bot/behavior/neo_bot_ctg_enemy.h +++ b/src/game/server/neo/bot/behavior/neo_bot_ctg_enemy.h @@ -2,6 +2,7 @@ #define NEO_BOT_CTG_ENEMY_H #include "bot/neo_bot.h" +#include "Path/NextBotChasePath.h" //-------------------------------------------------------------------------------------------------------- class CNEOBotCtgEnemy : public Action< CNEOBot > diff --git a/src/mathlib/CMakeLists.txt b/src/mathlib/CMakeLists.txt index 4856db472..2ef34cea7 100644 --- a/src/mathlib/CMakeLists.txt +++ b/src/mathlib/CMakeLists.txt @@ -4,7 +4,7 @@ add_library(mathlib::mathlib ALIAS mathlib) set_target_properties(mathlib PROPERTIES PREFIX "" - UNITY_BUILD ON + UNITY_BUILD ${NEO_UNITY_BUILD_OTHERS} UNITY_BUILD_MODE GROUP ) @@ -18,7 +18,8 @@ target_include_directories(mathlib target_compile_definitions(mathlib PRIVATE - MATHLIB_LIB + MATHLIB_LIB + ${UNITY_BUILD_DEF_OTHERS} ) target_link_libraries(mathlib diff --git a/src/tier1/CMakeLists.txt b/src/tier1/CMakeLists.txt index 395eb3598..66a80d16e 100644 --- a/src/tier1/CMakeLists.txt +++ b/src/tier1/CMakeLists.txt @@ -2,14 +2,18 @@ add_library(tier1 STATIC) add_library(tier1::tier1 ALIAS tier1) -target_compile_definitions(tier1 PRIVATE TIER1_STATIC_LIB) +target_compile_definitions(tier1 + PRIVATE + TIER1_STATIC_LIB + ${UNITY_BUILD_DEF_OTHERS} +) set(unity_before [[ #include "tier0/memdbgoff.h" ]]) set_target_properties(tier1 PROPERTIES - UNITY_BUILD ON + UNITY_BUILD ${NEO_UNITY_BUILD_OTHERS} UNITY_BUILD_MODE GROUP UNITY_BUILD_CODE_BEFORE_INCLUDE "${unity_before}" ) diff --git a/src/vgui2/vgui_controls/CMakeLists.txt b/src/vgui2/vgui_controls/CMakeLists.txt index 94be59dce..bc59ab0c6 100644 --- a/src/vgui2/vgui_controls/CMakeLists.txt +++ b/src/vgui2/vgui_controls/CMakeLists.txt @@ -4,10 +4,15 @@ add_library(vgui_controls::vgui_controls ALIAS vgui_controls) set_target_properties(vgui_controls PROPERTIES PREFIX "" - UNITY_BUILD ON + UNITY_BUILD ${NEO_UNITY_BUILD_OTHERS} UNITY_BUILD_MODE GROUP ) +target_compile_definitions(vgui_controls + PRIVATE + ${UNITY_BUILD_DEF_OTHERS} +) + target_include_directories(vgui_controls PRIVATE ${CMAKE_SOURCE_DIR}/common diff --git a/src/vgui2/vgui_controls/FileOpenDialog.cpp b/src/vgui2/vgui_controls/FileOpenDialog.cpp index a7c36310a..4a5d89e05 100644 --- a/src/vgui2/vgui_controls/FileOpenDialog.cpp +++ b/src/vgui2/vgui_controls/FileOpenDialog.cpp @@ -47,7 +47,7 @@ #include #include #include -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -63,7 +63,7 @@ using namespace vgui; static int s_nLastSortColumn = 0; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static int ListFileNameSortFunc([[maybe_unused]] ListPanel *pPanel, const ListPanelItem &item1, const ListPanelItem &item2 ) { bool dir1 = item1.kv->GetInt("directory") == 1; @@ -180,7 +180,7 @@ static int ListBaseInteger64SortFunc(ListPanel *pPanel, const ListPanelItem &ite return ( i1 < i2 ) ? -1 : 1; } -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static int ListFileSizeSortFunc(ListPanel *pPanel, const ListPanelItem &item1, const ListPanelItem &item2 ) { return ListBaseIntegerSortFunc( pPanel, item1, item2, "filesizeint" ); @@ -197,7 +197,7 @@ static int ListFileCreatedSortFunc(ListPanel *pPanel, const ListPanelItem &item1 // NOTE: Backward order to get most recent files first return ListBaseInteger64SortFunc( pPanel, item2, item1, "createdint_low", "createdint_high" ); } -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static int ListFileAttributesSortFunc(ListPanel *pPanel, const ListPanelItem &item1, const ListPanelItem &item2 ) { return ListBaseStringSortFunc( pPanel, item1, item2, "attributes" ); @@ -469,7 +469,7 @@ void FileCompletionEdit::OnMenuItemHighlight( int itemID ) //----------------------------------------------------------------------------- static CUtlDict< CUtlString, unsigned short > s_StartDirContexts; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build struct ColumnInfo_t { char const *columnName; diff --git a/src/vgui2/vgui_controls/KeyBindingHelpDialog.cpp b/src/vgui2/vgui_controls/KeyBindingHelpDialog.cpp index 993354121..76f8cef70 100644 --- a/src/vgui2/vgui_controls/KeyBindingHelpDialog.cpp +++ b/src/vgui2/vgui_controls/KeyBindingHelpDialog.cpp @@ -15,7 +15,7 @@ #include "vgui/Cursor.h" #include "tier1/utldict.h" #include "vgui_controls/KeyBoardEditorDialog.h" -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -28,7 +28,7 @@ using namespace vgui; // If the user holds the key bound to help down for this long, then the dialog will stay on automatically #define KB_HELP_CONTINUE_SHOWING_TIME 1.0 -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static bool BindingLessFunc( KeyValues * const & lhs, KeyValues * const &rhs ) { KeyValues *p1, *p2; diff --git a/src/vgui2/vgui_controls/KeyBoardEditorDialog.cpp b/src/vgui2/vgui_controls/KeyBoardEditorDialog.cpp index c4d0f4516..6c6974c8a 100644 --- a/src/vgui2/vgui_controls/KeyBoardEditorDialog.cpp +++ b/src/vgui2/vgui_controls/KeyBoardEditorDialog.cpp @@ -15,7 +15,7 @@ #include "KeyValues.h" #include "vgui/Cursor.h" #include "tier1/utldict.h" -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -25,7 +25,7 @@ using namespace vgui; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static char *CopyString( const char *in ) { if ( !in ) @@ -554,7 +554,7 @@ void CKeyBoardEditorPage::GetMappingList( Panel *panel, CUtlVector< PanelKeyBind } } -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static bool BindingLessFunc( KeyValues * const & lhs, KeyValues * const &rhs ) { KeyValues *p1, *p2; diff --git a/src/vgui2/vgui_controls/ListPanel.cpp b/src/vgui2/vgui_controls/ListPanel.cpp index c281ece62..f8e16bbf7 100644 --- a/src/vgui2/vgui_controls/ListPanel.cpp +++ b/src/vgui2/vgui_controls/ListPanel.cpp @@ -31,7 +31,7 @@ #include #include #include -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -39,7 +39,7 @@ #include "tier0/memdbgon.h" using namespace vgui; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build enum { WINDOW_BORDER_WIDTH=2 // the width of the window's border diff --git a/src/vgui2/vgui_controls/ListViewPanel.cpp b/src/vgui2/vgui_controls/ListViewPanel.cpp index 51ae830df..05ba0347d 100644 --- a/src/vgui2/vgui_controls/ListViewPanel.cpp +++ b/src/vgui2/vgui_controls/ListViewPanel.cpp @@ -24,7 +24,7 @@ #include #include #include -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -32,7 +32,7 @@ #include using namespace vgui; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build enum { WINDOW_BORDER_WIDTH=2 // the width of the window's border diff --git a/src/vgui2/vgui_controls/Panel.cpp b/src/vgui2/vgui_controls/Panel.cpp index 354e0ce0d..7fd3a2030 100644 --- a/src/vgui2/vgui_controls/Panel.cpp +++ b/src/vgui2/vgui_controls/Panel.cpp @@ -44,7 +44,7 @@ #include "tier0/vprof.h" -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -72,7 +72,7 @@ COMPILE_TIME_ASSERT( Panel::PIN_LAST == ARRAYSIZE( g_PinCornerStrings ) ); extern int GetBuildModeDialogCount(); -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static char *CopyString( const char *in ) { if ( !in ) diff --git a/src/vgui2/vgui_controls/PerforceFileList.cpp b/src/vgui2/vgui_controls/PerforceFileList.cpp index 09cf2d65f..67a8a97ac 100644 --- a/src/vgui2/vgui_controls/PerforceFileList.cpp +++ b/src/vgui2/vgui_controls/PerforceFileList.cpp @@ -14,7 +14,7 @@ #include "filesystem.h" #include "p4lib/ip4.h" #include "tier2/tier2.h" -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -25,7 +25,7 @@ using namespace vgui; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build static int ListFileNameSortFunc([[maybe_unused]] ListPanel *pPanel, const ListPanelItem &item1, const ListPanelItem &item2 ) { bool dir1 = item1.kv->GetInt("directory") == 1; @@ -133,7 +133,7 @@ static int ListFileTypeSortFunc(ListPanel *pPanel, const ListPanelItem &item1, c //----------------------------------------------------------------------------- // Dictionary of start dir contexts //----------------------------------------------------------------------------- -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build struct ColumnInfo_t { char const *columnName; diff --git a/src/vgui2/vgui_controls/PropertyDialog.cpp b/src/vgui2/vgui_controls/PropertyDialog.cpp index eb11c9897..381ab191e 100644 --- a/src/vgui2/vgui_controls/PropertyDialog.cpp +++ b/src/vgui2/vgui_controls/PropertyDialog.cpp @@ -60,7 +60,7 @@ PropertyDialog::~PropertyDialog() // Purpose: Returns a pointer to the PropertySheet this dialog encapsulates // Output : PropertySheet * //----------------------------------------------------------------------------- -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build vgui::PropertySheet *PropertyDialog::GetPropertySheet() #else PropertySheet *PropertyDialog::GetPropertySheet() diff --git a/src/vgui2/vgui_controls/ToolWindow.cpp b/src/vgui2/vgui_controls/ToolWindow.cpp index 092c0c40f..c584f54ba 100644 --- a/src/vgui2/vgui_controls/ToolWindow.cpp +++ b/src/vgui2/vgui_controls/ToolWindow.cpp @@ -108,7 +108,7 @@ bool ToolWindow::IsDraggableTabContainer() const // Purpose: Returns a pointer to the PropertySheet this dialog encapsulates // Output : PropertySheet * //----------------------------------------------------------------------------- -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build vgui::PropertySheet *ToolWindow::GetPropertySheet() #else PropertySheet *ToolWindow::GetPropertySheet() diff --git a/src/vgui2/vgui_controls/TreeView.cpp b/src/vgui2/vgui_controls/TreeView.cpp index 937c4cd9d..0185d7b59 100644 --- a/src/vgui2/vgui_controls/TreeView.cpp +++ b/src/vgui2/vgui_controls/TreeView.cpp @@ -28,7 +28,7 @@ #include #include #include -#ifdef NEO // Unity build +#ifdef NEO_UNITY // Unity build #include "Common.h" #endif @@ -42,7 +42,7 @@ #endif using namespace vgui; -#ifndef NEO // Unity build +#ifndef NEO_UNITY // Unity build enum { WINDOW_BORDER_WIDTH=2 // the width of the window's border