Skip to content

Commit f44b44c

Browse files
committed
fix
1 parent 85770a6 commit f44b44c

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

premake5.lua

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ USE_SIMD = "best"
2323
-- so we can only distinguish between AARCH64 and x86, and must use the ARM build of Premake5 on ARM platforms.
2424
PREMAKE_ARCH = os.hostarch()
2525

26+
-- Return val if it's not nil; otherwise, return default.
27+
local function ifnil(val, default)
28+
if val ~= nil then
29+
return val
30+
else
31+
return default
32+
end
33+
end
34+
2635
---- Dependency settings
2736

2837
--- When building dependencies from source, the corresponding source code must be placed in the corresponding location
@@ -170,9 +179,10 @@ MINIAUDIO_DEPENDENCIES_METADATA = {
170179
--- otherwise, the premake option default will always take priority over environment variables.
171180

172181
for _, dep in ipairs(DEPENDENCIES_METADATA) do
173-
local name = dep.name
174-
local cat = "YGOPro - " .. name
175-
newoption { trigger = "build-" .. name, category = cat, description = "" }
182+
local name = dep.name
183+
local cat = "YGOPro - " .. name
184+
local build = ifnil(_G["BUILD_" .. string.upper(name)], BUILD_ALL_FROM_SOURCE)
185+
newoption { trigger = "build-" .. name, category = cat, description = "Build " .. name .. " from source; default: " .. tostring(build) }
176186
newoption { trigger = "no-build-" .. name, category = cat, description = "" }
177187
newoption { trigger = name .. "-include-dir", category = cat, description = "", value = "PATH" }
178188
newoption { trigger = name .. "-lib-dir", category = cat, description = "", value = "PATH" }
@@ -194,9 +204,12 @@ newoption { trigger = "no-audio", category = "YGOPro", description = "Disable au
194204
newoption { trigger = "audio-lib", category = "YGOPro", description = "Specify audio library (only miniaudio is supported for now)", value = "NAME" }
195205

196206
newoption { trigger = "miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "Enable support for OGG format (Opus and Vorbis) in miniaudio" }
197-
newoption { trigger = "no-miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "Disable support for OGG format in miniaudio" }
198-
newoption { trigger = "build-opus-vorbis", category = "YGOPro - miniaudio", description = "Build Opus and Vorbis libraries from source" }
199-
newoption { trigger = "no-build-opus-vorbis", category = "YGOPro - miniaudio", description = "Do not build Opus and Vorbis libraries from source" }
207+
newoption { trigger = "no-miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
208+
do
209+
local build_opus_vorbis = ifnil(_G["BUILD_OPUS_VORBIS"], BUILD_ALL_FROM_SOURCE)
210+
newoption { trigger = "build-opus-vorbis", category = "YGOPro - miniaudio", description = "Build Opus and Vorbis libraries from source; default: " .. tostring(build_opus_vorbis) }
211+
newoption { trigger = "no-build-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
212+
end
200213

201214
newoption { trigger = "vs2026-win7-support", category = "YGOPro", description = "Enable Windows 7 support (toolset v143) for Visual Studio 2026" }
202215

@@ -215,15 +228,6 @@ newoption { trigger = "use-simd", category = "YGOPro", description = "Specify SI
215228

216229
---- Process options
217230

218-
-- Return val if it's not nil; otherwise, return default.
219-
local function ifnil(val, default)
220-
if val ~= nil then
221-
return val
222-
else
223-
return default
224-
end
225-
end
226-
227231
-- Read settings from command line or environment variables.
228232
-- Command-line options take priority over environment variables.
229233
local function GetParam(param)

0 commit comments

Comments
 (0)