Skip to content

Commit

Permalink
build script tweaks
Browse files Browse the repository at this point in the history
added support for MODULE_GAME, MODULE_CGAME, and MODULE_UI preprocessor defs to identify module in code
  • Loading branch information
Chomenor committed Jun 29, 2021
1 parent 0306abd commit a29d5b5
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 38 deletions.
8 changes: 4 additions & 4 deletions build/msvc_2019/cgame.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_CGAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -128,7 +128,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_CGAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -143,7 +143,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_CGAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -162,7 +162,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_CGAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\cgame;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand Down
8 changes: 4 additions & 4 deletions build/msvc_2019/game.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_GAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -128,7 +128,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_GAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -143,7 +143,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_GAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -162,7 +162,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_GAME;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\game;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand Down
11 changes: 6 additions & 5 deletions build/msvc_2019/ui.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_UI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -128,7 +128,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;MODULE_UI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<Optimization>Disabled</Optimization>
Expand All @@ -143,7 +143,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_UI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -162,7 +162,7 @@
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;MODULE_UI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\code\ui;..\..\code\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -178,7 +178,8 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\code\common\bg_public.h" />
<ClInclude Include="..\..\code\common\q_shared.h" />
<ClInclude Include="..\..\code\common\surfaceflags.h" />
<ClInclude Include="..\..\code\common\tr_types.h" />
<ClInclude Include="..\..\code\ui\keycodes.h" />
<ClInclude Include="..\..\code\ui\stv_version.h" />
Expand Down
5 changes: 4 additions & 1 deletion build/msvc_2019/ui.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\code\common\bg_public.h">
<ClInclude Include="..\..\code\common\q_shared.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\..\code\common\surfaceflags.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\..\code\common\tr_types.h">
Expand Down
39 changes: 18 additions & 21 deletions build/premake/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion build/qvm_build/build_cgame.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build/qvm_build/build_game.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build/qvm_build/build_ui.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a29d5b5

Please sign in to comment.