1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +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>();
gApp.GetDependentProjectList(project, depProjectList);
if (depProjectList.Count > 0)
List<String> libPaths = scope .();
defer ClearAndDeleteItems(libPaths);
List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths);
AddLinkDeps(project, options, workspaceOptions, linkLine, libPaths, depPaths);
for (var libPath in libPaths)
{
for (var depProject in depProjectList)
{
/*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(" ");*/
}
IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
linkLine.Append(" ");
}
String gccExePath;
@ -648,51 +623,8 @@ namespace IDE
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)
{
var libPath = new String();
@ -703,7 +635,7 @@ namespace IDE
}
}
List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths);
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))
{
@ -871,9 +853,6 @@ namespace IDE
let winOptions = project.mWindowsOptions;
String projectBuildDir = scope String();
gApp.GetProjectBuildDir(project, projectBuildDir);
String cacheStr = scope String();
void AddBuildFileDependency(StringView filePath, bool resolveString = false)
@ -909,6 +888,8 @@ namespace IDE
for (var linkDep in libPaths)
AddBuildFileDependency(linkDep, true);
String projectBuildDir = scope String();
gApp.GetProjectBuildDir(project, projectBuildDir);
String prevCacheStr = scope .();
gApp.mBfBuildCompiler.GetBuildValue(projectBuildDir, "Link", prevCacheStr);
if (prevCacheStr != cacheStr)