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,42 +401,17 @@ 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);
for (var depProject in depProjectList) AddLinkDeps(project, options, workspaceOptions, linkLine, libPaths, depPaths);
{
/*if (depProject.mNeedsTargetRebuild)
project.mNeedsTargetRebuild = true;*/
var depOptions = gApp.GetCurProjectOptions(depProject); for (var libPath in libPaths)
{
if (depOptions.mClangObjectFiles != null) IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
{ linkLine.Append(" ");
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;
String clangExePath; String clangExePath;
@ -648,6 +623,82 @@ namespace IDE
return true; return true;
} }
void AddLinkDeps(Project project, Project.Options options, Workspace.Options workspaceOptions, String linkLine, List<String> libPaths, List<String> depPaths)
{
void AddLibPath(StringView libPathIn, Project project, Project.Options projectOptions)
{
var libPath = new String();
if (gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, projectOptions, libPathIn, "lib paths", libPath))
{
IDEUtils.FixFilePath(libPath);
libPaths.Add(libPath);
}
}
defer ClearAndDeleteItems(depPaths);
void AddDepPath(StringView depPathIn, Project project, Project.Options projectOptions)
{
var depPath = new String();
if (gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, projectOptions, depPathIn, "dep paths", depPath))
{
IDEUtils.FixFilePath(depPath);
depPaths.Add(depPath);
}
}
for (let libPath in options.mBuildOptions.mLibPaths)
AddLibPath(libPath, project, options);
for (let depPath in options.mBuildOptions.mLinkDependencies)
AddDepPath(depPath, project, options);
List<Project> depProjectList = scope List<Project>();
gApp.GetDependentProjectList(project, depProjectList);
if (depProjectList.Count > 0)
{
for (var depProject in depProjectList)
{
var depOptions = gApp.GetCurProjectOptions(depProject);
if (depOptions != null)
{
if (depOptions.mClangObjectFiles != null)
{
var argBuilder = scope IDEApp.ArgBuilder(linkLine, true);
for (var fileName in depOptions.mClangObjectFiles)
{
argBuilder.AddFileName(fileName);
argBuilder.AddSep();
}
}
}
if (depProject.mGeneralOptions.mTargetType == .BeefDynLib)
{
if (mImpLibMap.TryGetValue(depProject, var libPath))
{
IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
linkLine.Append(" ");
}
}
if (depProject.mGeneralOptions.mTargetType == .BeefLib)
{
let depProjectOptions = gApp.GetCurProjectOptions(depProject);
var linkFlags = scope String();
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, depProject, depProjectOptions, depProjectOptions.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
if (!linkFlags.IsWhiteSpace)
linkLine.Append(linkFlags, " ");
for (let libPath in depProjectOptions.mBuildOptions.mLibPaths)
AddLibPath(libPath, depProject, depProjectOptions);
for (let depPath in depProjectOptions.mBuildOptions.mLinkDependencies)
AddDepPath(depPath, depProject, depProjectOptions);
}
}
}
}
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;
@ -693,78 +744,9 @@ namespace IDE
List<String> libPaths = scope .(); List<String> libPaths = scope .();
defer ClearAndDeleteItems(libPaths); defer ClearAndDeleteItems(libPaths);
void AddLibPath(StringView libPathIn, Project project, Project.Options projectOptions)
{
var libPath = new String();
if (gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, projectOptions, libPathIn, "lib paths", libPath))
{
IDEUtils.FixFilePath(libPath);
libPaths.Add(libPath);
}
}
List<String> depPaths = scope .(); List<String> depPaths = scope .();
defer ClearAndDeleteItems(depPaths); defer ClearAndDeleteItems(depPaths);
void AddDepPath(StringView depPathIn, Project project, Project.Options projectOptions) AddLinkDeps(project, options, workspaceOptions, linkLine, libPaths, depPaths);
{
var depPath = new String();
if (gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, projectOptions, depPathIn, "dep paths", depPath))
{
IDEUtils.FixFilePath(depPath);
depPaths.Add(depPath);
}
}
for (let libPath in options.mBuildOptions.mLibPaths)
AddLibPath(libPath, project, options);
for (let depPath in options.mBuildOptions.mLinkDependencies)
AddDepPath(depPath, project, options);
List<Project> depProjectList = scope List<Project>();
gApp.GetDependentProjectList(project, depProjectList);
if (depProjectList.Count > 0)
{
for (var depProject in depProjectList)
{
var depOptions = gApp.GetCurProjectOptions(depProject);
if (depOptions != null)
{
if (depOptions.mClangObjectFiles != null)
{
var argBuilder = scope IDEApp.ArgBuilder(linkLine, true);
for (var fileName in depOptions.mClangObjectFiles)
{
argBuilder.AddFileName(fileName);
argBuilder.AddSep();
}
}
}
if (depProject.mGeneralOptions.mTargetType == .BeefDynLib)
{
if (mImpLibMap.TryGetValue(depProject, var libPath))
{
IDEUtils.AppendWithOptionalQuotes(linkLine, libPath);
linkLine.Append(" ");
}
}
if (depProject.mGeneralOptions.mTargetType == .BeefLib)
{
let depProjectOptions = gApp.GetCurProjectOptions(depProject);
var linkFlags = scope String();
gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, depProject, depProjectOptions, depProjectOptions.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags);
if (!linkFlags.IsWhiteSpace)
linkLine.Append(linkFlags, " ");
for (let libPath in depProjectOptions.mBuildOptions.mLibPaths)
AddLibPath(libPath, depProject, depProjectOptions);
for (let depPath in depProjectOptions.mBuildOptions.mLinkDependencies)
AddDepPath(depPath, depProject, depProjectOptions);
}
}
}
/*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)