mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-01 18:50:16 +03:00
Add optional LTO and harden Windows clipboard handling
- add --with-lto support to Premake 4 and 5 release builds - use ThinLTO with Clang, automatic LTO with GCC, and LTCG with MSVC - exclude Emscripten builds from LTO configuration - retry SDL2 clipboard writes on Windows when the clipboard is temporarily unavailable - make the UIMergeView copy regression test independent of the system clipboard
This commit is contained in:
@@ -43,6 +43,10 @@ function newclangtoolchain(toolchain)
|
||||
}
|
||||
end
|
||||
|
||||
function is_clang()
|
||||
return _OPTIONS.platform == "clang" or os.is_real("macosx") or os.is_real("ios")
|
||||
end
|
||||
|
||||
newplatform {
|
||||
name = "clang",
|
||||
description = "Clang",
|
||||
@@ -182,6 +186,7 @@ newoption {
|
||||
description = "Set the shared data directory (default: /usr/share/ecode)",
|
||||
}
|
||||
newoption { trigger = "with-static-cpp", description = "Builds statically libstdc++" }
|
||||
newoption { trigger = "with-lto", description = "Enables Link-Time Optimization for release builds." }
|
||||
|
||||
function explode(div,str)
|
||||
if (div=='') then return false end
|
||||
@@ -747,6 +752,23 @@ function parse_args()
|
||||
if _OPTIONS["time-trace"] then
|
||||
buildoptions { "-ftime-trace" }
|
||||
end
|
||||
|
||||
if _OPTIONS["with-lto"] and not os.is_real("emscripten") then
|
||||
configuration "release"
|
||||
|
||||
if is_vs() then
|
||||
buildoptions { "/GL" }
|
||||
linkoptions { "/LTCG" }
|
||||
elseif is_clang() then
|
||||
buildoptions { "-flto=thin" }
|
||||
linkoptions { "-flto=thin" }
|
||||
else
|
||||
buildoptions { "-flto=auto" }
|
||||
linkoptions { "-flto=auto" }
|
||||
end
|
||||
|
||||
configuration {}
|
||||
end
|
||||
end
|
||||
|
||||
function add_static_links()
|
||||
|
||||
Reference in New Issue
Block a user