1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 13:54:11 +02:00

Made Linux respect link dependencies

This commit is contained in:
Brian Fiete 2020-07-01 05:29:25 -07:00
parent 40e428b2f0
commit 963f4fedfc

View file

@ -401,41 +401,16 @@ namespace IDE
} }
} }
List<Project> depProjectList = scope List<Project>(); List<String> libPaths = scope .();
gApp.GetDependentProjectList(project, depProjectList); defer ClearAndDeleteItems(libPaths);
if (depProjectList.Count > 0) List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths);
AddLinkDeps(project, options, workspaceOptions, linkLine, libPaths, depPaths);
for (var libPath in libPaths)
{ {
for (var depProject in depProjectList) IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
{ linkLine.Append(" ");
/*if (depProject.mNeedsTargetRebuild)
project.mNeedsTargetRebuild = true;*/
var depOptions = gApp.GetCurProjectOptions(depProject);
if (depOptions.mClangObjectFiles != null)
{
var argBuilder = scope IDEApp.ArgBuilder(linkLine, true);
for (var fileName in depOptions.mClangObjectFiles)
{
//AppendWithOptionalQuotes(linkLine, fileName);
argBuilder.AddFileName(fileName);
argBuilder.AddSep();
}
}
/*String depLibTargetPath = scope String();
ResolveConfigString(depProject, depOptions, "$(TargetPath)", error, depLibTargetPath);
IDEUtils.FixFilePath(depLibTargetPath);
String depDir = scope String();
Path.GetDirectoryName(depLibTargetPath, depDir);
String depFileName = scope String();
Path.GetFileNameWithoutExtension(depLibTargetPath, depFileName);
AppendWithOptionalQuotes(linkLine, depLibTargetPath);
linkLine.Append(" ");*/
}
} }
String gccExePath; String gccExePath;
@ -648,51 +623,8 @@ namespace IDE
return true; return true;
} }
bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg) void AddLinkDeps(Project project, Project.Options options, Workspace.Options workspaceOptions, String linkLine, List<String> libPaths, List<String> depPaths)
{ {
bool is64Bit = mPtrSize == 8;
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
IDEUtils.FixFilePath(llvmDir);
llvmDir.Append("llvm/");
TestManager.ProjectInfo testProjectInfo = null;
if (gApp.mTestManager != null)
testProjectInfo = gApp.mTestManager.GetProjectInfo(project);
bool isExe = (project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) || (testProjectInfo != null);
if (isExe)
{
String linkLine = scope String();
linkLine.Append("-out:");
IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
linkLine.Append(" ");
if (testProjectInfo != null)
linkLine.Append("-subsystem:console ");
else if (project.mGeneralOptions.mTargetType == .BeefGUIApplication)
linkLine.Append("-subsystem:windows ");
else if (project.mGeneralOptions.mTargetType == .C_GUIApplication)
linkLine.Append("-subsystem:console ");
else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
{
linkLine.Append("-dll ");
if (targetPath.EndsWith(".dll", .InvariantCultureIgnoreCase))
{
linkLine.Append("-implib:\"");
linkLine.Append(targetPath, 0, targetPath.Length - 4);
linkLine.Append(".lib\" ");
}
}
linkLine.Append(objectsArg);
CopyLibFiles(targetPath, workspaceOptions, options);
List<String> libPaths = scope .();
defer ClearAndDeleteItems(libPaths);
void AddLibPath(StringView libPathIn, Project project, Project.Options projectOptions) void AddLibPath(StringView libPathIn, Project project, Project.Options projectOptions)
{ {
var libPath = new String(); var libPath = new String();
@ -703,7 +635,7 @@ namespace IDE
} }
} }
List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths); defer ClearAndDeleteItems(depPaths);
void AddDepPath(StringView depPathIn, Project project, Project.Options projectOptions) void AddDepPath(StringView depPathIn, Project project, Project.Options projectOptions)
{ {
@ -765,6 +697,56 @@ namespace IDE
} }
} }
} }
}
bool QueueProjectMSLink(Project project, String targetPath, String configName, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
{
bool is64Bit = mPtrSize == 8;
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
IDEUtils.FixFilePath(llvmDir);
llvmDir.Append("llvm/");
TestManager.ProjectInfo testProjectInfo = null;
if (gApp.mTestManager != null)
testProjectInfo = gApp.mTestManager.GetProjectInfo(project);
bool isExe = (project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) || (testProjectInfo != null);
if (isExe)
{
String linkLine = scope String();
linkLine.Append("-out:");
IDEUtils.AppendWithOptionalQuotes(linkLine, targetPath);
linkLine.Append(" ");
if (testProjectInfo != null)
linkLine.Append("-subsystem:console ");
else if (project.mGeneralOptions.mTargetType == .BeefGUIApplication)
linkLine.Append("-subsystem:windows ");
else if (project.mGeneralOptions.mTargetType == .C_GUIApplication)
linkLine.Append("-subsystem:console ");
else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
{
linkLine.Append("-dll ");
if (targetPath.EndsWith(".dll", .InvariantCultureIgnoreCase))
{
linkLine.Append("-implib:\"");
linkLine.Append(targetPath, 0, targetPath.Length - 4);
linkLine.Append(".lib\" ");
}
}
linkLine.Append(objectsArg);
CopyLibFiles(targetPath, workspaceOptions, options);
List<String> libPaths = scope .();
defer ClearAndDeleteItems(libPaths);
List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths);
AddLinkDeps(project, options, workspaceOptions, linkLine, libPaths, depPaths);
/*if (File.Delete(targetPath).Failed(true)) /*if (File.Delete(targetPath).Failed(true))
{ {
@ -871,9 +853,6 @@ namespace IDE
let winOptions = project.mWindowsOptions; let winOptions = project.mWindowsOptions;
String projectBuildDir = scope String();
gApp.GetProjectBuildDir(project, projectBuildDir);
String cacheStr = scope String(); String cacheStr = scope String();
void AddBuildFileDependency(StringView filePath, bool resolveString = false) void AddBuildFileDependency(StringView filePath, bool resolveString = false)
@ -909,6 +888,8 @@ namespace IDE
for (var linkDep in libPaths) for (var linkDep in libPaths)
AddBuildFileDependency(linkDep, true); AddBuildFileDependency(linkDep, true);
String projectBuildDir = scope String();
gApp.GetProjectBuildDir(project, projectBuildDir);
String prevCacheStr = scope .(); String prevCacheStr = scope .();
gApp.mBfBuildCompiler.GetBuildValue(projectBuildDir, "Link", prevCacheStr); gApp.mBfBuildCompiler.GetBuildValue(projectBuildDir, "Link", prevCacheStr);
if (prevCacheStr != cacheStr) if (prevCacheStr != cacheStr)