From 01ef3fa595cceb6a4e045eff38191f6d6cf1cece Mon Sep 17 00:00:00 2001 From: Hugh Sanderson Date: Wed, 28 Aug 2024 17:52:46 +0800 Subject: [PATCH] Support name and value entries in flag specifications. --- toolchain/haxe-target.xml | 2 +- tools/hxcpp/BuildTool.hx | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/toolchain/haxe-target.xml b/toolchain/haxe-target.xml index 076dce221..cfff7ceeb 100644 --- a/toolchain/haxe-target.xml +++ b/toolchain/haxe-target.xml @@ -1,7 +1,7 @@ - + diff --git a/tools/hxcpp/BuildTool.hx b/tools/hxcpp/BuildTool.hx index cd809ff00..92be6063c 100644 --- a/tools/hxcpp/BuildTool.hx +++ b/tools/hxcpp/BuildTool.hx @@ -894,7 +894,11 @@ class BuildTool if (valid(el,"")) switch(el.name) { - case "flag" : c.addFlag(substitute(el.att.value), el.has.tag?substitute(el.att.tag):""); + case "flag" : + var tag = el.has.tag?substitute(el.att.tag):""; + if (el.has.name) + c.addFlag(substitute(el.att.name), tag); + c.addFlag(substitute(el.att.value), tag); case "cflag" : c.mCFlags.push(substitute(el.att.value)); case "cppflag" : c.mCPPFlags.push(substitute(el.att.value)); case "objcflag" : c.mOBJCFlags.push(substitute(el.att.value)); @@ -1090,7 +1094,10 @@ class BuildTool if (valid(el,"")) switch(el.name) { - case "flag" : l.mFlags.push(substitute(el.att.value)); + case "flag" : + if (el.has.name) + l.mFlags.push(substitute(el.att.name)); + l.mFlags.push(substitute(el.att.value)); case "ext" : l.mExt = (substitute(el.att.value)); case "outflag" : l.mOutFlag = (substitute(el.att.value)); case "libdir" : l.mLibDir = (substitute(el.att.name)); @@ -1150,9 +1157,10 @@ class BuildTool if (valid(el,"")) switch(el.name) { - case "flag" : s.mFlags.push(substitute(el.att.value)); - case "outPre" : s.mOutPre = substitute(el.att.value); - case "outPost" : s.mOutPost = substitute(el.att.value); + case "flag" : + if (el.has.name) + s.mFlags.push(substitute(el.att.name)); + s.mFlags.push(substitute(el.att.value)); case "exe" : s.mExe = substitute((el.att.name)); } } @@ -1160,7 +1168,6 @@ class BuildTool return s; } - public function createStripper(inXML:XmlAccess,inBase:Stripper):Stripper { var s = (inBase!=null && !inXML.has.replace) ? inBase : @@ -1170,7 +1177,10 @@ class BuildTool if (valid(el,"")) switch(el.name) { - case "flag" : s.mFlags.push(substitute(el.att.value)); + case "flag" : + if (el.has.name) + s.mFlags.push(substitute(el.att.name)); + s.mFlags.push(substitute(el.att.value)); case "exe" : s.mExe = substitute((el.att.name)); } } @@ -1238,7 +1248,10 @@ class BuildTool target.mLibs.push(lib); } - case "flag" : target.mFlags.push( substitute(el.att.value) ); + case "flag" : + if (el.has.name) + target.mFlags.push( substitute(el.att.name) ); + target.mFlags.push( substitute(el.att.value) ); case "depend" : target.mDepends.push( substitute(el.att.name) ); case "vflag" : target.mFlags.push( substitute(el.att.name) ); @@ -2334,7 +2347,7 @@ class BuildTool public function checkToolVersion(inVersion:String) { var ver = Std.parseInt(inVersion); - if (ver>4) + if (ver>5) Log.error("Your version of hxcpp.n is out-of-date. Please update by compiling 'haxe compile.hxml' in hxcpp/tools/hxcpp."); }