Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions clibs/soluna/compile_shader.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
local lm = require "luamake"
local fs = require "bee.filesystem"
local platform = require "bee.platform"

local function shdc_plat()
if lm.os == "windows" then
return "win32"
end
if lm.os == "linux" then
return "linux"
end
if lm.os == "macos" then
return platform.Arch == "arm64" and "osx_arm64" or "osx"
end
return "unknown"
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实,我觉得这样写比较简单:

local plat = lm.os
if plat == "macos" then
  plat  = plat.."_"..platform.Arch
end

然后在 paths 数组里加一项 macos_arm64 / macos_x86 ? 的 key 就可以了。

local paths = {
windows = "$PATH/win32/$NAME.exe",
macos = "$PATH/osx_arm64/$NAME",
linux = "$PATH/linux/$NAME",
windows = "$PATH/$NAME.exe",
macos = "$PATH/$NAME",
linux = "$PATH/$NAME",
}
local shdc = assert(paths[lm.os]):gsub("%$(%u+)", {
PATH = tostring(lm.basedir / "bin/sokol-tools-bin/bin"),
PATH = tostring(lm.basedir / "bin/sokol-tools-bin/bin" / shdc_plat()),
NAME = "sokol-shdc",
})

Expand Down