From a29d5b502cd10ec6c9dd3985cb7173b36c312775 Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Mon, 28 Jun 2021 19:49:52 -0500 Subject: [PATCH] build script tweaks added support for MODULE_GAME, MODULE_CGAME, and MODULE_UI preprocessor defs to identify module in code --- build/msvc_2019/cgame.vcxproj | 8 +++--- build/msvc_2019/game.vcxproj | 8 +++--- build/msvc_2019/ui.vcxproj | 11 +++++---- build/msvc_2019/ui.vcxproj.filters | 5 +++- build/premake/premake5.lua | 39 ++++++++++++++---------------- build/qvm_build/build_cgame.bat | 2 +- build/qvm_build/build_game.bat | 2 +- build/qvm_build/build_ui.bat | 2 +- 8 files changed, 39 insertions(+), 38 deletions(-) diff --git a/build/msvc_2019/cgame.vcxproj b/build/msvc_2019/cgame.vcxproj index 4a9b404..1ad67a5 100644 --- a/build/msvc_2019/cgame.vcxproj +++ b/build/msvc_2019/cgame.vcxproj @@ -113,7 +113,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_CGAME;%(PreprocessorDefinitions) ..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -128,7 +128,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_CGAME;%(PreprocessorDefinitions) ..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -143,7 +143,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_CGAME;%(PreprocessorDefinitions) ..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories) Full true @@ -162,7 +162,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_CGAME;%(PreprocessorDefinitions) ..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories) Full true diff --git a/build/msvc_2019/game.vcxproj b/build/msvc_2019/game.vcxproj index 675a15b..dd3eadb 100644 --- a/build/msvc_2019/game.vcxproj +++ b/build/msvc_2019/game.vcxproj @@ -113,7 +113,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_GAME;%(PreprocessorDefinitions) ..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -128,7 +128,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_GAME;%(PreprocessorDefinitions) ..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -143,7 +143,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_GAME;%(PreprocessorDefinitions) ..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories) Full true @@ -162,7 +162,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_GAME;%(PreprocessorDefinitions) ..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories) Full true diff --git a/build/msvc_2019/ui.vcxproj b/build/msvc_2019/ui.vcxproj index 7475b56..4adbe3f 100644 --- a/build/msvc_2019/ui.vcxproj +++ b/build/msvc_2019/ui.vcxproj @@ -113,7 +113,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_UI;%(PreprocessorDefinitions) ..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -128,7 +128,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_UI;%(PreprocessorDefinitions) ..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories) EditAndContinue Disabled @@ -143,7 +143,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_UI;%(PreprocessorDefinitions) ..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories) Full true @@ -162,7 +162,7 @@ NotUsing Level3 - _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_UI;%(PreprocessorDefinitions) ..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories) Full true @@ -178,7 +178,8 @@ - + + diff --git a/build/msvc_2019/ui.vcxproj.filters b/build/msvc_2019/ui.vcxproj.filters index c9c9269..6a5a43f 100644 --- a/build/msvc_2019/ui.vcxproj.filters +++ b/build/msvc_2019/ui.vcxproj.filters @@ -9,7 +9,10 @@ - + + common + + common diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index 5dd6abb..23e2f45 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -22,50 +22,47 @@ workspace "StefGame" optimize "On" project "game" - files { "../../code/game/*.h", - "../../code/game/*.c", - "../../code/common/*.h", - "../../code/common/*.c" } - + files { "../../code/game/**.h", + "../../code/game/**.c", + "../../code/common/**.h", + "../../code/common/**.c" } removefiles { "../../code/common/bg_lib.*" } + defines { "MODULE_GAME" } includedirs { "../../code/game", "../../code/common" } targetname "qagamex86" - filter "platforms:Win64" targetname "qagamex86_64" project "cgame" - files { "../../code/cgame/*.h", - "../../code/cgame/*.c", - "../../code/common/*.h", - "../../code/common/*.c" } - + files { "../../code/cgame/**.h", + "../../code/cgame/**.c", + "../../code/common/**.h", + "../../code/common/**.c" } removefiles { "../../code/common/bg_lib.*" } + defines { "MODULE_CGAME" } includedirs { "../../code/cgame", "../../code/common" } targetname "cgamex86" - filter "platforms:Win64" targetname "cgamex86_64" project "ui" - files { "../../code/ui/*.h", - "../../code/ui/*.c", - "../../code/common/bg_misc.c", - "../../code/common/q_math.c", - "../../code/common/q_shared.c", - "../../code/common/bg_public.h", - "../../code/common/tr_types.h" } - + files { "../../code/ui/**.h", + "../../code/ui/**.c", + "../../code/common/**.h", + "../../code/common/**.c" } + removefiles { "../../code/common/bg_*" } + files { "../../code/common/bg_misc.c" } + + defines { "MODULE_UI" } includedirs { "../../code/ui", "../../code/common" } targetname "uix86" - filter "platforms:Win64" targetname "uix86_64" diff --git a/build/qvm_build/build_cgame.bat b/build/qvm_build/build_cgame.bat index 39185e1..5233ab1 100644 --- a/build/qvm_build/build_cgame.bat +++ b/build/qvm_build/build_cgame.bat @@ -75,7 +75,7 @@ goto :eof :compile echo %src%\%name%.c -q3lcc.exe -o %module_temp%\%name%.asm -I%code_directory%\cgame -I%code_directory%\common %code_directory%\%src%\%name%.c +q3lcc.exe -o %module_temp%\%name%.asm -DMODULE_CGAME -I%code_directory%\cgame -I%code_directory%\common %code_directory%\%src%\%name%.c if errorlevel 1 echo Error compiling %src%\%name%.c&pause&exit >>%q3asm_file% echo %module_temp%\%name% goto :eof \ No newline at end of file diff --git a/build/qvm_build/build_game.bat b/build/qvm_build/build_game.bat index 81adffb..219bde8 100644 --- a/build/qvm_build/build_game.bat +++ b/build/qvm_build/build_game.bat @@ -72,7 +72,7 @@ goto :eof :compile echo %src%\%name%.c -q3lcc.exe -o %module_temp%\%name%.asm -I%code_directory%\game -I%code_directory%\common %code_directory%\%src%\%name%.c +q3lcc.exe -o %module_temp%\%name%.asm -DMODULE_GAME -I%code_directory%\game -I%code_directory%\common %code_directory%\%src%\%name%.c if errorlevel 1 echo Error compiling %src%\%name%.c&pause&exit >>%q3asm_file% echo %module_temp%\%name% goto :eof \ No newline at end of file diff --git a/build/qvm_build/build_ui.bat b/build/qvm_build/build_ui.bat index dc12287..d8390a5 100644 --- a/build/qvm_build/build_ui.bat +++ b/build/qvm_build/build_ui.bat @@ -74,7 +74,7 @@ goto :eof :compile echo %src%\%name%.c -q3lcc.exe -o %module_temp%\%name%.asm -I%code_directory%\ui -I%code_directory%\common %code_directory%\%src%\%name%.c +q3lcc.exe -o %module_temp%\%name%.asm -DMODULE_UI -I%code_directory%\ui -I%code_directory%\common %code_directory%\%src%\%name%.c if errorlevel 1 echo Error compiling %src%\%name%.c&pause&exit >>%q3asm_file% echo %module_temp%\%name% goto :eof \ No newline at end of file