mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52: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
|
@ -82,6 +82,8 @@ typedef int32 LONG;
|
||||||
typedef pthread_key_t BFTlsKey;
|
typedef pthread_key_t BFTlsKey;
|
||||||
typedef pthread_t BF_THREADID;
|
typedef pthread_t BF_THREADID;
|
||||||
typedef pthread_t BF_THREADHANDLE;
|
typedef pthread_t BF_THREADHANDLE;
|
||||||
|
|
||||||
|
#define BF_HAS_TLS_DECLSPEC
|
||||||
#define BF_TLS_DECLSPEC thread_local
|
#define BF_TLS_DECLSPEC thread_local
|
||||||
|
|
||||||
//:int64 abs(int64 val);
|
//:int64 abs(int64 val);
|
||||||
|
|
|
@ -393,8 +393,26 @@ namespace IDE
|
||||||
outPdbPath.Append(".pdb");
|
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))
|
if ((!dynName) || (options.mBuildOptions.mBeefLibType != .Static))
|
||||||
{
|
{
|
||||||
outRt.Append("Beef", IDEApp.sRTVersionStr, "RT");
|
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 QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
||||||
{
|
{
|
||||||
bool is64Bit = mPtrSize == 8;
|
bool is64Bit = mPtrSize == 8;
|
||||||
|
@ -467,50 +528,7 @@ namespace IDE
|
||||||
|
|
||||||
linkLine.Append(objectsArg);
|
linkLine.Append(objectsArg);
|
||||||
|
|
||||||
//var destDir = scope String();
|
CopyLibFiles(targetPath, workspaceOptions, options);
|
||||||
//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:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Project> depProjectList = scope List<Project>();
|
List<Project> depProjectList = scope List<Project>();
|
||||||
gApp.GetDependentProjectList(project, depProjectList);
|
gApp.GetDependentProjectList(project, depProjectList);
|
||||||
|
@ -1030,6 +1048,8 @@ namespace IDE
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CopyLibFiles(targetPath, workspaceOptions, options);
|
||||||
|
|
||||||
String objectsArg = scope String();
|
String objectsArg = scope String();
|
||||||
var argBuilder = scope IDEApp.ArgBuilder(objectsArg, workspaceOptions.mToolsetType != .GNU);
|
var argBuilder = scope IDEApp.ArgBuilder(objectsArg, workspaceOptions.mToolsetType != .GNU);
|
||||||
for (var bfFileName in bfFileNames)
|
for (var bfFileName in bfFileNames)
|
||||||
|
|
|
@ -200,6 +200,9 @@ namespace IDE
|
||||||
public String mConfigName = new String() ~ delete _;
|
public String mConfigName = new String() ~ delete _;
|
||||||
public String mPlatformName = new String() ~ delete _;
|
public String mPlatformName = new String() ~ delete _;
|
||||||
|
|
||||||
|
public String mSetConfigName ~ delete _;
|
||||||
|
public String mSetPlatformName ~ delete _;
|
||||||
|
|
||||||
public Targets mTargets = new Targets() ~ delete _;
|
public Targets mTargets = new Targets() ~ delete _;
|
||||||
public DebugManager mDebugger ~ delete _;
|
public DebugManager mDebugger ~ delete _;
|
||||||
public String mSymSrvStatus = new String() ~ delete _;
|
public String mSymSrvStatus = new String() ~ delete _;
|
||||||
|
@ -6357,7 +6360,9 @@ namespace IDE
|
||||||
case "-attachId":
|
case "-attachId":
|
||||||
mProcessAttachId = int32.Parse(value).GetValueOrDefault();
|
mProcessAttachId = int32.Parse(value).GetValueOrDefault();
|
||||||
case "-config":
|
case "-config":
|
||||||
mConfigName.Set(value);
|
if (mSetConfigName == null)
|
||||||
|
mSetConfigName = new String();
|
||||||
|
mSetConfigName.Set(value);
|
||||||
case "-launch":
|
case "-launch":
|
||||||
if (mLaunchData == null)
|
if (mLaunchData == null)
|
||||||
mLaunchData = new .();
|
mLaunchData = new .();
|
||||||
|
@ -6367,7 +6372,9 @@ namespace IDE
|
||||||
String.NewOrSet!(mCrashDumpPath, value);
|
String.NewOrSet!(mCrashDumpPath, value);
|
||||||
#endif
|
#endif
|
||||||
case "-platform":
|
case "-platform":
|
||||||
mPlatformName.Set(value);
|
if (mSetPlatformName == null)
|
||||||
|
mSetPlatformName = new String();
|
||||||
|
mSetPlatformName.Set(value);
|
||||||
case "-test":
|
case "-test":
|
||||||
Runtime.SetCrashReportKind(.PrintOnly);
|
Runtime.SetCrashReportKind(.PrintOnly);
|
||||||
|
|
||||||
|
@ -8397,14 +8404,14 @@ namespace IDE
|
||||||
(project.mGeneralOptions.mTargetType == .BeefDynLib) ||
|
(project.mGeneralOptions.mTargetType == .BeefDynLib) ||
|
||||||
((options.mBuildOptions.mBuildKind == .Test) && (project == mWorkspace.mStartupProject)))
|
((options.mBuildOptions.mBuildKind == .Test) && (project == mWorkspace.mStartupProject)))
|
||||||
{
|
{
|
||||||
|
|
||||||
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
||||||
|
String rtName = scope String();
|
||||||
|
String dbgName = scope String();
|
||||||
|
BuildContext.GetRtLibNames(platformType, workspaceOptions, options, false, rtName, dbgName);
|
||||||
|
|
||||||
switch (platformType)
|
switch (platformType)
|
||||||
{
|
{
|
||||||
case .Windows:
|
case .Windows:
|
||||||
String rtName = scope String();
|
|
||||||
String dbgName = scope String();
|
|
||||||
BuildContext.GetRtLibNames(workspaceOptions, options, false, rtName, dbgName);
|
|
||||||
newString.Append(rtName);
|
newString.Append(rtName);
|
||||||
if (!dbgName.IsEmpty)
|
if (!dbgName.IsEmpty)
|
||||||
newString.Append(" ", dbgName);
|
newString.Append(" ", dbgName);
|
||||||
|
@ -8417,10 +8424,10 @@ namespace IDE
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
case .macOS:
|
case .macOS:
|
||||||
newString.Append("./libBeefRT_d.dylib -Wl,-rpath -Wl,.");
|
newString.AppendF("./{} -Wl,-rpath -Wl,.", rtName);
|
||||||
case .iOS:
|
case .iOS:
|
||||||
case .Linux:
|
case .Linux:
|
||||||
newString.Append("./libBeefRT_d.so -Wl,-rpath -Wl,$ORIGIN");
|
newString.AppendF("./{} -Wl,-rpath -Wl,$ORIGIN", rtName);
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9873,7 +9880,7 @@ namespace IDE
|
||||||
if (mConfigName.IsEmpty)
|
if (mConfigName.IsEmpty)
|
||||||
mConfigName.Set("Debug");
|
mConfigName.Set("Debug");
|
||||||
if (mPlatformName.IsEmpty)
|
if (mPlatformName.IsEmpty)
|
||||||
mPlatformName.Set(sPlatform64Name);
|
mPlatformName.Set(sPlatform64Name ?? sPlatform32Name);
|
||||||
|
|
||||||
Directory.GetCurrentDirectory(mInitialCWD);
|
Directory.GetCurrentDirectory(mInitialCWD);
|
||||||
|
|
||||||
|
@ -10010,6 +10017,18 @@ namespace IDE
|
||||||
loadedWorkspaceUserData = true;
|
loadedWorkspaceUserData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mSetConfigName != null)
|
||||||
|
{
|
||||||
|
mConfigName.Set(mSetConfigName);
|
||||||
|
DeleteAndNullify!(mSetConfigName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mSetPlatformName != null)
|
||||||
|
{
|
||||||
|
mPlatformName.Set(mSetPlatformName);
|
||||||
|
DeleteAndNullify!(mSetPlatformName);
|
||||||
|
}
|
||||||
|
|
||||||
WorkspaceLoaded();
|
WorkspaceLoaded();
|
||||||
|
|
||||||
if ((mIsFirstRun) && (!loadedWorkspaceUserData))
|
if ((mIsFirstRun) && (!loadedWorkspaceUserData))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue