Skip to content

Commit

Permalink
Add some simple nasm support
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Aug 9, 2024
1 parent 8dc8020 commit 1260d89
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ class BuildTool
substitute(el.att.variable), substitute(el.att.target) );
case "options" : group.addOptions( substitute(el.att.name) );
case "config" : group.mConfig = substitute(el.att.name);
case "assembler" : group.mAssembler = substitute(el.att.name);
case "compilerflag" :
if (el.has.name)
group.addCompilerFlag( substitute(el.att.name) );
Expand Down
6 changes: 4 additions & 2 deletions tools/hxcpp/Compiler.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import haxe.crypto.Md5;
import haxe.io.Path;
import sys.FileSystem;
using StringTools;

private class FlagInfo
{
Expand Down Expand Up @@ -306,7 +307,8 @@ class Compiler
var args = getArgs(inFile);
var nvcc = inFile.isNvcc();
var asm = inFile.isAsm();
var exe = asm ? mAsmExe : nvcc ? BuildTool.getNvcc() : mExe;
var exe = asm ? inFile.getAsmExe(mAsmExe) : nvcc ? BuildTool.getNvcc() : mExe;
var nasm = asm && (exe.endsWith("nasm") || exe.endsWith("nasm.exe"));
var isRc = mRcExe!=null && inFile.isResource();
if (isRc)
exe = mRcExe;
Expand Down Expand Up @@ -368,7 +370,7 @@ class Compiler
args.push( (new Path( inFile.mDir + inFile.mName)).toString() );
}

var out = nvcc ? "-o " : mOutFlag;
var out = (nvcc||nasm) ? "-o " : mOutFlag;
if (out.substr(-1)==" ")
{
args.push(out.substr(0,out.length-1));
Expand Down
2 changes: 2 additions & 0 deletions tools/hxcpp/File.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class File

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

public function getAsmExe(compilerAsm:String) return mGroup.getAsmExe(compilerAsm);

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

public function keep(inDefines:Map<String,String>)
Expand Down
9 changes: 9 additions & 0 deletions tools/hxcpp/FileGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FileGroup
public var mCacheProject:String;
public var mTags:String;
public var mNvcc:Bool;
public var mAssembler:String;
public var mObjPrefix:String;

public function new(inDir:String,inId:String,inSetImportDir = false)
Expand Down Expand Up @@ -73,6 +74,14 @@ class FileGroup
return Lambda.exists(mFiles, function(file:File) { return true; } );
}

public function getAsmExe(compilerAsm:String)
{
if (mAssembler==null || mAssembler=="")
return compilerAsm;
return mAssembler;
}


public function filter(defines:Map<String,String>)
{
var newFiles = new Map<String, File>();
Expand Down

0 comments on commit 1260d89

Please sign in to comment.