Skip to content

Commit bab9430

Browse files
committed
angle sub depends
1 parent bd67060 commit bab9430

File tree

1 file changed

+142
-16
lines changed

1 file changed

+142
-16
lines changed

apothecary/formulas/angle/angle.sh

+142-16
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,129 @@ GIT_URL=https://github.com/google/angle/archive/refs/heads/$VER_FULL.tar.gz
1919
GIT_TAG=v$VER
2020

2121
function download() {
22-
. "$DOWNLOADER_SCRIPT"
23-
downloader ${GIT_URL}
24-
tar -xf $VER.tar.gz
25-
mv "angle-chromium-$VER" angle
26-
rm -f $VER.tar.gz
22+
# . "$DOWNLOADER_SCRIPT"
23+
# downloader ${GIT_URL}
24+
# tar -xf $VER.tar.gz
25+
# mv "angle-chromium-$VER" angle
26+
# rm -f $VER.tar.gz
27+
28+
if [ -d "angle" ]; then
29+
echo "Removing existing ANGLE directory..."
30+
rm -rf angle
31+
fi
32+
33+
echo "Cloning ANGLE repository from ${GIT_URL}..."
34+
35+
# Clone the repository with submodules
36+
git clone --recursive --depth=1 --branch "$VER_FULL" https://github.com/google/angle.git
37+
38+
if [ $? -ne 0 ]; then
39+
echo "Failed to clone ANGLE repository!"
40+
exit 1
41+
fi
42+
43+
cd angle || exit
44+
45+
echo "Checking out branch/tag: $VER_FULL..."
46+
git fetch --tags
47+
git checkout "$VER_FULL"
48+
49+
# # Ensure submodules are fully updated
50+
# echo "Updating ANGLE submodules..."
51+
# git submodule update --init --recursive
52+
53+
case "$TYPE" in
54+
vs) # Windows (Direct3D, Vulkan)
55+
REQUIRED_SUBMODULES=(
56+
"build"
57+
"buildtools"
58+
"third_party/dawn"
59+
"third_party/glslang/src"
60+
"third_party/vulkan-headers/src"
61+
"third_party/vulkan-loader/src"
62+
"third_party/vulkan-tools/src"
63+
"third_party/vulkan-validation-layers/src"
64+
"third_party/vulkan_memory_allocator"
65+
"tools/python"
66+
)
67+
;;
68+
osx|ios|tvos|xros|catos|watchos) # Apple platforms (Metal, OpenGL)
69+
REQUIRED_SUBMODULES=(
70+
"build"
71+
"buildtools"
72+
"third_party/dawn"
73+
"third_party/glslang/src"
74+
"third_party/EGL-Registry/src"
75+
"third_party/OpenGL-Registry/src"
76+
"third_party/spirv-tools/src"
77+
"tools/python"
78+
"tools/clang"
79+
)
80+
;;
81+
android) # Android (Vulkan, GLES)
82+
REQUIRED_SUBMODULES=(
83+
"build"
84+
"buildtools"
85+
"third_party/android_build_tools"
86+
"third_party/android_deps"
87+
"third_party/android_platform"
88+
"third_party/android_sdk"
89+
"third_party/dawn"
90+
"third_party/glslang/src"
91+
"third_party/vulkan-headers/src"
92+
"third_party/vulkan-loader/src"
93+
"third_party/vulkan-tools/src"
94+
"third_party/vulkan-validation-layers/src"
95+
"third_party/vulkan_memory_allocator"
96+
"tools/python"
97+
"tools/clang"
98+
"tools/android"
99+
)
100+
;;
101+
linux) # Linux (OpenGL, Vulkan)
102+
REQUIRED_SUBMODULES=(
103+
"build"
104+
"buildtools"
105+
"third_party/dawn"
106+
"third_party/glslang/src"
107+
"third_party/EGL-Registry/src"
108+
"third_party/OpenGL-Registry/src"
109+
"third_party/spirv-tools/src"
110+
"third_party/wayland"
111+
"third_party/libdrm/src"
112+
"tools/python"
113+
)
114+
;;
115+
emscripten) # WebAssembly (WebGL)
116+
REQUIRED_SUBMODULES=(
117+
"build"
118+
"buildtools"
119+
"third_party/dawn"
120+
"third_party/glslang/src"
121+
"third_party/EGL-Registry/src"
122+
"third_party/OpenGL-Registry/src"
123+
"third_party/spirv-tools/src"
124+
"tools/python"
125+
)
126+
;;
127+
*)
128+
echo "Unsupported TYPE: $TYPE"
129+
exit 1
130+
;;
131+
esac
132+
133+
echo "Initializing required submodules..."
134+
for submodule in "${REQUIRED_SUBMODULES[@]}"; do
135+
git submodule update --init --recursive "$submodule"
136+
done
137+
138+
cd ..
139+
27140
}
28141

142+
143+
144+
29145
function prepare() {
30146
# If needed, copy any patch files or configuration scripts.
31147
# For GN, ANGLE already includes the necessary BUILD.gn files.
@@ -84,6 +200,12 @@ function build() {
84200
rm -rf build_${TYPE}_${ARCH}
85201
mkdir -p "build_${TYPE}_${ARCH}"
86202

203+
rm -rf out/Debug
204+
mkdir -p "out/Debug"
205+
206+
rm -rf out/Release
207+
mkdir -p "out/Release"
208+
87209
export DEPOT_TOOLS_UPDATE=0
88210
if [[ ":$PATH:" != *":$PWD/depot_tools:"* ]]; then
89211
export PATH="$PWD/depot_tools:$PATH"
@@ -102,6 +224,7 @@ function build() {
102224
angle_enable_essl=true
103225
angle_enable_glsl=true
104226
angle_enable_cl=false
227+
is_clang=true
105228

106229
is_component_build=false
107230
is_debug=false
@@ -111,6 +234,7 @@ function build() {
111234
vs)
112235
angle_enable_d3d11=true
113236
angle_enable_vulkan=true
237+
is_clang=false
114238
;;
115239
osx)
116240
angle_enable_metal=true
@@ -181,18 +305,17 @@ function build() {
181305
echoInfo "gn --version: [$(gn --version)]"
182306
echoInfo "ninja --version: [$(ninja --version)]"
183307
echoInfo "Generating GN build files in [build_${TYPE}_${ARCH}]"
184-
gn gen "build_${TYPE}_${ARCH}" --args="$GN_ARGS"
185-
ninja -C "build_${TYPE}_${ARCH}" -j${PARALLEL_MAKE}
186-
if [ $? -ne 0 ]; then
187-
echo "GN generation failed"
188-
exit 1
308+
309+
if [ $TYPE == "vs" ]; then
310+
gn gen out/Debug --sln=angle-debug --ide=vs2022
311+
else
312+
gn gen --args=$GN_ARGS out/Debug
189313
fi
190-
echoInfo "Building ANGLE with Ninja..."
314+
315+
autoninja -C out/Debug
316+
317+
#ninja -C "out/Debug" -j${PARALLEL_MAKE}
191318

192-
if [ $? -ne 0 ]; then
193-
echo "Ninja build failed"
194-
exit 1
195-
fi
196319
}
197320

198321
function copy() {
@@ -223,5 +346,8 @@ function copy() {
223346

224347
# Clean the GN build output.
225348
function clean() {
226-
rm -rf out/angle
349+
if [ -d "build_${TYPE}_${ARCH}" ]; then
350+
echo "Removing existing build directory: build_${TYPE}_${ARCH}"
351+
rm -rf "build_${TYPE}_${ARCH}"
352+
fi
227353
}

0 commit comments

Comments
 (0)