From d8b9dcd8f76233cec8f6fe13855945013744ecec Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Wed, 15 Jan 2025 08:26:51 +0100 Subject: [PATCH] [hlc] Add jumbo build for vs template (#737) --- other/haxelib/Run.hx | 14 ++++++++--- .../haxelib/templates/vs2015/__file__.vcxproj | 23 +++++++++++-------- .../haxelib/templates/vs2017/__file__.vcxproj | 23 +++++++++++-------- .../haxelib/templates/vs2019/__file__.vcxproj | 23 +++++++++++-------- 4 files changed, 53 insertions(+), 30 deletions(-) diff --git a/other/haxelib/Run.hx b/other/haxelib/Run.hx index 6f0fe346f..aa30b646f 100644 --- a/other/haxelib/Run.hx +++ b/other/haxelib/Run.hx @@ -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; @@ -125,7 +126,7 @@ 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, @@ -133,7 +134,9 @@ class Build { 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(); @@ -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); diff --git a/other/haxelib/templates/vs2015/__file__.vcxproj b/other/haxelib/templates/vs2015/__file__.vcxproj index 46d4f8904..943589982 100644 --- a/other/haxelib/templates/vs2015/__file__.vcxproj +++ b/other/haxelib/templates/vs2015/__file__.vcxproj @@ -1,4 +1,4 @@ - +$$setDefaultJumboBuild(true) @@ -95,7 +95,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -115,7 +115,7 @@ Level3 Disabled - _DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + _DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -137,7 +137,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -161,7 +161,7 @@ MaxSpeed true true - NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -180,12 +180,17 @@ Create - ::foreach cfiles:: - ::end:: - + ::if (jumboBuild == "true"):: + + ::end:: + ::if (jumboBuild == "true"):: + ::end:: diff --git a/other/haxelib/templates/vs2017/__file__.vcxproj b/other/haxelib/templates/vs2017/__file__.vcxproj index 283fb14a5..7f5dff64a 100644 --- a/other/haxelib/templates/vs2017/__file__.vcxproj +++ b/other/haxelib/templates/vs2017/__file__.vcxproj @@ -1,4 +1,4 @@ - +$$setDefaultJumboBuild(true) @@ -97,7 +97,7 @@ Level3 Disabled true - WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -118,7 +118,7 @@ Level3 Disabled true - _DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + _DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -141,7 +141,7 @@ true true true - WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -166,7 +166,7 @@ true true true - NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -185,12 +185,17 @@ Create - ::foreach cfiles:: - ::end:: - + ::if (jumboBuild == "true"):: + + ::end:: + ::if (jumboBuild == "true"):: + ::end:: diff --git a/other/haxelib/templates/vs2019/__file__.vcxproj b/other/haxelib/templates/vs2019/__file__.vcxproj index 373be5454..9b78d2c08 100644 --- a/other/haxelib/templates/vs2019/__file__.vcxproj +++ b/other/haxelib/templates/vs2019/__file__.vcxproj @@ -1,4 +1,4 @@ - +$$setDefaultJumboBuild(true) @@ -95,7 +95,7 @@ Level3 Disabled true - WIN32;_DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -116,7 +116,7 @@ true true true - WIN32;NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -137,7 +137,7 @@ Level3 Disabled true - _DEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + _DEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -158,7 +158,7 @@ true true true - NDEBUG;_CONSOLE;HL_MAKE;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;::if (jumboBuild != "true")::HL_MAKE;::end::%(PreprocessorDefinitions) true $(IntDir)\%(RelativeDir) true @@ -177,12 +177,17 @@ Create - ::foreach cfiles:: - ::end:: - + ::if (jumboBuild == "true"):: + + ::end:: + ::if (jumboBuild == "true"):: + ::end::