Skip to content

Commit 645e756

Browse files
authored
Merge pull request #64 from yuchanns/ci/shdc
ci: ensure shdc version
2 parents b048182 + 1b704f0 commit 645e756

File tree

4 files changed

+9
-46
lines changed

4 files changed

+9
-46
lines changed

.github/actions/soluna/action.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,6 @@ runs:
4242
run: |
4343
git submodule update --init --recursive
4444
shell: bash
45-
- uses: actions/checkout@v5
46-
if: steps.cache.outputs.cache-hit != 'true'
47-
with:
48-
repository: floooh/sokol-tools-bin
49-
ref: "a06f19929ff8f9824ec6dd87c21329b1f205809e"
50-
path: sokol-tools-bin
51-
fetch-depth: 1
52-
- name: Setup sokol-shdc
53-
if: steps.cache.outputs.cache-hit != 'true'
54-
shell: bash
55-
run: |
56-
if [[ "$RUNNER_OS" == "Windows" ]]; then
57-
TARGET_DIR="C:/Windows/System32"
58-
SHDC_BINARY="sokol-shdc.exe"
59-
FIND_PATH="bin/win32"
60-
elif [[ "$RUNNER_OS" == "macOS" ]]; then
61-
TARGET_DIR="/usr/local/bin"
62-
SHDC_BINARY="sokol-shdc"
63-
FIND_PATH="bin/osx_arm64"
64-
else # Linux
65-
TARGET_DIR="/usr/local/bin"
66-
SHDC_BINARY="sokol-shdc"
67-
FIND_PATH="bin/linux"
68-
fi
69-
echo "Setting up sokol-tools from sokol-tools-bin/$FIND_PATH"
70-
find sokol-tools-bin/$FIND_PATH -name $SHDC_BINARY -exec cp {} $TARGET_DIR \;
71-
$SHDC_BINARY -h
7245
- uses: yuchanns/actions-luamake@v1
7346
if: steps.cache.outputs.cache-hit != 'true'
7447
with:

clibs/soluna/compile_shader.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
local lm = require "luamake"
22
local fs = require "bee.filesystem"
33

4-
local shdc<const> = lm.shdc or ""
4+
local paths = {
5+
windows = "$PATH/win32/$NAME.exe",
6+
macos = "$PATH/osx_arm64/$NAME",
7+
linux = "$PATH/linux/$NAME",
8+
}
9+
local shdc = assert(paths[lm.os]):gsub("%$(%u+)", {
10+
PATH = tostring(lm.basedir / "bin/sokol-tools-bin/bin"),
11+
NAME = "sokol-shdc",
12+
})
513

614
local function compile_shader(src, name, lang)
715
local dep = name .. "_shader"

clibs/soluna/make.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if ok then
1919
local output = process.stdout:read "a"
2020
commit = output:match "^%s*(.-)%s*$"
2121
process:wait()
22-
print("Hash version: " .. commit)
2322
end
2423
end
2524

clibs/soluna/shader2c.lua

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
local subprocess = require "bee.subprocess"
2-
local platform = require "bee.platform"
32
local shdcexe, src, target, lang = ...
43

5-
local function find_executable(name)
6-
local handle = io.popen("where " .. name .. " 2>nul")
7-
if handle then
8-
local path = handle:read("*line")
9-
local success = handle:close()
10-
if success and path and path ~= "" then
11-
return path:gsub("%s+$", "")
12-
end
13-
end
14-
return name
15-
end
16-
17-
if shdcexe == "" then
18-
shdcexe = platform.os == "windows" and find_executable("sokol-shdc.exe") or "sokol-shdc"
19-
end
20-
214
local process = assert(subprocess.spawn {
225
shdcexe,
236
"--input",

0 commit comments

Comments
 (0)