This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathSetup.sh
executable file
·129 lines (106 loc) · 5.82 KB
/
Setup.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env bash
set -e -u -o pipefail
[[ -n "${DEBUG:-}" ]] && set -x
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "This script should only be used on OS X. If you are using Windows, please run Setup.bat."
exit 1
fi
pushd "$(dirname "$0")"
PINNED_CORE_SDK_VERSION=$(cat ./SpatialGDK/Extras/core-sdk.version)
PINNED_SPOT_VERSION=$(cat ./SpatialGDK/Extras/spot.version)
BUILD_DIR="$(pwd)/SpatialGDK/Build"
CORE_SDK_DIR="${BUILD_DIR}/core_sdk"
WORKER_SDK_DIR="$(pwd)/SpatialGDK/Source/SpatialGDK/Public/WorkerSDK"
BINARIES_DIR="$(pwd)/SpatialGDK/Binaries/ThirdParty/Improbable"
SCHEMA_COPY_DIR="$(pwd)/../../../spatial/schema/unreal/gdk"
SCHEMA_STD_COPY_DIR="$(pwd)/../../../spatial/build/dependencies/schema/standard_library"
SPATIAL_DIR="$(pwd)/../../../spatial"
DOWNLOAD_MOBILE=
USE_CHINA_SERVICES_REGION=
while test $# -gt 0
do
case "$1" in
--china)
DOMAIN_ENVIRONMENT_VAR="--environment cn-production"
USE_CHINA_SERVICES_REGION=true
;;
--mobile) DOWNLOAD_MOBILE=true
;;
esac
shift
done
echo "Setup the git hooks"
if [[ -e .git/hooks ]]; then
# Remove the old post-checkout hook.
if [[ -e .git/hooks/post-checkout ]]; then
rm -f .git/hooks/post-checkout
fi
# Remove the old post-merge hook.
if [[ -e .git/hooks/post-merge ]]; then
rm -f .git/hooks/post-merge
fi
# Add git hook to run Setup.sh when RequireSetup file has been updated.
cp "$(pwd)/SpatialGDK/Extras/git/post-merge" "$(pwd)/.git/hooks"
fi
# Create or remove an empty file in the plugin directory indicating whether to use China services region.
if [[ -n "${USE_CHINA_SERVICES_REGION}" ]]; then
touch UseChinaServicesRegion
else
rm -f UseChinaServicesRegion
fi
echo "Clean folders"
rm -rf "${CORE_SDK_DIR}"
rm -rf "${WORKER_SDK_DIR}"
rm -rf "${BINARIES_DIR}"
if [[ -d "${SPATIAL_DIR}" ]]; then
rm -rf "${SCHEMA_STD_COPY_DIR}"
rm -rf "${SCHEMA_COPY_DIR}"
fi
echo "Create folders"
mkdir -p "${WORKER_SDK_DIR}"
mkdir -p "${CORE_SDK_DIR}"/schema
mkdir -p "${CORE_SDK_DIR}"/tools
mkdir -p "${CORE_SDK_DIR}"/worker_sdk
mkdir -p "${BINARIES_DIR}"/Android
mkdir -p "${BINARIES_DIR}"/Programs/worker_sdk
if [[ -d "${SPATIAL_DIR}" ]]; then
mkdir -p "${SCHEMA_STD_COPY_DIR}"
mkdir -p "${SCHEMA_COPY_DIR}"
fi
echo "Retrieve dependencies"
spatial package retrieve tools schema_compiler-x86_64-macos "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/tools/schema_compiler-x86_64-macos.zip
spatial package retrieve schema standard_library "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/schema/standard_library.zip
spatial package retrieve worker_sdk c_headers "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c_headers.zip
spatial package retrieve worker_sdk c-dynamic-x86_64-clang-macos "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-x86_64-clang-macos.zip
if [[ -n "${DOWNLOAD_MOBILE}" ]];
then
spatial package retrieve worker_sdk c-static-fullylinked-arm-clang-ios "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c-static-fullylinked-arm-clang-ios.zip
spatial package retrieve worker_sdk c-dynamic-arm64v8a-clang_ndk21-android "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-arm64v8a-clang_ndk21-android.zip
spatial package retrieve worker_sdk c-dynamic-armv7a-clang_ndk21-android "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-armv7a-clang_ndk21-android.zip
spatial package retrieve worker_sdk c-dynamic-x86_64-clang_ndk21-android "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-x86_64-clang_ndk21-android.zip
fi
spatial package retrieve worker_sdk csharp "${PINNED_CORE_SDK_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${CORE_SDK_DIR}"/worker_sdk/csharp.zip
spatial package retrieve spot spot-macos "${PINNED_SPOT_VERSION}" ${DOMAIN_ENVIRONMENT_VAR:-} "${BINARIES_DIR}"/Programs/spot
chmod +x "${BINARIES_DIR}"/Programs/spot
echo "Unpack dependencies"
unzip -oq "${CORE_SDK_DIR}"/tools/schema_compiler-x86_64-macos.zip -d "${BINARIES_DIR}"/Programs/
unzip -oq "${CORE_SDK_DIR}"/schema/standard_library.zip -d "${BINARIES_DIR}"/Programs/schema/
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c_headers.zip -d "${BINARIES_DIR}"/Headers/
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-x86_64-clang-macos.zip -d "${BINARIES_DIR}"/Mac/
if [[ -n "${DOWNLOAD_MOBILE}" ]];
then
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c-static-fullylinked-arm-clang-ios.zip -d "${BINARIES_DIR}"/IOS/
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-arm64v8a-clang_ndk21-android.zip -d "${BINARIES_DIR}"/Android/arm64-v8a/
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-armv7a-clang_ndk21-android.zip -d "${BINARIES_DIR}"/Android/armeabi-v7a/
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/c-dynamic-x86_64-clang_ndk21-android.zip -d "${BINARIES_DIR}"/Android/x86_64/
fi
unzip -oq "${CORE_SDK_DIR}"/worker_sdk/csharp.zip -d "${BINARIES_DIR}"/Programs/worker_sdk/csharp/
cp -R "${BINARIES_DIR}"/Headers/include/ "${WORKER_SDK_DIR}"
if [[ -d "${SPATIAL_DIR}" ]]; then
echo "Copying standard library schemas to ${SCHEMA_STD_COPY_DIR}"
cp -R "${BINARIES_DIR}/Programs/schema/." "${SCHEMA_STD_COPY_DIR}"
echo "Copying schemas to ${SCHEMA_COPY_DIR}"
cp -R SpatialGDK/Extras/schema/. "${SCHEMA_COPY_DIR}"
fi
popd
echo "UnrealGDK build completed successfully!"