Skip to content

Commit

Permalink
Add some basic .asm support
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Jul 31, 2024
1 parent 00913ef commit 8dc8020
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions toolchain/msvc-toolchain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
<flag value="-wd4996"/>
<outflag value="-Fo"/>
<ext value=".obj"/>
<asmExe value="ml64.exe" if="HXCPP_M64" />
<asmExe value="ml.exe" unless="HXCPP_M64" />
<objdir value="${MSVC_OBJ_DIR}" />

<rcexe name="rc.exe" />
Expand Down
2 changes: 2 additions & 0 deletions tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -900,13 +900,15 @@ class BuildTool
case "objcflag" : c.mOBJCFlags.push(substitute(el.att.value));
case "rcflag" : c.mRcFlags.push( substitute((el.att.value)) );
case "mmflag" : c.mMMFlags.push(substitute(el.att.value));
case "asmflag" : c.mAsmFlags.push(substitute(el.att.value));
case "pchflag" : c.mPCHFlags.push(substitute(el.att.value));
case "objdir" : c.mObjDir = substitute((el.att.value));
case "outflag" : c.mOutFlag = substitute((el.att.value));
case "exe" : c.mExe = substitute((el.att.name));
case "rcexe" : c.mRcExe = substitute((el.att.name));
case "rcext" : c.mRcExt = substitute((el.att.value));
case "ext" : c.mExt = substitute((el.att.value));
case "asmExe" : c.mAsmExe = substitute((el.att.value));
case "pch" : c.setPCH( substitute((el.att.value)) );
case "getversion" : c.mGetCompilerVersion = substitute((el.att.value));
case "section" : createCompiler(el,c);
Expand Down
15 changes: 12 additions & 3 deletions tools/hxcpp/Compiler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ class Compiler
public var mCPPFlags:Array<String>;
public var mOBJCFlags:Array<String>;
public var mPCHFlags:Array<String>;
public var mAsmFlags:Array<String>;
public var mAddGCCIdentity:Bool;
public var mExe:String;
public var mAsmExe:String;
public var mOutFlag:String;
public var mObjDir:String;
public var mRelObjDir:String;
Expand Down Expand Up @@ -72,12 +74,14 @@ class Compiler
mOBJCFlags = [];
mMMFlags = [];
mPCHFlags = [];
mAsmFlags = [];
mAddGCCIdentity = false;
mCompilerVersion = null;
mRcExt = ".res";
mObjDir = "obj";
mOutFlag = "-o";
mExe = inExe;
mAsmExe = inExe;
mID = inID;
mExt = ".o";
mPCHExt = ".pch";
Expand Down Expand Up @@ -172,12 +176,13 @@ class Compiler
function getArgs(inFile:File)
{
var nvcc = inFile.isNvcc();
var asm = inFile.isAsm();
var isRc = mRcExe!=null && inFile.isResource();
var args = nvcc ? inFile.mGroup.mCompilerFlags.concat( BuildTool.getNvccFlags() ) :
inFile.mCompilerFlags.concat(inFile.mGroup.mCompilerFlags);
var tagFilter = inFile.getTags().split(",");
addOptimTags(tagFilter);
if (!isRc)
if (!isRc && !asm)
for(flag in mFlags)
flag.add(args,tagFilter);
var ext = mExt.toLowerCase();
Expand All @@ -191,7 +196,10 @@ class Compiler
addIdentity(ext,args);

var allowPch = false;
if (nvcc)

if (asm)
args = args.concat(mAsmFlags);
else if (nvcc)
args = args.concat(mNvccFlags);
else if (isRc)
args = args.concat(mRcFlags);
Expand Down Expand Up @@ -297,7 +305,8 @@ class Compiler
var obj_name = getObjName(inFile);
var args = getArgs(inFile);
var nvcc = inFile.isNvcc();
var exe = nvcc ? BuildTool.getNvcc() : mExe;
var asm = inFile.isAsm();
var exe = asm ? mAsmExe : nvcc ? BuildTool.getNvcc() : mExe;
var isRc = mRcExe!=null && inFile.isResource();
if (isRc)
exe = mRcExe;
Expand Down
2 changes: 2 additions & 0 deletions tools/hxcpp/File.hx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class File

public function isNvcc() return mGroup.mNvcc;

public function isAsm() return mName.endsWith(".asm");

public function isResource() return mName.endsWith(".rc");

public function keep(inDefines:Map<String,String>)
Expand Down

0 comments on commit 8dc8020

Please sign in to comment.