mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Added target triple support for more useful cross compilation
This commit is contained in:
parent
22ec4a86b8
commit
3bf4c792d8
15 changed files with 145 additions and 124 deletions
|
@ -26,7 +26,7 @@ BF_IMPORT void BF_CALLTYPE Debugger_FullReportMemory();
|
||||||
|
|
||||||
BF_IMPORT void BF_CALLTYPE BfCompiler_Delete(void* bfCompiler);
|
BF_IMPORT void BF_CALLTYPE BfCompiler_Delete(void* bfCompiler);
|
||||||
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(void* bfCompiler, void* hotProject, int hotIdx,
|
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(void* bfCompiler, void* hotProject, int hotIdx,
|
||||||
int machineType, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
const char* targetTriple, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
||||||
Beefy::BfCompilerOptionFlags optionFlags, const char* mallocLinkName, const char* freeLinkName);
|
Beefy::BfCompilerOptionFlags optionFlags, const char* mallocLinkName, const char* freeLinkName);
|
||||||
BF_IMPORT void BF_CALLTYPE BfCompiler_ClearBuildCache(void* bfCompiler);
|
BF_IMPORT void BF_CALLTYPE BfCompiler_ClearBuildCache(void* bfCompiler);
|
||||||
BF_IMPORT bool BF_CALLTYPE BfCompiler_Compile(void* bfCompiler, void* bfPassInstance, const char* outputPath);
|
BF_IMPORT bool BF_CALLTYPE BfCompiler_Compile(void* bfCompiler, void* bfPassInstance, const char* outputPath);
|
||||||
|
@ -164,6 +164,14 @@ BootApp::BootApp()
|
||||||
#endif
|
#endif
|
||||||
mEmitIR = false;
|
mEmitIR = false;
|
||||||
|
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
|
mTargetTriple = "x86_64-pc-windows-msvc";
|
||||||
|
#elif defined BF_PLATFORM_OSX
|
||||||
|
mTargetTriple = "x86_64-apple-macosx10.14.0";
|
||||||
|
#else
|
||||||
|
mTargetTriple = "x86_64-unknown-linux-gnu";
|
||||||
|
#endif
|
||||||
|
|
||||||
GetConsoleColor(gConsoleFGColor, gConsoleBGColor);
|
GetConsoleColor(gConsoleFGColor, gConsoleBGColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,7 +837,7 @@ bool BootApp::Compile()
|
||||||
if (maxWorkerThreads <= 1)
|
if (maxWorkerThreads <= 1)
|
||||||
maxWorkerThreads = 6;
|
maxWorkerThreads = 6;
|
||||||
|
|
||||||
BfCompiler_SetOptions(mCompiler, NULL, 0, BfMachineType_x64, mToolset, BfSIMDSetting_SSE2, 1, maxWorkerThreads, optionFlags, "malloc", "free");
|
BfCompiler_SetOptions(mCompiler, NULL, 0, mTargetTriple.c_str(), mToolset, BfSIMDSetting_SSE2, 1, maxWorkerThreads, optionFlags, "malloc", "free");
|
||||||
|
|
||||||
if (mIsCERun)
|
if (mIsCERun)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
FileStream mLogFile;
|
FileStream mLogFile;
|
||||||
Verbosity mVerbosity;
|
Verbosity mVerbosity;
|
||||||
BfTargetType mTargetType;
|
BfTargetType mTargetType;
|
||||||
|
String mTargetTriple;
|
||||||
bool mHadCmdLine;
|
bool mHadCmdLine;
|
||||||
bool mShowedHelp;
|
bool mShowedHelp;
|
||||||
bool mHadErrors;
|
bool mHadErrors;
|
||||||
|
|
|
@ -276,7 +276,7 @@ namespace BeefBuild
|
||||||
let options = gApp.GetCurProjectOptions(mWorkspace.mStartupProject);
|
let options = gApp.GetCurProjectOptions(mWorkspace.mStartupProject);
|
||||||
let targetPaths = scope List<String>();
|
let targetPaths = scope List<String>();
|
||||||
defer ClearAndDeleteItems(targetPaths);
|
defer ClearAndDeleteItems(targetPaths);
|
||||||
this.[Friend]GetTargetPaths(mWorkspace.mStartupProject, workspaceOptions, options, targetPaths);
|
this.[Friend]GetTargetPaths(mWorkspace.mStartupProject, gApp.mPlatformName, workspaceOptions, options, targetPaths);
|
||||||
if (targetPaths.IsEmpty)
|
if (targetPaths.IsEmpty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1831,7 +1831,7 @@ BFP_EXPORT int64 BFP_CALLTYPE BfpFile_Seek(BfpFile* file, int64 offset, BfpFileS
|
||||||
whence = SEEK_CUR;
|
whence = SEEK_CUR;
|
||||||
else
|
else
|
||||||
whence = SEEK_END;
|
whence = SEEK_END;
|
||||||
return seek64(file->mHandle, offset, whence);
|
return lseek64(file->mHandle, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
BFP_EXPORT void BFP_CALLTYPE BfpFile_Truncate(BfpFile* file)
|
BFP_EXPORT void BFP_CALLTYPE BfpFile_Truncate(BfpFile* file)
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace IDE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
customCmd.Append("%exec ");
|
customCmd.Append("%exec ");
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, origCustomCmd, "custom command", customCmd);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, origCustomCmd, "custom command", customCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customCmd.IsWhiteSpace)
|
if (customCmd.IsWhiteSpace)
|
||||||
|
@ -203,7 +203,8 @@ namespace IDE
|
||||||
#if BF_PLATFORM_WINDOWS
|
#if BF_PLATFORM_WINDOWS
|
||||||
String[] mingwFiles;
|
String[] mingwFiles;
|
||||||
String fromDir;
|
String fromDir;
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
|
||||||
|
if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4)
|
||||||
{
|
{
|
||||||
fromDir = scope:: String(llvmDir, "i686-w64-mingw32/bin/");
|
fromDir = scope:: String(llvmDir, "i686-w64-mingw32/bin/");
|
||||||
mingwFiles = scope:: String[] { "libgcc_s_dw2-1.dll", "libstdc++-6.dll" };
|
mingwFiles = scope:: String[] { "libgcc_s_dw2-1.dll", "libstdc++-6.dll" };
|
||||||
|
@ -297,7 +298,7 @@ namespace IDE
|
||||||
|
|
||||||
if (workspaceOptions.mToolsetType == .GNU)
|
if (workspaceOptions.mToolsetType == .GNU)
|
||||||
{
|
{
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -310,7 +311,7 @@ namespace IDE
|
||||||
}
|
}
|
||||||
else // Microsoft
|
else // Microsoft
|
||||||
{
|
{
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4)
|
||||||
{
|
{
|
||||||
//linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
|
//linkLine.Append("-L\"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x86\" ");
|
||||||
for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
|
for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
|
||||||
|
@ -334,7 +335,7 @@ namespace IDE
|
||||||
if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
|
if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
|
||||||
{
|
{
|
||||||
var linkFlags = scope String();
|
var linkFlags = scope String();
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
||||||
linkLine.Append(linkFlags, " ");
|
linkLine.Append(linkFlags, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +385,7 @@ namespace IDE
|
||||||
if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
|
if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
|
||||||
{
|
{
|
||||||
outRt.Append("Beef", IDEApp.sRTVersionStr, "RT");
|
outRt.Append("Beef", IDEApp.sRTVersionStr, "RT");
|
||||||
outRt.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
|
outRt.Append((Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) ? "32" : "64");
|
||||||
switch (options.mBuildOptions.mBeefLibType)
|
switch (options.mBuildOptions.mBeefLibType)
|
||||||
{
|
{
|
||||||
case .Dynamic:
|
case .Dynamic:
|
||||||
|
@ -405,7 +406,7 @@ namespace IDE
|
||||||
if ((workspaceOptions.mEnableObjectDebugFlags) || (workspaceOptions.mAllocType == .Debug))
|
if ((workspaceOptions.mEnableObjectDebugFlags) || (workspaceOptions.mAllocType == .Debug))
|
||||||
{
|
{
|
||||||
outDbg.Append("Beef", IDEApp.sRTVersionStr, "Dbg");
|
outDbg.Append("Beef", IDEApp.sRTVersionStr, "Dbg");
|
||||||
outDbg.Append((workspaceOptions.mMachineType == .x86) ? "32" : "64");
|
outDbg.Append((Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) ? "32" : "64");
|
||||||
if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
|
if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
|
||||||
outDbg.Append("_d");
|
outDbg.Append("_d");
|
||||||
outDbg.Append(dynName ? ".dll" : ".lib");
|
outDbg.Append(dynName ? ".dll" : ".lib");
|
||||||
|
@ -436,6 +437,8 @@ namespace IDE
|
||||||
|
|
||||||
bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
||||||
{
|
{
|
||||||
|
bool is64Bit = Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 8;
|
||||||
|
|
||||||
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
|
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
|
||||||
IDEUtils.FixFilePath(llvmDir);
|
IDEUtils.FixFilePath(llvmDir);
|
||||||
llvmDir.Append("llvm/");
|
llvmDir.Append("llvm/");
|
||||||
|
@ -560,7 +563,7 @@ namespace IDE
|
||||||
{
|
{
|
||||||
let depProjectOptions = gApp.GetCurProjectOptions(depProject);
|
let depProjectOptions = gApp.GetCurProjectOptions(depProject);
|
||||||
var linkFlags = scope String();
|
var linkFlags = scope String();
|
||||||
gApp.ResolveConfigString(workspaceOptions, depProject, depProjectOptions, depProjectOptions.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, depProject, depProjectOptions, depProjectOptions.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
||||||
if (!linkFlags.IsWhiteSpace)
|
if (!linkFlags.IsWhiteSpace)
|
||||||
linkLine.Append(linkFlags, " ");
|
linkLine.Append(linkFlags, " ");
|
||||||
}
|
}
|
||||||
|
@ -602,7 +605,7 @@ namespace IDE
|
||||||
if (!minRTModName.IsEmpty)
|
if (!minRTModName.IsEmpty)
|
||||||
minRTModName.Insert(0, "_");
|
minRTModName.Insert(0, "_");
|
||||||
|
|
||||||
if (workspaceOptions.mMachineType == .x86)
|
if (!is64Bit)
|
||||||
linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib ");
|
linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib ");
|
||||||
else
|
else
|
||||||
linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib ");
|
linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib ");
|
||||||
|
@ -634,7 +637,7 @@ namespace IDE
|
||||||
else
|
else
|
||||||
linkLine.Append("-opt:noref ");
|
linkLine.Append("-opt:noref ");
|
||||||
|
|
||||||
if (workspaceOptions.mMachineType == .x86)
|
if (!is64Bit)
|
||||||
{
|
{
|
||||||
for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
|
for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths)
|
||||||
{
|
{
|
||||||
|
@ -660,7 +663,7 @@ namespace IDE
|
||||||
if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
|
if (options.mBuildOptions.mOtherLinkFlags.Length != 0)
|
||||||
{
|
{
|
||||||
var linkFlags = scope String();
|
var linkFlags = scope String();
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
|
||||||
linkLine.Append(linkFlags, " ");
|
linkLine.Append(linkFlags, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,7 +713,7 @@ namespace IDE
|
||||||
resOutPath.Append(projectBuildDir, "\\Resource.res");
|
resOutPath.Append(projectBuildDir, "\\Resource.res");
|
||||||
|
|
||||||
String iconPath = scope String();
|
String iconPath = scope String();
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, winOptions.mIconFile, "icon file", iconPath);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, winOptions.mIconFile, "icon file", iconPath);
|
||||||
|
|
||||||
// Generate resource
|
// Generate resource
|
||||||
Result<void> CreateResourceFile()
|
Result<void> CreateResourceFile()
|
||||||
|
@ -742,7 +745,7 @@ namespace IDE
|
||||||
}
|
}
|
||||||
|
|
||||||
String manifestPath = scope String();
|
String manifestPath = scope String();
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, winOptions.mManifestFile, "manifest file", manifestPath);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, winOptions.mManifestFile, "manifest file", manifestPath);
|
||||||
if (!manifestPath.IsWhiteSpace)
|
if (!manifestPath.IsWhiteSpace)
|
||||||
{
|
{
|
||||||
Path.GetAbsolutePath(scope String(manifestPath), project.mProjectDir, manifestPath..Clear());
|
Path.GetAbsolutePath(scope String(manifestPath), project.mProjectDir, manifestPath..Clear());
|
||||||
|
@ -766,7 +769,7 @@ namespace IDE
|
||||||
IDEUtils.AppendWithOptionalQuotes(linkLine, resOutPath);
|
IDEUtils.AppendWithOptionalQuotes(linkLine, resOutPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
let binPath = (workspaceOptions.mMachineType == .x86) ? gApp.mSettings.mVSSettings.mBin32Path : gApp.mSettings.mVSSettings.mBin64Path;
|
let binPath = (!is64Bit) ? gApp.mSettings.mVSSettings.mBin32Path : gApp.mSettings.mVSSettings.mBin64Path;
|
||||||
if (binPath.IsWhiteSpace)
|
if (binPath.IsWhiteSpace)
|
||||||
{
|
{
|
||||||
gApp.OutputErrorLine("Visual Studio tool path not configured. Check Visual Studio configuration in File\\Preferences\\Settings.");
|
gApp.OutputErrorLine("Visual Studio tool path not configured. Check Visual Studio configuration in File\\Preferences\\Settings.");
|
||||||
|
@ -876,10 +879,10 @@ namespace IDE
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, "target directory", outputDir);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, "target directory", outputDir);
|
||||||
Path.GetAbsolutePath(project.mProjectDir, outputDir, absOutputDir);
|
Path.GetAbsolutePath(project.mProjectDir, outputDir, absOutputDir);
|
||||||
outputDir = absOutputDir;
|
outputDir = absOutputDir;
|
||||||
gApp.ResolveConfigString(workspaceOptions, project, options, "$(TargetPath)", "target path", targetPath);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, "$(TargetPath)", "target path", targetPath);
|
||||||
}
|
}
|
||||||
IDEUtils.FixFilePath(targetPath);
|
IDEUtils.FixFilePath(targetPath);
|
||||||
if (!File.Exists(targetPath))
|
if (!File.Exists(targetPath))
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace IDE.Compiler
|
||||||
|
|
||||||
[StdCall, CLink]
|
[StdCall, CLink]
|
||||||
static extern void BfCompiler_SetOptions(void* bfCompiler,
|
static extern void BfCompiler_SetOptions(void* bfCompiler,
|
||||||
void* hotProject, int32 hotIdx, int32 machineType, int32 toolsetType, int32 simdSetting, int32 allocStackCount, int32 maxWorkerThreads,
|
void* hotProject, int32 hotIdx, char8* targetTriple, int32 toolsetType, int32 simdSetting, int32 allocStackCount, int32 maxWorkerThreads,
|
||||||
OptionFlags optionsFlags, char8* mallocName, char8* freeName);
|
OptionFlags optionsFlags, char8* mallocName, char8* freeName);
|
||||||
|
|
||||||
[StdCall, CLink]
|
[StdCall, CLink]
|
||||||
|
@ -240,12 +240,12 @@ namespace IDE.Compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOptions(BfProject hotProject, int32 hotIdx,
|
public void SetOptions(BfProject hotProject, int32 hotIdx,
|
||||||
int32 machineType, int32 toolsetType, int32 simdSetting, int32 allocStackCount, int32 maxWorkerThreads,
|
String targetTriple, int32 toolsetType, int32 simdSetting, int32 allocStackCount, int32 maxWorkerThreads,
|
||||||
OptionFlags optionFlags, String mallocFuncName, String freeFuncName)
|
OptionFlags optionFlags, String mallocFuncName, String freeFuncName)
|
||||||
{
|
{
|
||||||
BfCompiler_SetOptions(mNativeBfCompiler,
|
BfCompiler_SetOptions(mNativeBfCompiler,
|
||||||
(hotProject != null) ? hotProject.mNativeBfProject : null, hotIdx,
|
(hotProject != null) ? hotProject.mNativeBfProject : null, hotIdx,
|
||||||
machineType, toolsetType, simdSetting, allocStackCount, maxWorkerThreads, optionFlags, mallocFuncName, freeFuncName);
|
targetTriple, toolsetType, simdSetting, allocStackCount, maxWorkerThreads, optionFlags, mallocFuncName, freeFuncName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForceRebuild()
|
public void ForceRebuild()
|
||||||
|
@ -464,6 +464,8 @@ namespace IDE.Compiler
|
||||||
//Debug.WriteLine("HandleOptions");
|
//Debug.WriteLine("HandleOptions");
|
||||||
|
|
||||||
var options = IDEApp.sApp.GetCurWorkspaceOptions();
|
var options = IDEApp.sApp.GetCurWorkspaceOptions();
|
||||||
|
String targetTriple = scope .();
|
||||||
|
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, options.mToolsetType, targetTriple);
|
||||||
|
|
||||||
bool enableObjectDebugFlags = options.mEnableObjectDebugFlags;
|
bool enableObjectDebugFlags = options.mEnableObjectDebugFlags;
|
||||||
bool emitObjectAccessCheck = options.mEmitObjectAccessCheck && enableObjectDebugFlags;
|
bool emitObjectAccessCheck = options.mEmitObjectAccessCheck && enableObjectDebugFlags;
|
||||||
|
@ -527,7 +529,7 @@ namespace IDE.Compiler
|
||||||
//Debug.WriteLine("HandleOptions SetOptions:{0:X}", (int)optionFlags);
|
//Debug.WriteLine("HandleOptions SetOptions:{0:X}", (int)optionFlags);
|
||||||
|
|
||||||
SetOptions(hotBfProject, hotIdx,
|
SetOptions(hotBfProject, hotIdx,
|
||||||
(int32)options.mMachineType, (int32)options.mToolsetType, (int32)options.mBfSIMDSetting, (int32)options.mAllocStackTraceDepth, (int32)gApp.mSettings.mCompilerSettings.mWorkerThreads,
|
targetTriple, (int32)options.mToolsetType, (int32)options.mBfSIMDSetting, (int32)options.mAllocStackTraceDepth, (int32)gApp.mSettings.mCompilerSettings.mWorkerThreads,
|
||||||
optionFlags, mallocLinkName, freeLinkName);
|
optionFlags, mallocLinkName, freeLinkName);
|
||||||
|
|
||||||
if (!mIsResolveOnly)
|
if (!mIsResolveOnly)
|
||||||
|
|
|
@ -107,6 +107,9 @@ namespace IDE
|
||||||
#elif BF_PLATFORM_LINUX
|
#elif BF_PLATFORM_LINUX
|
||||||
public static readonly String sPlatform64Name = "Linux64";
|
public static readonly String sPlatform64Name = "Linux64";
|
||||||
public static readonly String sPlatform32Name = "Linux32";
|
public static readonly String sPlatform32Name = "Linux32";
|
||||||
|
#elif BF_PLATFORM_OSX
|
||||||
|
public static readonly String sPlatform64Name = "macOS";
|
||||||
|
public static readonly String sPlatform32Name = null;
|
||||||
#else
|
#else
|
||||||
public static readonly String sPlatform64Name = "Unknown64";
|
public static readonly String sPlatform64Name = "Unknown64";
|
||||||
public static readonly String sPlatform32Name = "Unknown32";
|
public static readonly String sPlatform32Name = "Unknown32";
|
||||||
|
@ -1859,7 +1862,7 @@ namespace IDE
|
||||||
if (!options.mDebugOptions.mCommand.IsWhiteSpace)
|
if (!options.mDebugOptions.mCommand.IsWhiteSpace)
|
||||||
{
|
{
|
||||||
String execCmd = scope .();
|
String execCmd = scope .();
|
||||||
ResolveConfigString(workspaceOptions, project, options, options.mDebugOptions.mCommand, "command", execCmd);
|
ResolveConfigString(mPlatformName, workspaceOptions, project, options, options.mDebugOptions.mCommand, "command", execCmd);
|
||||||
|
|
||||||
String initialDir = scope .();
|
String initialDir = scope .();
|
||||||
Path.GetDirectoryPath(execCmd, initialDir);
|
Path.GetDirectoryPath(execCmd, initialDir);
|
||||||
|
@ -2548,8 +2551,10 @@ namespace IDE
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> platforms = scope List<String>();
|
List<String> platforms = scope List<String>();
|
||||||
platforms.Add(IDEApp.sPlatform32Name);
|
if (IDEApp.sPlatform32Name != null)
|
||||||
platforms.Add(IDEApp.sPlatform64Name);
|
platforms.Add(IDEApp.sPlatform32Name);
|
||||||
|
if (IDEApp.sPlatform64Name != null)
|
||||||
|
platforms.Add(IDEApp.sPlatform64Name);
|
||||||
|
|
||||||
List<String> configs = scope List<String>();
|
List<String> configs = scope List<String>();
|
||||||
configs.Add("Debug");
|
configs.Add("Debug");
|
||||||
|
@ -6887,7 +6892,7 @@ namespace IDE
|
||||||
if (workspaceOptions.mAllowHotSwapping)
|
if (workspaceOptions.mAllowHotSwapping)
|
||||||
macroList.Add("BF_ALLOW_HOT_SWAPPING");
|
macroList.Add("BF_ALLOW_HOT_SWAPPING");
|
||||||
|
|
||||||
bool is64Bits = workspaceOptions.mMachineType.PtrSize == 8;
|
bool is64Bits = Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 8;
|
||||||
|
|
||||||
if (is64Bits)
|
if (is64Bits)
|
||||||
{
|
{
|
||||||
|
@ -8191,7 +8196,7 @@ namespace IDE
|
||||||
return passInstance;
|
return passInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DoResolveConfigString(Workspace.Options workspaceOptions, Project project, Project.Options options, StringView configString, String error, String result)
|
public bool DoResolveConfigString(String platformName, Workspace.Options workspaceOptions, Project project, Project.Options options, StringView configString, String error, String result)
|
||||||
{
|
{
|
||||||
int i = result.Length;
|
int i = result.Length;
|
||||||
result.Append(configString);
|
result.Append(configString);
|
||||||
|
@ -8265,7 +8270,7 @@ namespace IDE
|
||||||
{
|
{
|
||||||
String unresolvedStr = scope .();
|
String unresolvedStr = scope .();
|
||||||
str.UnQuoteString(unresolvedStr);
|
str.UnQuoteString(unresolvedStr);
|
||||||
if (!DoResolveConfigString(workspaceOptions, project, options, unresolvedStr, error, arg))
|
if (!DoResolveConfigString(platformName, workspaceOptions, project, options, unresolvedStr, error, arg))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -8325,14 +8330,14 @@ namespace IDE
|
||||||
if (project.IsDebugSession)
|
if (project.IsDebugSession)
|
||||||
{
|
{
|
||||||
let targetPath = scope:ReplaceBlock String();
|
let targetPath = scope:ReplaceBlock String();
|
||||||
DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, targetPath);
|
DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, targetPath);
|
||||||
newString = scope:ReplaceBlock String();
|
newString = scope:ReplaceBlock String();
|
||||||
Path.GetDirectoryPath(targetPath, newString);
|
Path.GetDirectoryPath(targetPath, newString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
String targetDir = scope String();
|
String targetDir = scope String();
|
||||||
DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, error, targetDir);
|
DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, error, targetDir);
|
||||||
newString = scope:ReplaceBlock String();
|
newString = scope:ReplaceBlock String();
|
||||||
Path.GetAbsolutePath(targetDir, project.mProjectDir, newString);
|
Path.GetAbsolutePath(targetDir, project.mProjectDir, newString);
|
||||||
}
|
}
|
||||||
|
@ -8341,17 +8346,17 @@ namespace IDE
|
||||||
if (project.IsDebugSession)
|
if (project.IsDebugSession)
|
||||||
{
|
{
|
||||||
newString = scope:ReplaceBlock String();
|
newString = scope:ReplaceBlock String();
|
||||||
DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString);
|
DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
String targetDir = scope String();
|
String targetDir = scope String();
|
||||||
DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, error, targetDir);
|
DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetDirectory, error, targetDir);
|
||||||
newString = scope:ReplaceBlock String();
|
newString = scope:ReplaceBlock String();
|
||||||
Path.GetAbsolutePath(targetDir, project.mProjectDir, newString);
|
Path.GetAbsolutePath(targetDir, project.mProjectDir, newString);
|
||||||
Utils.GetDirWithSlash(newString);
|
Utils.GetDirWithSlash(newString);
|
||||||
|
|
||||||
if (!DoResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString))
|
if (!DoResolveConfigString(platformName, workspaceOptions, project, options, options.mBuildOptions.mTargetName, error, newString))
|
||||||
return false;
|
return false;
|
||||||
#if BF_PLATFORM_WINDOWS
|
#if BF_PLATFORM_WINDOWS
|
||||||
if (project.mGeneralOptions.mTargetType == .BeefLib)
|
if (project.mGeneralOptions.mTargetType == .BeefLib)
|
||||||
|
@ -8405,7 +8410,7 @@ namespace IDE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
case "VSToolPath":
|
case "VSToolPath":
|
||||||
if (workspaceOptions.mMachineType.PtrSize == 4)
|
if (Workspace.PlatformType.GetPtrSizeByName(platformName) == 4)
|
||||||
newString = gApp.mSettings.mVSSettings.mBin32Path;
|
newString = gApp.mSettings.mVSSettings.mBin32Path;
|
||||||
else
|
else
|
||||||
newString = gApp.mSettings.mVSSettings.mBin64Path;
|
newString = gApp.mSettings.mVSSettings.mBin64Path;
|
||||||
|
@ -8472,10 +8477,10 @@ namespace IDE
|
||||||
return !hadError;
|
return !hadError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ResolveConfigString(Workspace.Options workspaceOptions, Project project, Project.Options options, StringView configString, String errorContext, String outResult)
|
public bool ResolveConfigString(String platformName, Workspace.Options workspaceOptions, Project project, Project.Options options, StringView configString, String errorContext, String outResult)
|
||||||
{
|
{
|
||||||
String errorString = scope String();
|
String errorString = scope String();
|
||||||
if (!DoResolveConfigString(workspaceOptions, project, options, configString, errorString, outResult))
|
if (!DoResolveConfigString(platformName, workspaceOptions, project, options, configString, errorString, outResult))
|
||||||
{
|
{
|
||||||
OutputErrorLine("Invalid macro in {0}: {1}", errorContext, errorString);
|
OutputErrorLine("Invalid macro in {0}: {1}", errorContext, errorString);
|
||||||
return false;
|
return false;
|
||||||
|
@ -8586,7 +8591,7 @@ namespace IDE
|
||||||
|
|
||||||
if (options.mCOptions.mCompilerType == Project.CCompilerType.GCC)
|
if (options.mCOptions.mCompilerType == Project.CCompilerType.GCC)
|
||||||
{
|
{
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
if (Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4)
|
||||||
clangOptions.Append("-m32 ");
|
clangOptions.Append("-m32 ");
|
||||||
else
|
else
|
||||||
clangOptions.Append("-m64 ");
|
clangOptions.Append("-m64 ");
|
||||||
|
@ -8594,7 +8599,7 @@ namespace IDE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clangOptions.Append("--target=");
|
clangOptions.Append("--target=");
|
||||||
GetTargetName(workspaceOptions, clangOptions);
|
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, workspaceOptions.mToolsetType, clangOptions);
|
||||||
clangOptions.Append(" ");
|
clangOptions.Append(" ");
|
||||||
|
|
||||||
if (workspaceOptions.mToolsetType == .GNU)
|
if (workspaceOptions.mToolsetType == .GNU)
|
||||||
|
@ -8719,37 +8724,10 @@ namespace IDE
|
||||||
project.mNeedsTargetRebuild = true;
|
project.mNeedsTargetRebuild = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetTargetName(Workspace.Options workspaceOptions, String str)
|
void GetTargetPaths(Project project, String platformName, Workspace.Options workspaceOptions, Project.Options options, List<String> outPaths)
|
||||||
{
|
|
||||||
#if BF_PLATFORM_WINDOWS
|
|
||||||
if (workspaceOptions.mToolsetType == .GNU)
|
|
||||||
{
|
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
|
||||||
str.Append("i686-pc-windows-gnu");
|
|
||||||
else
|
|
||||||
str.Append("x86_64-pc-windows-gnu");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
|
||||||
str.Append("i686-pc-windows-msvc");
|
|
||||||
else
|
|
||||||
str.Append("x86_64-pc-windows-msvc");
|
|
||||||
}
|
|
||||||
#elif BF_PLATFORM_LINUX
|
|
||||||
if (workspaceOptions.mMachineType == Workspace.MachineType.x86)
|
|
||||||
str.Append("i686-unknown-linux-gnu");
|
|
||||||
else
|
|
||||||
str.Append("x86_64-unknown-linux-gnu");
|
|
||||||
#else
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetTargetPaths(Project project, Workspace.Options workspaceOptions, Project.Options options, List<String> outPaths)
|
|
||||||
{
|
{
|
||||||
String targetPath = scope String();
|
String targetPath = scope String();
|
||||||
ResolveConfigString(workspaceOptions, project, options, "$(TargetPath)", "Target path", targetPath);
|
ResolveConfigString(platformName, workspaceOptions, project, options, "$(TargetPath)", "Target path", targetPath);
|
||||||
outPaths.Add(new String(targetPath));
|
outPaths.Add(new String(targetPath));
|
||||||
|
|
||||||
#if BF_PLATFORM_WINDOWS
|
#if BF_PLATFORM_WINDOWS
|
||||||
|
@ -9566,16 +9544,16 @@ namespace IDE
|
||||||
//options.mDebugOptions.mCommand
|
//options.mDebugOptions.mCommand
|
||||||
|
|
||||||
String launchPath = scope String();
|
String launchPath = scope String();
|
||||||
ResolveConfigString(workspaceOptions, project, options, options.mDebugOptions.mCommand, "debug command", launchPath);
|
ResolveConfigString(mPlatformName, workspaceOptions, project, options, options.mDebugOptions.mCommand, "debug command", launchPath);
|
||||||
String arguments = scope String();
|
String arguments = scope String();
|
||||||
ResolveConfigString(workspaceOptions, project, options, "$(Arguments)", "debug command arguments", arguments);
|
ResolveConfigString(mPlatformName, workspaceOptions, project, options, "$(Arguments)", "debug command arguments", arguments);
|
||||||
String workingDirRel = scope String();
|
String workingDirRel = scope String();
|
||||||
ResolveConfigString(workspaceOptions, project, options, "$(WorkingDir)", "debug working directory", workingDirRel);
|
ResolveConfigString(mPlatformName, workspaceOptions, project, options, "$(WorkingDir)", "debug working directory", workingDirRel);
|
||||||
var workingDir = scope String();
|
var workingDir = scope String();
|
||||||
Path.GetAbsolutePath(workingDirRel, project.mProjectDir, workingDir);
|
Path.GetAbsolutePath(workingDirRel, project.mProjectDir, workingDir);
|
||||||
|
|
||||||
String targetPath = scope .();
|
String targetPath = scope .();
|
||||||
ResolveConfigString(workspaceOptions, project, options, "$(TargetPath)", "Target path", targetPath);
|
ResolveConfigString(mPlatformName, workspaceOptions, project, options, "$(TargetPath)", "Target path", targetPath);
|
||||||
|
|
||||||
IDEUtils.FixFilePath(launchPath);
|
IDEUtils.FixFilePath(launchPath);
|
||||||
IDEUtils.FixFilePath(targetPath);
|
IDEUtils.FixFilePath(targetPath);
|
||||||
|
@ -10708,7 +10686,7 @@ namespace IDE
|
||||||
let options = GetCurProjectOptions(project);
|
let options = GetCurProjectOptions(project);
|
||||||
if (options == null)
|
if (options == null)
|
||||||
continue;
|
continue;
|
||||||
GetTargetPaths(project, workspaceOptions, options, projectFiles);
|
GetTargetPaths(project, mPlatformName, workspaceOptions, options, projectFiles);
|
||||||
|
|
||||||
for (let filePath in projectFiles)
|
for (let filePath in projectFiles)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1235,8 +1235,10 @@ namespace IDE
|
||||||
public void SetupDefaultConfigs()
|
public void SetupDefaultConfigs()
|
||||||
{
|
{
|
||||||
List<String> platforms = scope List<String>();
|
List<String> platforms = scope List<String>();
|
||||||
platforms.Add(IDEApp.sPlatform32Name);
|
if (IDEApp.sPlatform32Name != null)
|
||||||
platforms.Add(IDEApp.sPlatform64Name);
|
platforms.Add(IDEApp.sPlatform32Name);
|
||||||
|
if (IDEApp.sPlatform64Name != null)
|
||||||
|
platforms.Add(IDEApp.sPlatform64Name);
|
||||||
|
|
||||||
List<String> configs = scope List<String>();
|
List<String> configs = scope List<String>();
|
||||||
configs.Add("Debug");
|
configs.Add("Debug");
|
||||||
|
|
|
@ -415,7 +415,7 @@ namespace IDE
|
||||||
|
|
||||||
String newStr = scope:: .();
|
String newStr = scope:: .();
|
||||||
String err = scope .();
|
String err = scope .();
|
||||||
if (!gApp.DoResolveConfigString(workspaceOptions, project, projectOptions, str, err, newStr))
|
if (!gApp.DoResolveConfigString("", workspaceOptions, project, projectOptions, str, err, newStr))
|
||||||
{
|
{
|
||||||
Fail(scope String()..AppendF("Unknown macro string '{}' in '{}'", err, str));
|
Fail(scope String()..AppendF("Unknown macro string '{}' in '{}'", err, str));
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ namespace IDE
|
||||||
|
|
||||||
let workspaceOptions = gApp.GetCurWorkspaceOptions();
|
let workspaceOptions = gApp.GetCurWorkspaceOptions();
|
||||||
let options = gApp.GetCurProjectOptions(checkProject);
|
let options = gApp.GetCurProjectOptions(checkProject);
|
||||||
gApp.[Friend]GetTargetPaths(checkProject, workspaceOptions, options, targetPaths);
|
gApp.[Friend]GetTargetPaths(checkProject, gApp.mPlatformName, workspaceOptions, options, targetPaths);
|
||||||
|
|
||||||
if (!targetPaths.IsEmpty)
|
if (!targetPaths.IsEmpty)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,35 @@ namespace IDE
|
||||||
#unwarn
|
#unwarn
|
||||||
return .Unknown;
|
return .Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetPtrSizeByName(String name)
|
||||||
|
{
|
||||||
|
if (name.EndsWith("32"))
|
||||||
|
return 4;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetTargetTripleByName(String name, ToolsetType toolsetType, String outTriple)
|
||||||
|
{
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "Win32":
|
||||||
|
outTriple.Append((toolsetType == .GNU) ? "i686-pc-windows-gnu" : "i686-pc-windows-msvc");
|
||||||
|
case "Win64":
|
||||||
|
outTriple.Append((toolsetType == .GNU) ? "x86_64-pc-windows-gnu" : "x86_64-pc-windows-msvc");
|
||||||
|
case "Linux32":
|
||||||
|
outTriple.Append("i686-unknown-linux-gnu");
|
||||||
|
case "Linux64":
|
||||||
|
outTriple.Append("x86_64-unknown-linux-gnu");
|
||||||
|
case "macOS":
|
||||||
|
outTriple.Append("x86_64-apple-macosx10.14.0");
|
||||||
|
case "iOS":
|
||||||
|
outTriple.Append("arm64-apple-ios13.1");
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ToolsetType
|
public enum ToolsetType
|
||||||
|
@ -157,8 +186,6 @@ namespace IDE
|
||||||
public class Options
|
public class Options
|
||||||
{
|
{
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public MachineType mMachineType = MachineType.x86;
|
|
||||||
[Reflect]
|
|
||||||
public ToolsetType mToolsetType;
|
public ToolsetType mToolsetType;
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public BuildKind mBuildKind;
|
public BuildKind mBuildKind;
|
||||||
|
@ -234,7 +261,6 @@ namespace IDE
|
||||||
|
|
||||||
public void CopyFrom(Workspace.Options prev)
|
public void CopyFrom(Workspace.Options prev)
|
||||||
{
|
{
|
||||||
mMachineType = prev.mMachineType;
|
|
||||||
mToolsetType = prev.mToolsetType;
|
mToolsetType = prev.mToolsetType;
|
||||||
mBuildKind = prev.mBuildKind;
|
mBuildKind = prev.mBuildKind;
|
||||||
|
|
||||||
|
@ -568,11 +594,6 @@ namespace IDE
|
||||||
data.RemoveIfEmpty();
|
data.RemoveIfEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineType defaultMachineType = .x64;
|
|
||||||
if (platformName == "Win32")
|
|
||||||
defaultMachineType = .x86;
|
|
||||||
|
|
||||||
data.ConditionalAdd("MachineType", options.mMachineType, defaultMachineType);
|
|
||||||
data.ConditionalAdd("Toolset", options.mToolsetType, ToolsetType.Default);
|
data.ConditionalAdd("Toolset", options.mToolsetType, ToolsetType.Default);
|
||||||
data.ConditionalAdd("BuildKind", options.mBuildKind, isTest ? .Test : .Normal);
|
data.ConditionalAdd("BuildKind", options.mBuildKind, isTest ? .Test : .Normal);
|
||||||
data.ConditionalAdd("BfSIMDSetting", options.mBfSIMDSetting, .SSE2);
|
data.ConditionalAdd("BfSIMDSetting", options.mBfSIMDSetting, .SSE2);
|
||||||
|
@ -720,11 +741,6 @@ namespace IDE
|
||||||
options.mCSIMDSetting = .SSE2;
|
options.mCSIMDSetting = .SSE2;
|
||||||
options.mCOptimizationLevel = isRelease ? .O2 : .O0;
|
options.mCOptimizationLevel = isRelease ? .O2 : .O0;
|
||||||
|
|
||||||
MachineType defaultMachineType = .x64;
|
|
||||||
if (platformName == "Win32")
|
|
||||||
defaultMachineType = .x86;
|
|
||||||
|
|
||||||
options.mMachineType = defaultMachineType;
|
|
||||||
options.mBuildKind = isTest ? .Test : .Normal;
|
options.mBuildKind = isTest ? .Test : .Normal;
|
||||||
|
|
||||||
//TODO:
|
//TODO:
|
||||||
|
@ -779,11 +795,6 @@ namespace IDE
|
||||||
options.mPreprocessorMacros.Add(str);
|
options.mPreprocessorMacros.Add(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineType defaultMachineType = .x64;
|
|
||||||
if (platformName == "Win32")
|
|
||||||
defaultMachineType = .x86;
|
|
||||||
|
|
||||||
options.mMachineType = data.GetEnum<MachineType>("MachineType", defaultMachineType);
|
|
||||||
options.mToolsetType = data.GetEnum<ToolsetType>("Toolset", ToolsetType.Default);
|
options.mToolsetType = data.GetEnum<ToolsetType>("Toolset", ToolsetType.Default);
|
||||||
options.mBuildKind = data.GetEnum<BuildKind>("BuildKind", isTest ? .Test : .Normal);
|
options.mBuildKind = data.GetEnum<BuildKind>("BuildKind", isTest ? .Test : .Normal);
|
||||||
options.mBfSIMDSetting = data.GetEnum<BuildOptions.SIMDSetting>("BfSIMDSetting", .SSE2);
|
options.mBfSIMDSetting = data.GetEnum<BuildOptions.SIMDSetting>("BfSIMDSetting", .SSE2);
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace IDE.ui
|
||||||
if (inStr == null)
|
if (inStr == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gApp.ResolveConfigString(workspaceOptions, gApp.mWorkspace.mStartupProject, options, inStr, "", outString);
|
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, gApp.mWorkspace.mStartupProject, options, inStr, "", outString);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -8123,7 +8123,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_HotResolve_Finish(BfCompiler* bfCom
|
||||||
}
|
}
|
||||||
|
|
||||||
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProject* hotProject, int hotIdx,
|
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProject* hotProject, int hotIdx,
|
||||||
int machineType, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
const char* targetTriple, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
||||||
BfCompilerOptionFlags optionFlags, char* mallocLinkName, char* freeLinkName)
|
BfCompilerOptionFlags optionFlags, char* mallocLinkName, char* freeLinkName)
|
||||||
{
|
{
|
||||||
BfLogSys(bfCompiler->mSystem, "BfCompiler_SetOptions\n");
|
BfLogSys(bfCompiler->mSystem, "BfCompiler_SetOptions\n");
|
||||||
|
@ -8135,7 +8135,15 @@ BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProje
|
||||||
options->mErrorString.Clear();
|
options->mErrorString.Clear();
|
||||||
options->mHotProject = hotProject;
|
options->mHotProject = hotProject;
|
||||||
options->mHotCompileIdx = hotIdx;
|
options->mHotCompileIdx = hotIdx;
|
||||||
options->mMachineType = (BfMachineType)machineType;
|
options->mTargetTriple = targetTriple;
|
||||||
|
|
||||||
|
if (options->mTargetTriple.StartsWith("x86_64-"))
|
||||||
|
options->mMachineType = BfMachineType_x64;
|
||||||
|
else if (options->mTargetTriple.StartsWith("i686-"))
|
||||||
|
options->mMachineType = BfMachineType_x86;
|
||||||
|
else
|
||||||
|
options->mMachineType = BfMachineType_x64; // Default
|
||||||
|
|
||||||
bfCompiler->mCodeGen.SetMaxThreads(maxWorkerThreads);
|
bfCompiler->mCodeGen.SetMaxThreads(maxWorkerThreads);
|
||||||
|
|
||||||
if (!bfCompiler->mIsResolveOnly)
|
if (!bfCompiler->mIsResolveOnly)
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
|
|
||||||
int32 mForceRebuildIdx;
|
int32 mForceRebuildIdx;
|
||||||
BfCompileOnDemandKind mCompileOnDemandKind;
|
BfCompileOnDemandKind mCompileOnDemandKind;
|
||||||
|
String mTargetTriple;
|
||||||
BfMachineType mMachineType;
|
BfMachineType mMachineType;
|
||||||
BfToolsetType mToolsetType;
|
BfToolsetType mToolsetType;
|
||||||
BfSIMDSetting mSIMDSetting;
|
BfSIMDSetting mSIMDSetting;
|
||||||
|
|
|
@ -241,6 +241,8 @@ bool BfMethodMatcher::InferGenericArgument(BfMethodInstance* methodInstance, BfT
|
||||||
{
|
{
|
||||||
if (argType == NULL)
|
if (argType == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
if (argType->IsVar())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (wantType->IsGenericParam())
|
if (wantType->IsGenericParam())
|
||||||
{
|
{
|
||||||
|
@ -1347,6 +1349,9 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* typeInstance, BfMethodDef* che
|
||||||
genericArg = mModule->GetPrimitiveStructType(primType->mTypeDef->mTypeCode);
|
genericArg = mModule->GetPrimitiveStructType(primType->mTypeDef->mTypeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (genericArg == NULL)
|
||||||
|
goto NoMatch;
|
||||||
|
|
||||||
//SetAndRestoreValue<bool> ignoreError(mModule->mIgnoreErrors, true);
|
//SetAndRestoreValue<bool> ignoreError(mModule->mIgnoreErrors, true);
|
||||||
if (!mModule->CheckGenericConstraints(BfGenericParamSource(methodInstance), genericArg, NULL, genericParams[checkGenericIdx], genericArgumentsSubstitute, NULL))
|
if (!mModule->CheckGenericConstraints(BfGenericParamSource(methodInstance), genericArg, NULL, genericParams[checkGenericIdx], genericArgumentsSubstitute, NULL))
|
||||||
{
|
{
|
||||||
|
|
|
@ -954,30 +954,32 @@ void BfModule::FinishInit()
|
||||||
|
|
||||||
mBfIRBuilder->Start(mModuleName, mCompiler->mSystem->mPtrSize, IsOptimized());
|
mBfIRBuilder->Start(mModuleName, mCompiler->mSystem->mPtrSize, IsOptimized());
|
||||||
|
|
||||||
#ifdef BF_PLATFORM_WINDOWS
|
mBfIRBuilder->Module_SetTargetTriple(mCompiler->mOptions.mTargetTriple);
|
||||||
if (mCompiler->mOptions.mToolsetType == BfToolsetType_GNU)
|
|
||||||
{
|
// #ifdef BF_PLATFORM_WINDOWS
|
||||||
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
// if (mCompiler->mOptions.mToolsetType == BfToolsetType_GNU)
|
||||||
mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-gnu");
|
// {
|
||||||
else
|
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
||||||
mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-gnu");
|
// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-gnu");
|
||||||
}
|
// else
|
||||||
else //if (mCompiler->mOptions.mToolsetType == BfToolsetType_Microsoft)
|
// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-gnu");
|
||||||
{
|
// }
|
||||||
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
// else //if (mCompiler->mOptions.mToolsetType == BfToolsetType_Microsoft)
|
||||||
mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-msvc");
|
// {
|
||||||
else
|
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
||||||
mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-msvc");
|
// mBfIRBuilder->Module_SetTargetTriple("i686-pc-windows-msvc");
|
||||||
}
|
// else
|
||||||
#elif defined BF_PLATFORM_LINUX
|
// mBfIRBuilder->Module_SetTargetTriple("x86_64-pc-windows-msvc");
|
||||||
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
// }
|
||||||
mBfIRBuilder->Module_SetTargetTriple("i686-unknown-linux-gnu");
|
// #elif defined BF_PLATFORM_LINUX
|
||||||
else
|
// if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
||||||
mBfIRBuilder->Module_SetTargetTriple("x86_64-unknown-linux-gnu");
|
// mBfIRBuilder->Module_SetTargetTriple("i686-unknown-linux-gnu");
|
||||||
#else
|
// else
|
||||||
// Leave it default
|
// mBfIRBuilder->Module_SetTargetTriple("x86_64-unknown-linux-gnu");
|
||||||
mBfIRBuilder->Module_SetTargetTriple("");
|
// #else
|
||||||
#endif
|
// // Leave it default
|
||||||
|
// mBfIRBuilder->Module_SetTargetTriple("");
|
||||||
|
// #endif
|
||||||
|
|
||||||
mBfIRBuilder->SetBackend(IsTargetingBeefBackend());
|
mBfIRBuilder->SetBackend(IsTargetingBeefBackend());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue