Skip to content

Commit 3439b61

Browse files
committed
update
1 parent 828a6ed commit 3439b61

4 files changed

Lines changed: 83 additions & 8 deletions

File tree

Code.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3876,7 +3876,7 @@
38763876
shellPath = /bin/sh;
38773877
shellScript = (
38783878
"set -eu",
3879-
"export PATH=\"/opt/homebrew/bin:${PATH}\"",
3879+
"export PATH=\"/opt/homebrew/bin:/usr/local/bin:${PATH}\"",
38803880
"mkdir -p \"${PROJECT_DIR}/Resources/NodeJS\"",
38813881
"\"${PROJECT_DIR}/examples/wasm-cuda-oxide/build.sh\" \"${PROJECT_DIR}/Resources/NodeJS/cuda_oxide_probe.wasm\"",
38823882
"\"${PROJECT_DIR}/examples/wasm-cuda-ptx/build.sh\" \"${PROJECT_DIR}/Resources/NodeJS/cuda_ptx_probe.wasm\"",
@@ -3904,7 +3904,7 @@
39043904
shellPath = /bin/sh;
39053905
shellScript = (
39063906
"set -eu",
3907-
"export PATH=\"/opt/homebrew/bin:${PATH}\"",
3907+
"export PATH=\"/opt/homebrew/bin:/usr/local/bin:${PATH}\"",
39083908
"mkdir -p \"${PROJECT_DIR}/Resources/NodeJS\"",
39093909
"\"${PROJECT_DIR}/examples/wasm-cuda-oxide/build.sh\" \"${PROJECT_DIR}/Resources/NodeJS/cuda_oxide_probe.wasm\"",
39103910
"\"${PROJECT_DIR}/examples/wasm-cuda-ptx/build.sh\" \"${PROJECT_DIR}/Resources/NodeJS/cuda_ptx_probe.wasm\"",

examples/wasm-cuda-oxide/build.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,35 @@ set -eu
33

44
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
55
OUT=${1:-"$SCRIPT_DIR/cuda_oxide_probe.wasm"}
6-
CLANG=${CLANG:-$(xcrun --find clang 2>/dev/null || command -v clang || printf '%s' /usr/bin/clang)}
7-
WASM_LD=${WASM_LD:-$(xcrun --find wasm-ld 2>/dev/null || command -v wasm-ld || printf '%s' /opt/homebrew/bin/wasm-ld)}
86
OBJ=${TMPDIR:-/tmp}/cuda_oxide_probe.$$.o
97

8+
find_tool() {
9+
name=$1
10+
env_name=$2
11+
shift 2
12+
13+
if found=$(xcrun --find "$name" 2>/dev/null) && [ -x "$found" ]; then
14+
printf '%s\n' "$found"
15+
return 0
16+
fi
17+
if found=$(command -v "$name" 2>/dev/null) && [ -n "$found" ]; then
18+
printf '%s\n' "$found"
19+
return 0
20+
fi
21+
for candidate do
22+
if [ -x "$candidate" ]; then
23+
printf '%s\n' "$candidate"
24+
return 0
25+
fi
26+
done
27+
28+
printf 'error: %s not found; install it or set %s\n' "$name" "$env_name" >&2
29+
return 1
30+
}
31+
32+
CLANG=${CLANG:-$(find_tool clang CLANG /usr/bin/clang)}
33+
WASM_LD=${WASM_LD:-$(find_tool wasm-ld WASM_LD /opt/homebrew/bin/wasm-ld /usr/local/bin/wasm-ld)}
34+
1035
cleanup() {
1136
rm -f "$OBJ"
1237
}

examples/wasm-cuda-ptx/build.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,35 @@ set -eu
33

44
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
55
OUT=${1:-"$SCRIPT_DIR/cuda_ptx_probe.wasm"}
6-
CLANG=${CLANG:-$(xcrun --find clang 2>/dev/null || command -v clang || printf '%s' /usr/bin/clang)}
7-
WASM_LD=${WASM_LD:-$(xcrun --find wasm-ld 2>/dev/null || command -v wasm-ld || printf '%s' /opt/homebrew/bin/wasm-ld)}
86
OBJ=${TMPDIR:-/tmp}/cuda_ptx_probe.$$.o
97

8+
find_tool() {
9+
name=$1
10+
env_name=$2
11+
shift 2
12+
13+
if found=$(xcrun --find "$name" 2>/dev/null) && [ -x "$found" ]; then
14+
printf '%s\n' "$found"
15+
return 0
16+
fi
17+
if found=$(command -v "$name" 2>/dev/null) && [ -n "$found" ]; then
18+
printf '%s\n' "$found"
19+
return 0
20+
fi
21+
for candidate do
22+
if [ -x "$candidate" ]; then
23+
printf '%s\n' "$candidate"
24+
return 0
25+
fi
26+
done
27+
28+
printf 'error: %s not found; install it or set %s\n' "$name" "$env_name" >&2
29+
return 1
30+
}
31+
32+
CLANG=${CLANG:-$(find_tool clang CLANG /usr/bin/clang)}
33+
WASM_LD=${WASM_LD:-$(find_tool wasm-ld WASM_LD /opt/homebrew/bin/wasm-ld /usr/local/bin/wasm-ld)}
34+
1035
cleanup() {
1136
rm -f "$OBJ"
1237
}

examples/wasm-proton-display/build.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,33 @@ set -euo pipefail
33

44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
OUT=${1:-"$SCRIPT_DIR/proton_display_probe.wasm"}
6-
CLANG=${CLANG:-$(xcrun --find clang 2>/dev/null || command -v clang || printf '%s' /usr/bin/clang)}
7-
WASM_LD=${WASM_LD:-$(xcrun --find wasm-ld 2>/dev/null || command -v wasm-ld || printf '%s' /opt/homebrew/bin/wasm-ld)}
6+
7+
find_tool() {
8+
name=$1
9+
env_name=$2
10+
shift 2
11+
12+
if found=$(xcrun --find "$name" 2>/dev/null) && [[ -x "$found" ]]; then
13+
printf '%s\n' "$found"
14+
return 0
15+
fi
16+
if found=$(command -v "$name" 2>/dev/null) && [[ -n "$found" ]]; then
17+
printf '%s\n' "$found"
18+
return 0
19+
fi
20+
for candidate in "$@"; do
21+
if [[ -x "$candidate" ]]; then
22+
printf '%s\n' "$candidate"
23+
return 0
24+
fi
25+
done
26+
27+
printf 'error: %s not found; install it or set %s\n' "$name" "$env_name" >&2
28+
return 1
29+
}
30+
31+
CLANG=${CLANG:-$(find_tool clang CLANG /usr/bin/clang)}
32+
WASM_LD=${WASM_LD:-$(find_tool wasm-ld WASM_LD /opt/homebrew/bin/wasm-ld /usr/local/bin/wasm-ld)}
833

934
"$CLANG" \
1035
--target=wasm32-unknown-unknown \

0 commit comments

Comments
 (0)