Skip to content

Commit 5c450b5

Browse files
committed
fetchDependencies need platform parameter
1 parent 1b96a10 commit 5c450b5

File tree

1 file changed

+37
-41
lines changed

1 file changed

+37
-41
lines changed

do-compile/apple/moltenvk.sh

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,80 +20,76 @@ set -e
2020
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
2121
cd "$THIS_DIR"
2222

23-
echo "----------------------"
24-
echo "[*] fetch dependencies for $LIB_NAME"
25-
echo "----------------------"
26-
27-
cd $MR_BUILD_SOURCE
28-
if [ -d "External" ]; then
29-
echo "dependencies already exist"
30-
else
31-
if [ -f "./fetchDependencies" ]; then
32-
echo "fetching dependencies..."
33-
chmod +x ./fetchDependencies
34-
./fetchDependencies
35-
else
36-
echo "fetchDependencies script not found, trying with CMake..."
37-
fi
38-
fi
39-
40-
cd "$THIS_DIR"
41-
42-
pf=
4323
dest=
4424
scheme_suffix=
4525
arch_param=
26+
fetch_deps_arg=
27+
4628
if [[ "$MR_PLAT" == 'ios' ]];then
4729
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
48-
pf='SIMULATORARM64'
4930
dest='iOS Simulator'
5031
arch_param='arm64'
32+
fetch_deps_arg='--iossim'
5133
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
52-
pf='SIMULATOR64'
5334
dest='iOS Simulator'
5435
arch_param='x86_64'
36+
fetch_deps_arg='--iossim'
5537
else
56-
pf='OS64'
5738
dest='iOS'
5839
arch_param='arm64'
40+
fetch_deps_arg='--ios'
5941
fi
6042
scheme_suffix='iOS only'
6143
export MR_DEPLOYMENT_TARGET_VER=14.0
6244
elif [[ "$MR_PLAT" == 'tvos' ]];then
6345
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
64-
pf='SIMULATORARM64_TVOS'
6546
dest='tvOS Simulator'
6647
arch_param='arm64'
48+
fetch_deps_arg='--tvossim'
6749
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
68-
pf='SIMULATOR_TVOS'
6950
dest='tvOS Simulator'
7051
arch_param='x86_64'
52+
fetch_deps_arg='--tvossim'
7153
else
72-
pf='TVOS'
7354
dest='tvOS'
7455
arch_param='arm64'
56+
fetch_deps_arg='--tvos'
7557
fi
7658
scheme_suffix='tvOS only'
7759
export MR_DEPLOYMENT_TARGET_VER=14.0
7860
elif [[ "$MR_PLAT" == 'macos' ]];then
7961
if [[ $_MR_ARCH == 'arm64' ]];then
80-
pf='MAC_ARM64'
8162
arch_param='arm64'
8263
elif [[ $_MR_ARCH == 'x86_64' ]];then
83-
pf='MAC'
8464
arch_param='x86_64'
8565
fi
8666
dest='macOS'
8767
scheme_suffix='macOS only'
68+
fetch_deps_arg='--macos'
8869
export MR_DEPLOYMENT_TARGET_VER=11.0
8970
fi
9071

91-
xc_proj="MoltenVKPackaging.xcodeproj"
92-
scheme="MoltenVK Package ($scheme_suffix)"
72+
echo "----------------------"
73+
echo "[*] fetch dependencies for $LIB_NAME"
74+
echo "----------------------"
75+
76+
cd $MR_BUILD_SOURCE
77+
if [ -d "External" ]; then
78+
echo "dependencies already exist"
79+
else
80+
if [ -f "./fetchDependencies" ]; then
81+
echo "fetching dependencies for $fetch_deps_arg..."
82+
chmod +x ./fetchDependencies
83+
./fetchDependencies $fetch_deps_arg
84+
else
85+
echo "fetchDependencies script not found, trying with CMake..."
86+
fi
87+
fi
88+
89+
cd "$THIS_DIR"
9390

9491
echo "----------------------"
9592
echo "[*] configurate $LIB_NAME"
96-
echo "[*] PLATFORM: $pf"
9793
echo "[*] destination: $dest"
9894
echo "[*] deployment target: $MR_DEPLOYMENT_TARGET_VER"
9995
echo "----------------------"
@@ -105,8 +101,8 @@ echo "----------------------"
105101

106102
mkdir -p "$MR_BUILD_PREFIX/lib"
107103

108-
xcodebuild -project "$MR_BUILD_SOURCE/$xc_proj" \
109-
-scheme "$scheme" \
104+
xcodebuild -project "$MR_BUILD_SOURCE/MoltenVKPackaging.xcodeproj" \
105+
-scheme "MoltenVK Package ($scheme_suffix)" \
110106
-destination "generic/platform=$dest" \
111107
-configuration Release \
112108
-parallelizeTargets \
@@ -115,14 +111,14 @@ xcodebuild -project "$MR_BUILD_SOURCE/$xc_proj" \
115111
CODE_SIGNING_ALLOWED=NO \
116112
build || true
117113

118-
dd_dir=$(find ~/Library/Developer/Xcode/DerivedData -maxdepth 1 -type d -name "MoltenVKPackaging-*" 2>/dev/null | head -1)/Build/Products/Release
119-
120-
if [[ -f "$dd_dir/libMoltenVK.a" ]]; then
121-
cp "$dd_dir/libMoltenVK.a" "$MR_BUILD_PREFIX/lib/"
122-
echo "Copied libMoltenVK.a to $MR_BUILD_PREFIX/lib/"
123-
else
124-
echo "libMoltenVK.a not found in $dd_dir"
125-
exit 1
114+
pkg_static_dir="$MR_BUILD_SOURCE/Package/Release/MoltenVK/static"
115+
if [[ -d "$pkg_static_dir/MoltenVK.xcframework" ]]; then
116+
xcframework_dir="$pkg_static_dir/MoltenVK.xcframework"
117+
archs_dir=$(ls "$xcframework_dir/" 2>/dev/null | grep -v Info.plist | head -1)
118+
if [[ -n "$archs_dir" && -f "$xcframework_dir/$archs_dir/libMoltenVK.a" ]]; then
119+
cp "$xcframework_dir/$archs_dir/libMoltenVK.a" "$MR_BUILD_PREFIX/lib/"
120+
echo "Copied libMoltenVK.a from xcframework to $MR_BUILD_PREFIX/lib/"
121+
fi
126122
fi
127123

128124
alt_header_dir="$MR_BUILD_SOURCE/MoltenVK/include"

0 commit comments

Comments
 (0)