forked from ARM-software/vktrace-arm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_external_sources.sh
executable file
·85 lines (70 loc) · 2.33 KB
/
update_external_sources.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
#!/bin/bash
set -e
TARGET="x64"
BUILD_TYPE="debug"
BUILD_WINDOW_SUPPORT="default"
print_help() {
echo "Supported parameters are:"
echo " --target <x86|x64|arm_32|arm_64> (optional, default is x64)"
echo " --build-type <debug|release> (optional, default is debug)"
echo " --window <default|wayland> (optional, set to wayland to build with WSI wayland support (only for arm64/32 now))"
}
while [[ $# -gt 0 ]]
do
case $1 in
--target)
TARGET=$2
echo "Build for $TARGET"
shift 2
;;
--build-type)
BUILD_TYPE=$2
echo "Build type $BUILD_TYPE"
shift 2
;;
--window)
BUILD_WINDOW_SUPPORT=$2
shift 2
;;
*)
# unknown option
echo Unknown option: $1
print_help
exit 1
;;
esac
done
TARGET_LIST="x86 x64 arm_32 arm_64"
if ! [[ ${TARGET_LIST} =~ (^|[[:space:]])${TARGET}($|[[:space:]]) ]]; then
echo "Unsupported target option ${TARGET}!"
exit 1
fi
BUILD_TYPE_LIST="debug release"
if ! [[ ${BUILD_TYPE_LIST} =~ (^|[[:space:]])${BUILD_TYPE}($|[[:space:]]) ]]; then
echo "Unsupported --build-type option ${BUILD_TYPE}!"
exit 1
fi
BUILD_TYPE_OPTION=${BUILD_TYPE^}
BUILD_WINDOW_SUPPORT_LIST="default wayland"
if ! [[ ${BUILD_WINDOW_SUPPORT_LIST} =~ (^|[[:space:]])${BUILD_WINDOW_SUPPORT}($|[[:space:]]) ]]; then
echo "Unsupported --window option ${BUILD_WINDOW_SUPPORT}!"
exit 1
fi
if [[ $(uname) == "Linux" || $(uname) =~ "CYGWIN" || $(uname) =~ "MINGW" ]]; then
CURRENT_DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
CORE_COUNT=$(nproc || echo 4)
elif [[ $(uname) == "Darwin" ]]; then
CURRENT_DIR="$(dirname "$(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' ${BASH_SOURCE[0]})")"
CORE_COUNT=$(sysctl -n hw.ncpu || echo 4)
fi
echo CURRENT_DIR=$CURRENT_DIR
echo CORE_COUNT=$CORE_COUNT
BUILDDIR=${CURRENT_DIR}
BASEDIR="$BUILDDIR/external/submodules"
git submodule update --init --recursive
echo "Building ${BASEDIR}/jsoncpp"
cd ${BASEDIR}/jsoncpp
python amalgamate.py
mkdir -p $BUILDDIR/external
cd ${BUILDDIR}
python scripts/update_deps.py --config=${BUILD_TYPE_OPTION} --arch=${TARGET} --dir ${BUILDDIR}/external --window ${BUILD_WINDOW_SUPPORT}