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

StaticLib build now properly creates a merged archive

This commit is contained in:
Brian Fiete 2021-06-29 06:02:15 -07:00
parent 463ef98789
commit b775058393

View file

@ -182,7 +182,11 @@ namespace IDE
//String error = scope String(); //String error = scope String();
bool isTest = options.mBuildOptions.mBuildKind == .Test; bool isTest = options.mBuildOptions.mBuildKind == .Test;
bool isExe = ((project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) && (project.mGeneralOptions.mTargetType != Project.TargetType.BeefTest)) || (isTest); bool isExe = ((project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) && (project.mGeneralOptions.mTargetType != Project.TargetType.BeefTest)) || (isTest);
if (!isExe) if ((options.mBuildOptions.mBuildKind == .StaticLib) || (options.mBuildOptions.mBuildKind == .DynamicLib))
{
// Okay
}
else if (!isExe)
return true; return true;
String arCmds = scope String(""); //-O2 -Rpass=inline String arCmds = scope String(""); //-O2 -Rpass=inline
@ -194,7 +198,10 @@ namespace IDE
{ {
if (!obj.IsEmpty) if (!obj.IsEmpty)
{ {
arCmds.AppendF("ADDMOD {}\n", obj); if (obj.EndsWith(".lib", .OrdinalIgnoreCase))
arCmds.AppendF("ADDLIB {}\n", obj);
else
arCmds.AppendF("ADDMOD {}\n", obj);
} }
} }
arCmds.AppendF("SAVE\n"); arCmds.AppendF("SAVE\n");
@ -800,7 +807,7 @@ namespace IDE
bool isExe = ((project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) && (project.mGeneralOptions.mTargetType != Project.TargetType.BeefTest)) || (isTest); bool isExe = ((project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) && (project.mGeneralOptions.mTargetType != Project.TargetType.BeefTest)) || (isTest);
if (options.mBuildOptions.mBuildKind == .DynamicLib) if (options.mBuildOptions.mBuildKind == .DynamicLib)
isExe = true; isExe = true;
if (isExe) if (isExe)
{ {
String linkLine = scope String(); String linkLine = scope String();
@ -1387,8 +1394,19 @@ namespace IDE
gApp.OutputErrorLine("Project '{}' cannot be linked with the Windows Toolset for platform '{}'", project.mProjectName, mPlatformType); gApp.OutputErrorLine("Project '{}' cannot be linked with the Windows Toolset for platform '{}'", project.mProjectName, mPlatformType);
return false; return false;
} }
else if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg)) else
return false; {
if (options.mBuildOptions.mBuildKind == .StaticLib)
{
if (!QueueProjectGNUArchive(project, targetPath, workspaceOptions, options, objectsArg))
return false;
}
else
{
if (!QueueProjectMSLink(project, targetPath, configSelection.mConfig, workspaceOptions, options, objectsArg))
return false;
}
}
} }
return true; return true;