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

Enable LTO by default in release configs

This commit is contained in:
Brian Fiete 2022-01-11 10:36:54 -05:00
parent bf97431cdb
commit 0f694cf33d

View file

@ -110,10 +110,12 @@ namespace IDE
case Microsoft;
case LLVM;
public static ToolsetType GetDefaultFor(PlatformType platformType)
public static ToolsetType GetDefaultFor(PlatformType platformType, bool isRelease)
{
if (isRelease)
return .LLVM;
if (platformType == .Windows)
return Microsoft;
return .Microsoft;
return .GNU;
}
}
@ -676,14 +678,14 @@ namespace IDE
data.RemoveIfEmpty();
}
data.ConditionalAdd("Toolset", options.mToolsetType, ToolsetType.GetDefaultFor(platformType));
data.ConditionalAdd("Toolset", options.mToolsetType, ToolsetType.GetDefaultFor(platformType, isRelease));
data.ConditionalAdd("BuildKind", options.mBuildKind, isTest ? .Test : .Normal);
data.ConditionalAdd("BfSIMDSetting", options.mBfSIMDSetting, .SSE2);
if (platformType == .Windows)
data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0);
else
data.ConditionalAdd("BfOptimizationLevel", options.mBfOptimizationLevel, isRelease ? .O2 : .O0);
data.ConditionalAdd("LTOType", options.mLTOType, .None);
data.ConditionalAdd("LTOType", options.mLTOType, isRelease ? .Thin : .None);
data.ConditionalAdd("AllocType", options.mAllocType, isRelease ? .CRT : .Debug);
data.ConditionalAdd("AllocMalloc", options.mAllocMalloc, "");
data.ConditionalAdd("AllocFree", options.mAllocFree, "");
@ -874,12 +876,14 @@ namespace IDE
options.mBfSIMDSetting = .SSE2;
if (platformType == .Windows)
{
options.mLTOType = isRelease ? .Thin : .None;
options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0;
options.mToolsetType = .Microsoft;
options.mToolsetType = isRelease ? .LLVM : .Microsoft;
}
else if ((platformType == .macOS) == (platformType == .Linux))
{
options.mToolsetType = .GNU;
options.mLTOType = isRelease ? .Thin : .None;
options.mToolsetType = isRelease ? .LLVM : .GNU;
}
options.mAllocType = isRelease ? .CRT : .Debug;
@ -977,7 +981,7 @@ namespace IDE
options.mPreprocessorMacros.Add(str);
}
options.mToolsetType = data.GetEnum<ToolsetType>("Toolset", ToolsetType.GetDefaultFor(platformType));
options.mToolsetType = data.GetEnum<ToolsetType>("Toolset", ToolsetType.GetDefaultFor(platformType, isRelease));
options.mBuildKind = data.GetEnum<BuildKind>("BuildKind", isTest ? .Test : .Normal);
options.mBfSIMDSetting = data.GetEnum<BuildOptions.SIMDSetting>("BfSIMDSetting", .SSE2);
if (platformType == .Windows)
@ -985,7 +989,7 @@ namespace IDE
else
options.mBfOptimizationLevel = data.GetEnum<BuildOptions.BfOptimizationLevel>("BfOptimizationLevel", isRelease ? .O2 : .O0);
options.mLTOType = data.GetEnum<BuildOptions.LTOType>("LTOType", .None);
options.mLTOType = data.GetEnum<BuildOptions.LTOType>("LTOType", isRelease ? .Thin : .None);
options.mAllocType = data.GetEnum<AllocType>("AllocType", isRelease ? .CRT : .Debug);
data.GetString("AllocMalloc", options.mAllocMalloc);
data.GetString("AllocFree", options.mAllocFree);