mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Copying RT files, setting $ORIGIN properly
This commit is contained in:
parent
578b886526
commit
2e84b4229c
3 changed files with 95 additions and 54 deletions
|
@ -393,8 +393,26 @@ namespace IDE
|
|||
outPdbPath.Append(".pdb");
|
||||
}
|
||||
|
||||
public static void GetRtLibNames(Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg)
|
||||
public static void GetRtLibNames(Workspace.PlatformType platformType, Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg)
|
||||
{
|
||||
if (platformType == .Linux)
|
||||
{
|
||||
if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
|
||||
outRt.Append("libBeefRT_d.so");
|
||||
else
|
||||
outRt.Append("libBeefRT.so");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((platformType == .macOS) || (platformType == .iOS))
|
||||
{
|
||||
if (options.mBuildOptions.mBeefLibType == .DynamicDebug)
|
||||
outRt.Append("libBeefRT_d.dylib");
|
||||
else
|
||||
outRt.Append("libBeefRT.dylib");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
|
||||
{
|
||||
outRt.Append("Beef", IDEApp.sRTVersionStr, "RT");
|
||||
|
@ -426,6 +444,49 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
bool CopyLibFiles(String targetPath, Workspace.Options workspaceOptions, Project.Options options)
|
||||
{
|
||||
List<String> stdLibFileNames = scope .(2);
|
||||
String fromDir;
|
||||
|
||||
fromDir = scope String(gApp.mInstallDir);
|
||||
|
||||
bool AddLib(String dllName)
|
||||
{
|
||||
stdLibFileNames.Add(dllName);
|
||||
|
||||
String fromPath = scope String(fromDir, dllName);
|
||||
String toPath = scope String();
|
||||
Path.GetDirectoryPath(targetPath, toPath);
|
||||
toPath.Append("/", dllName);
|
||||
if (File.CopyIfNewer(fromPath, toPath) case .Err)
|
||||
{
|
||||
gApp.OutputLine("Failed to copy lib file {0}", fromPath);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String rtName = scope String();
|
||||
String dbgName = scope String();
|
||||
GetRtLibNames(mPlatformType, workspaceOptions, options, true, rtName, dbgName);
|
||||
if (!rtName.IsEmpty)
|
||||
if (!AddLib(rtName))
|
||||
return false;
|
||||
if (!dbgName.IsEmpty)
|
||||
if (!AddLib(dbgName))
|
||||
return false;
|
||||
switch (workspaceOptions.mAllocType)
|
||||
{
|
||||
case .JEMalloc:
|
||||
if (!AddLib("jemalloc.dll"))
|
||||
return false;
|
||||
default:
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
||||
{
|
||||
bool is64Bit = mPtrSize == 8;
|
||||
|
@ -467,50 +528,7 @@ namespace IDE
|
|||
|
||||
linkLine.Append(objectsArg);
|
||||
|
||||
//var destDir = scope String();
|
||||
//Path.GetDirectoryName();
|
||||
|
||||
//TODO: Allow selecting lib file. Check date when copying instead of just ALWAYS copying...
|
||||
LibBlock:
|
||||
{
|
||||
List<String> stdLibFileNames = scope .(2);
|
||||
String fromDir;
|
||||
|
||||
fromDir = scope String(gApp.mInstallDir);
|
||||
|
||||
bool AddLib(String dllName)
|
||||
{
|
||||
stdLibFileNames.Add(dllName);
|
||||
|
||||
String fromPath = scope String(fromDir, dllName);
|
||||
String toPath = scope String();
|
||||
Path.GetDirectoryPath(targetPath, toPath);
|
||||
toPath.Append("/", dllName);
|
||||
if (File.CopyIfNewer(fromPath, toPath) case .Err)
|
||||
{
|
||||
gApp.OutputLine("Failed to copy lib file {0}", fromPath);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String rtName = scope String();
|
||||
String dbgName = scope String();
|
||||
GetRtLibNames(workspaceOptions, options, true, rtName, dbgName);
|
||||
if (!rtName.IsEmpty)
|
||||
if (!AddLib(rtName))
|
||||
return false;
|
||||
if (!dbgName.IsEmpty)
|
||||
if (!AddLib(dbgName))
|
||||
return false;
|
||||
switch (workspaceOptions.mAllocType)
|
||||
{
|
||||
case .JEMalloc:
|
||||
if (!AddLib("jemalloc.dll"))
|
||||
return false;
|
||||
default:
|
||||
}
|
||||
}
|
||||
CopyLibFiles(targetPath, workspaceOptions, options);
|
||||
|
||||
List<Project> depProjectList = scope List<Project>();
|
||||
gApp.GetDependentProjectList(project, depProjectList);
|
||||
|
@ -1030,6 +1048,8 @@ namespace IDE
|
|||
return true;
|
||||
}
|
||||
|
||||
CopyLibFiles(targetPath, workspaceOptions, options);
|
||||
|
||||
String objectsArg = scope String();
|
||||
var argBuilder = scope IDEApp.ArgBuilder(objectsArg, workspaceOptions.mToolsetType != .GNU);
|
||||
for (var bfFileName in bfFileNames)
|
||||
|
|
|
@ -200,6 +200,9 @@ namespace IDE
|
|||
public String mConfigName = new String() ~ delete _;
|
||||
public String mPlatformName = new String() ~ delete _;
|
||||
|
||||
public String mSetConfigName ~ delete _;
|
||||
public String mSetPlatformName ~ delete _;
|
||||
|
||||
public Targets mTargets = new Targets() ~ delete _;
|
||||
public DebugManager mDebugger ~ delete _;
|
||||
public String mSymSrvStatus = new String() ~ delete _;
|
||||
|
@ -6357,7 +6360,9 @@ namespace IDE
|
|||
case "-attachId":
|
||||
mProcessAttachId = int32.Parse(value).GetValueOrDefault();
|
||||
case "-config":
|
||||
mConfigName.Set(value);
|
||||
if (mSetConfigName == null)
|
||||
mSetConfigName = new String();
|
||||
mSetConfigName.Set(value);
|
||||
case "-launch":
|
||||
if (mLaunchData == null)
|
||||
mLaunchData = new .();
|
||||
|
@ -6367,7 +6372,9 @@ namespace IDE
|
|||
String.NewOrSet!(mCrashDumpPath, value);
|
||||
#endif
|
||||
case "-platform":
|
||||
mPlatformName.Set(value);
|
||||
if (mSetPlatformName == null)
|
||||
mSetPlatformName = new String();
|
||||
mSetPlatformName.Set(value);
|
||||
case "-test":
|
||||
Runtime.SetCrashReportKind(.PrintOnly);
|
||||
|
||||
|
@ -8397,14 +8404,14 @@ namespace IDE
|
|||
(project.mGeneralOptions.mTargetType == .BeefDynLib) ||
|
||||
((options.mBuildOptions.mBuildKind == .Test) && (project == mWorkspace.mStartupProject)))
|
||||
{
|
||||
|
||||
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
||||
String rtName = scope String();
|
||||
String dbgName = scope String();
|
||||
BuildContext.GetRtLibNames(platformType, workspaceOptions, options, false, rtName, dbgName);
|
||||
|
||||
switch (platformType)
|
||||
{
|
||||
case .Windows:
|
||||
String rtName = scope String();
|
||||
String dbgName = scope String();
|
||||
BuildContext.GetRtLibNames(workspaceOptions, options, false, rtName, dbgName);
|
||||
newString.Append(rtName);
|
||||
if (!dbgName.IsEmpty)
|
||||
newString.Append(" ", dbgName);
|
||||
|
@ -8417,10 +8424,10 @@ namespace IDE
|
|||
default:
|
||||
}
|
||||
case .macOS:
|
||||
newString.Append("./libBeefRT_d.dylib -Wl,-rpath -Wl,.");
|
||||
newString.AppendF("./{} -Wl,-rpath -Wl,.", rtName);
|
||||
case .iOS:
|
||||
case .Linux:
|
||||
newString.Append("./libBeefRT_d.so -Wl,-rpath -Wl,$ORIGIN");
|
||||
newString.AppendF("./{} -Wl,-rpath -Wl,$ORIGIN", rtName);
|
||||
default:
|
||||
}
|
||||
|
||||
|
@ -9873,7 +9880,7 @@ namespace IDE
|
|||
if (mConfigName.IsEmpty)
|
||||
mConfigName.Set("Debug");
|
||||
if (mPlatformName.IsEmpty)
|
||||
mPlatformName.Set(sPlatform64Name);
|
||||
mPlatformName.Set(sPlatform64Name ?? sPlatform32Name);
|
||||
|
||||
Directory.GetCurrentDirectory(mInitialCWD);
|
||||
|
||||
|
@ -10010,6 +10017,18 @@ namespace IDE
|
|||
loadedWorkspaceUserData = true;
|
||||
}
|
||||
|
||||
if (mSetConfigName != null)
|
||||
{
|
||||
mConfigName.Set(mSetConfigName);
|
||||
DeleteAndNullify!(mSetConfigName);
|
||||
}
|
||||
|
||||
if (mSetPlatformName != null)
|
||||
{
|
||||
mPlatformName.Set(mSetPlatformName);
|
||||
DeleteAndNullify!(mSetPlatformName);
|
||||
}
|
||||
|
||||
WorkspaceLoaded();
|
||||
|
||||
if ((mIsFirstRun) && (!loadedWorkspaceUserData))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue