Skip to content

Commit 591cec7

Browse files
Move Premake option defaults into build logic (#3080)
1 parent f64a7b4 commit 591cec7

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

premake5.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ MINIAUDIO_OPUS_INCLUDE_DIR = path.getabsolute("./miniaudio/extras/decoders/libop
6363
MINIAUDIO_VORBIS_INCLUDE_DIR = path.getabsolute("./miniaudio/extras/decoders/libvorbis")
6464

6565
-- Read settings from command line or environment variables
66+
-- Default values should be defined at the top of the script. If any values are set in the premake options, GetParam will not
67+
-- read them from environment variables.
6668

6769
newoption { trigger = "build-lua", category = "YGOPro - lua", description = "" }
6870
newoption { trigger = "no-build-lua", category = "YGOPro - lua", description = "" }
6971
newoption { trigger = "lua-include-dir", category = "YGOPro - lua", description = "", value = "PATH" }
7072
newoption { trigger = "lua-lib-dir", category = "YGOPro - lua", description = "", value = "PATH" }
71-
newoption { trigger = "lua-lib-name", category = "YGOPro - lua", description = "", value = "NAME", default = LUA_LIB_NAME }
73+
newoption { trigger = "lua-lib-name", category = "YGOPro - lua", description = "", value = "NAME" }
7274

7375
newoption { trigger = "build-event", category = "YGOPro - event", description = "" }
7476
newoption { trigger = "no-build-event", category = "YGOPro - event", description = "" }
@@ -95,7 +97,7 @@ newoption { trigger = "build-jpeg", category = "YGOPro - jpeg", description = ""
9597
newoption { trigger = "no-build-jpeg", category = "YGOPro - jpeg", description = "" }
9698
newoption { trigger = "jpeg-include-dir", category = "YGOPro - jpeg", description = "", value = "PATH" }
9799
newoption { trigger = "jpeg-lib-dir", category = "YGOPro - jpeg", description = "", value = "PATH" }
98-
newoption { trigger = "jpeg-lib-name", category = "YGOPro - jpeg", description = "", value = "NAME", default = JPEG_LIB_NAME }
100+
newoption { trigger = "jpeg-lib-name", category = "YGOPro - jpeg", description = "", value = "NAME" }
99101

100102
newoption { trigger = "build-png", category = "YGOPro - png", description = "" }
101103
newoption { trigger = "no-build-png", category = "YGOPro - png", description = "" }
@@ -106,10 +108,10 @@ newoption { trigger = "build-zlib", category = "YGOPro - zlib", description = ""
106108
newoption { trigger = "no-build-zlib", category = "YGOPro - zlib", description = "" }
107109
newoption { trigger = "zlib-include-dir", category = "YGOPro - zlib", description = "", value = "PATH" }
108110
newoption { trigger = "zlib-lib-dir", category = "YGOPro - zlib", description = "", value = "PATH" }
109-
newoption { trigger = "zlib-lib-name", category = "YGOPro - zlib", description = "", value = "NAME", default = ZLIB_LIB_NAME }
111+
newoption { trigger = "zlib-lib-name", category = "YGOPro - zlib", description = "", value = "NAME" }
110112

111113
newoption { trigger = "no-audio", category = "YGOPro", description = "" }
112-
newoption { trigger = "audio-lib", category = "YGOPro", description = "", value = "", default = AUDIO_LIB }
114+
newoption { trigger = "audio-lib", category = "YGOPro", description = "", value = "" }
113115

114116
newoption { trigger = "miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
115117
newoption { trigger = "no-miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
@@ -129,7 +131,7 @@ newoption { trigger = "mac-intel", category = "YGOPro", description = "Cross Com
129131

130132
newoption { trigger = "use-openmp", category = "YGOPro", description = "Enable OpenMP support (edge case)" }
131133

132-
newoption { trigger = "use-simd", category = "YGOPro", description = "", value = "none, sse2, avx2, neon, best", default = "best" }
134+
newoption { trigger = "use-simd", category = "YGOPro", description = "", value = "none, sse2, avx2, neon, best" }
133135

134136
function GetParam(param)
135137
return _OPTIONS[param] or os.getenv(string.upper(string.gsub(param,"-","_")))
@@ -279,9 +281,7 @@ if USE_AUDIO then
279281
end
280282
end
281283

282-
if GetParam("use-simd") then
283-
USE_SIMD = GetParam("use-simd")
284-
end
284+
USE_SIMD = GetParam("use-simd") or USE_SIMD
285285

286286
if not MAC_ARM and not MAC_INTEL and table.indexof({ "x86", "x86_64", "ARM64" }, PREMAKE_ARCH) == nil then
287287
print("Warning: Detected architecture " .. PREMAKE_ARCH .. " seems not supported, trying to build anyway, SIMD will be disabled.")

0 commit comments

Comments
 (0)