From 145ba4b0a3733a947326ed34b7c96c73affb2081 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Thu, 27 Jul 2023 07:16:00 -0700 Subject: [PATCH] Disable LTO for wasm release --- IDE/src/BuildOptions.bf | 11 +++++++++-- IDE/src/Workspace.bf | 18 ++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/IDE/src/BuildOptions.bf b/IDE/src/BuildOptions.bf index 39260028..b600af2d 100644 --- a/IDE/src/BuildOptions.bf +++ b/IDE/src/BuildOptions.bf @@ -7,8 +7,15 @@ namespace IDE { public enum LTOType { - None, - Thin, + case None; + case Thin; + + public static LTOType GetDefaultFor(Workspace.PlatformType platformType, bool isRelease) + { + if ((platformType == .Windows) && (isRelease)) + return .Thin; + return .None; + } } public enum EmitDebugInfo diff --git a/IDE/src/Workspace.bf b/IDE/src/Workspace.bf index 66959065..36937c90 100644 --- a/IDE/src/Workspace.bf +++ b/IDE/src/Workspace.bf @@ -103,7 +103,7 @@ namespace IDE case iOS; case Android; case Wasm; - + public static PlatformType GetFromName(StringView name, StringView targetTriple = default) { if (!targetTriple.IsWhiteSpace) @@ -801,7 +801,7 @@ namespace IDE 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, isRelease ? .Thin : .None); + data.ConditionalAdd("LTOType", options.mLTOType, BuildOptions.LTOType.GetDefaultFor(platformType, isRelease)); data.ConditionalAdd("AllocType", options.mAllocType, isRelease ? .CRT : .Debug); data.ConditionalAdd("AllocMalloc", options.mAllocMalloc, ""); data.ConditionalAdd("AllocFree", options.mAllocFree, ""); @@ -991,16 +991,10 @@ namespace IDE options.mBfOptimizationLevel = isRelease ? .O2 : .O0; options.mBfSIMDSetting = .SSE2; if (platformType == .Windows) - { - options.mLTOType = isRelease ? .Thin : .None; options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0; - options.mToolsetType = isRelease ? .LLVM : .Microsoft; - } - else if ((platformType == .macOS) == (platformType == .Linux)) - { - options.mLTOType = isRelease ? .Thin : .None; - options.mToolsetType = isRelease ? .LLVM : .GNU; - } + + options.mLTOType = BuildOptions.LTOType.GetDefaultFor(platformType, isRelease); + options.mToolsetType = ToolsetType.GetDefaultFor(platformType, isRelease); options.mAllocType = isRelease ? .CRT : .Debug; options.mEmitDebugInfo = .Yes; @@ -1107,7 +1101,7 @@ namespace IDE else options.mBfOptimizationLevel = data.GetEnum("BfOptimizationLevel", isRelease ? .O2 : .O0); - options.mLTOType = data.GetEnum("LTOType", isRelease ? .Thin : .None); + options.mLTOType = data.GetEnum("LTOType", BuildOptions.LTOType.GetDefaultFor(platformType, isRelease)); options.mAllocType = data.GetEnum("AllocType", isRelease ? .CRT : .Debug); data.GetString("AllocMalloc", options.mAllocMalloc); data.GetString("AllocFree", options.mAllocFree);