diff --git a/BeefySysLib/platform/linux/LinuxCommon.h b/BeefySysLib/platform/linux/LinuxCommon.h index c5cb445f..b739a38d 100644 --- a/BeefySysLib/platform/linux/LinuxCommon.h +++ b/BeefySysLib/platform/linux/LinuxCommon.h @@ -82,6 +82,8 @@ typedef int32 LONG; typedef pthread_key_t BFTlsKey; typedef pthread_t BF_THREADID; typedef pthread_t BF_THREADHANDLE; + +#define BF_HAS_TLS_DECLSPEC #define BF_TLS_DECLSPEC thread_local //:int64 abs(int64 val); diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf index ac22c1ff..1a7ad944 100644 --- a/IDE/src/BuildContext.bf +++ b/IDE/src/BuildContext.bf @@ -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 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 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 depProjectList = scope List(); 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) diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index b3905f8a..35cc9364 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -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))