Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class BuildTool

var to_be_compiled = new Array<File>();

var cached = useCache && mCompiler.createCompilerVersion(group);
var cached = useCache && mCompiler.createCompilerVersion();

var inList = new Array<Bool>();
var groupIsOutOfDate = mDirtyList.indexOf(group.mId)>=0 || mDirtyList.indexOf("all")>=0;
Expand Down
55 changes: 35 additions & 20 deletions tools/hxcpp/Compiler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ class Compiler
mAsmExe = inExe;
mID = inID;
mExt = ".o";
mPCHExt = ".pch";
mPCHCreate = "-Yc";
mPCHUse = "-Yu";
mPCHFilename = "/Fp";
mCached = false;
mRcFlags = [];
}
Expand Down Expand Up @@ -222,13 +218,16 @@ class Compiler
if (inFile.mGroup.isPrecompiled() && allowPch)
{
var pchDir = getPchDir(inFile.mGroup);
if (mPCHUse!="")
{
args.push(mPCHUse + inFile.mGroup.mPrecompiledHeader + ".h");
args.push(mPCHFilename + pchDir + "/" + inFile.mGroup.getPchName() + mPCHExt);
switch (mPCH) {
case "msvc":
args.push(mPCHUse + inFile.mGroup.mPrecompiledHeader + ".h");
args.push(mPCHFilename + pchDir + "/" + inFile.mGroup.getPchName() + mPCHExt);
case "gcc":
args.unshift("-I"+pchDir);
case "clang":
args.push("-include-pch");
args.push(pchDir + "/" + inFile.mGroup.getPchName() + mPCHExt);
}
else
args.unshift("-I"+pchDir);
}

return args;
Expand Down Expand Up @@ -442,7 +441,7 @@ class Compiler
return obj_name;
}

public function createCompilerVersion(inGroup:FileGroup)
public function createCompilerVersion()
{
if ( mCompilerVersion==null)
{
Expand Down Expand Up @@ -517,7 +516,7 @@ class Compiler

public function needsPchObj()
{
return mPCH!="gcc";
return mPCH == "msvc";
}

/*
Expand Down Expand Up @@ -568,7 +567,7 @@ class Compiler
if (inGroup.isCached() || inReuseIfPossible)
{
// No obj needed for gcc
var obj = mPCH=="gcc" ? null : PathManager.combine(dir, file + mExt);
var obj = mPCH=="msvc" ? PathManager.combine(dir, file + mExt) : null;
if (FileSystem.exists(pch_name) && (obj==null || FileSystem.exists(obj)) )
return obj;
}
Expand All @@ -579,7 +578,7 @@ class Compiler
//Log.info("", "Make pch dir " + dir );
PathManager.mkdir(dir);

if (mPCH!="gcc")
if (mPCH == "msvc")
{
args.push( mPCHCreate + header + ".h" );
var symbol = "link" + Md5.encode( PathManager.combine(dir, file + mExt) );
Expand Down Expand Up @@ -627,19 +626,35 @@ class Compiler
//throw "Error creating pch: " + result + " - build cancelled";
}

if (mPCH!="gcc")
if (mPCH == "msvc")
return PathManager.combine(dir, file + mExt);
return null;
}

public function setPCH(inPCH:String)
{
mPCH = inPCH;
if (mPCH=="gcc")
{
mPCHExt = ".h.gch";
mPCHUse = "";
mPCHFilename = "";
createCompilerVersion();
static final regex = ~/clang/i;
if (inPCH != null && regex.match(mCompilerVersionString)) {
mPCH = "clang";
}
switch (mPCH) {
case "gcc":
mPCHExt = ".h.gch";
mPCHUse = "";
mPCHFilename = "";
case "clang":
mPCHExt = ".h.pch";
mPCHUse = "";
mPCHFilename = "";
case "msvc":
mPCHExt = ".pch";
mPCHCreate = "-Yc";
mPCHUse = "-Yu";
mPCHFilename = "/Fp";
default:
mPCH = null;
}
}

Expand Down