generated from nodef/linmath.c
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
51 lines (44 loc) · 1.15 KB
/
build.sh
File metadata and controls
51 lines (44 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Fetch the latest version of the library
fetch() {
if [ -d "EGL" ] && [ -d "KHR" ]; then return; fi
URL="https://github.com/KhronosGroup/EGL-Registry/archive/refs/heads/main.zip"
ZIP="${URL##*/}"
DIR="EGL-Registry-main"
mkdir -p .build
cd .build
# Download the release
if [ ! -f "$ZIP" ]; then
echo "Downloading $ZIP from $URL ..."
curl -L "$URL" -o "$ZIP"
echo ""
fi
# Unzip the release
if [ ! -d "$DIR" ]; then
echo "Unzipping $ZIP to .build/$DIR ..."
cp "$ZIP" "$ZIP.bak"
unzip -q "$ZIP"
rm "$ZIP"
mv "$ZIP.bak" "$ZIP"
echo ""
fi
cd ..
# Copy the libs to the package directory
echo "Copying libs to EGL/ and KHR/ ..."
rm -rf EGL KHR
mkdir -p EGL KHR
cp -f ".build/$DIR/api/EGL"/* EGL/
cp -f ".build/$DIR/api/KHR"/* KHR/
echo ""
}
# Test the project
test() {
echo "Running 01-basic-rendering.c ..."
clang -I. -o 01.exe examples/01-basic-rendering.c && ./01.exe && echo -e "\n"
# echo "Running 02-advanced-texture.c ..."
# clang -I. -o 02.exe examples/02-advanced-texture.c && ./02.exe && echo -e "\n"
}
# Main script
if [[ "$1" == "test" ]]; then test
elif [[ "$1" == "fetch" ]]; then fetch
else echo "Usage: $0 {fetch|test}"; fi