forked from SEL4PROJ/AOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-build.sh
executable file
·45 lines (40 loc) · 1.27 KB
/
init-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
#!/bin/bash
#
# Copyright 2019, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DATA61_GPL)
#
# This script is intended to be symlinked into the same location as your root CMakeLists.txt file
# and then invoked from a clean build directory
set -eu
# Determine path to this script (fast, cheap "dirname").
SCRIPT_PATH=${0%/*}
# Save script name for diagnostic messages (fast, cheap "basename").
SCRIPT_NAME=${0##*/}
# Ensure script path and current working directory are not the same.
if [ "$PWD" = "$SCRIPT_PATH" ]
then
echo "\"$SCRIPT_NAME\" should not be invoked from top-level directory" >&2
exit 1
fi
# Try and make sure we weren't invoked from a source directory by checking for a
# CMakeLists.txt file.
if [ -e CMakeLists.txt ]
then
echo "\"$SCRIPT_NAME\" should be invoked from a build directory and not" \
"source directories containing a CMakeLists.txt file" >&2
exit 1
fi
# Initialize cmake
cmake \
-DAARCH64=TRUE \
-DCMAKE_TOOLCHAIN_FILE=${SCRIPT_PATH}/kernel/gcc.cmake \
-G Ninja \
$@ \
${SCRIPT_PATH}