Skip to content

Commit

Permalink
[hlc] Add jumbo build for vs template (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao authored Jan 15, 2025
1 parent 9ccfeaa commit d8b9dcd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 30 deletions.
14 changes: 11 additions & 3 deletions other/haxelib/Run.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Build {
tpl = "vs2015";
var srcDir = tpl;
var targetDir = config.defines.get("hlgen.makefilepath");
var jumboBuild = config.defines.get("hlgen.makefile.jumbo");
var relDir = "";
if( targetDir == null )
targetDir = this.targetDir;
Expand Down Expand Up @@ -125,15 +126,17 @@ class Build {
}
var content = sys.io.File.getContent(srcPath);
var tpl = new haxe.Template(content);
content = tpl.execute({
var context = {
name : this.name,
libraries : [for( l in config.libs ) if( l != "std" ) { name : l }],
files : files,
relDir : relDir,
directories : directories,
cfiles : [for( f in files ) if( StringTools.endsWith(f.path,".c") ) f],
hfiles : [for( f in files ) if( StringTools.endsWith(f.path,".h") ) f],
},{
jumboBuild : jumboBuild,
};
var macros = {
makeUID : function(_,s:String) {
var sha1 = haxe.crypto.Sha1.encode(s);
sha1 = sha1.toUpperCase();
Expand All @@ -147,7 +150,12 @@ class Build {
},
winPath : function(_,s:String) return s.split("/").join("\\"),
getEnv : function(_,s:String) return Sys.getEnv(s),
});
setDefaultJumboBuild: function(_, b:String) {
context.jumboBuild ??= b;
return "";
}
};
content = tpl.execute(context, macros);
var prevContent = try sys.io.File.getContent(targetPath) catch( e : Dynamic ) null;
if( prevContent != content )
sys.io.File.saveContent(targetPath, content);
Expand Down
23 changes: 14 additions & 9 deletions other/haxelib/templates/vs2015/__file__.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
$$setDefaultJumboBuild(true)<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -95,7 +95,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -115,7 +115,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -137,7 +137,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -161,7 +161,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -180,12 +180,17 @@
<ItemGroup>
<ClCompile Include="stdafx.c">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::
</ItemGroup>
</ClCompile>::if (jumboBuild == "true")::
<ClCompile Include="::relDir::::name::.c" />
<!--::end::::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::::if (jumboBuild == "true")::
-->::end::
</ItemGroup>::if (jumboBuild == "true")::
<!--::end::
<ItemGroup>::foreach hfiles::
<ClInclude Include="::relDir::::path::" />::end::
</ItemGroup>
</ItemGroup>::if (jumboBuild == "true")::
-->::end::
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
23 changes: 14 additions & 9 deletions other/haxelib/templates/vs2017/__file__.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
$$setDefaultJumboBuild(true)<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -97,7 +97,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -118,7 +118,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -141,7 +141,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -166,7 +166,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -185,12 +185,17 @@
<ItemGroup>
<ClCompile Include="stdafx.c">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::
</ItemGroup>
</ClCompile>::if (jumboBuild == "true")::
<ClCompile Include="::relDir::::name::.c" />
<!--::end::::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::::if (jumboBuild == "true")::
-->::end::
</ItemGroup>::if (jumboBuild == "true")::
<!--::end::
<ItemGroup>::foreach hfiles::
<ClInclude Include="::relDir::::path::" />::end::
</ItemGroup>
</ItemGroup>::if (jumboBuild == "true")::
-->::end::
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
23 changes: 14 additions & 9 deletions other/haxelib/templates/vs2019/__file__.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
$$setDefaultJumboBuild(true)<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -95,7 +95,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -116,7 +116,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -137,7 +137,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -158,7 +158,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand All @@ -177,12 +177,17 @@
<ItemGroup>
<ClCompile Include="stdafx.c">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::
</ItemGroup>
</ClCompile>::if (jumboBuild == "true")::
<ClCompile Include="::relDir::::name::.c" />
<!--::end::::foreach cfiles::
<ClCompile Include="::relDir::::path::" />::end::::if (jumboBuild == "true")::
-->::end::
</ItemGroup>::if (jumboBuild == "true")::
<!--::end::
<ItemGroup>::foreach hfiles::
<ClInclude Include="::relDir::::path::" />::end::
</ItemGroup>
</ItemGroup>::if (jumboBuild == "true")::
-->::end::
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down

0 comments on commit d8b9dcd

Please sign in to comment.