-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·63 lines (53 loc) · 1.27 KB
/
build.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
#! /bin/bash
set -eux
build_target() {
cd $1
if [[ ! -f $1/CMakeLists.txt ]]; then
echo "$1 package does not have a CMakeLists.txt file"
else
mkdir -p $1/build
cd $1/build
cmake -DCMAKE_INSTALL_PREFIX="$WORKSPACE/env/$(basename $1)" ..
cmake --$2 .
cd $WORKSPACE
fi
}
if [[ $IS_SETENV != 1 ]]; then
echo "Please set environment by sourcing the 'setenv' script"
exit -1
fi
while getopts ":A:t:j:" opt; do
case ${opt} in
A )
echo "Build target $OPTARG has been selected"
BUILD_TARGET=$OPTARG
;;
j )
echo "Build with $OPTARG threads"
BUILD_THREADS=$OPTARG
;;
t )
echo "Build task is $OPTARG"
BUILD_TASK=$OPTARG
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
exit 1
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
exit 1
;;
esac
done
# Shift option index so that $1 will now refer to the first non-option argument
shift $((OPTIND -1))
# Your code to handle non-option arguments here (if any)
if [[ $BUILD_TARGET == "all" ]]; then
PACKAGES=$(find "$WORKSPACE/packages" -mindepth 1 -maxdepth 1 -type d)
for package in $PACKAGES; do
build_target $package $BUILD_TASK
done
else
build_target $BUILD_TARGET $BUILD_TASK
fi