-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sh
executable file
·65 lines (56 loc) · 1.97 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
64
65
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -ex
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
PLATFORM=${PLATFORM:-snp}
BUILD_TESTS=${BUILD_TESTS:-ON}
ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY:-OFF}
NINJA_FLAGS=${NINJA_FLAGS:-}
BUILD_CCF_FROM_SOURCE=${BUILD_CCF_FROM_SOURCE:-OFF}
CC=${CC:-clang-15}
CXX=${CXX:-clang++-15}
if [ "$PLATFORM" != "virtual" ] && [ "$PLATFORM" != "snp" ]; then
echo "Unknown platform: $PLATFORM, must be 'virtual', or 'snp'"
exit 1
fi
if [ "$BUILD_CCF_FROM_SOURCE" = "ON" ]; then
CCF_SOURCE_VERSION="6.0.0-dev11"
echo "Cloning CCF sources"
rm -rf ccf-source
git clone --single-branch -b "ccf-${CCF_SOURCE_VERSION}" https://github.com/microsoft/CCF ccf-source
echo "Installing build dependencies for CCF"
pushd ccf-source/
pushd getting_started/setup_vm/
apt-get -y update
./run.sh ccf-dev.yml -e ccf_ver="$CCF_SOURCE_VERSION" -e platform="$PLATFORM" -e clang_version=15
popd
echo "Compiling CCF $PLATFORM"
mkdir -p build
pushd build
cmake -L -GNinja -DCMAKE_INSTALL_PREFIX="/opt/ccf_${PLATFORM}" -DCOMPILE_TARGET="$PLATFORM" -DBUILD_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug -DSAN=ON ..
ninja
echo "Packaging CCF into deb"
cpack -D CPACK_DEBIAN_FILE_NAME=ccf_virtual_amd64.deb -G DEB
echo "Installing CCF deb"
dpkg -i "ccf_virtual_amd64.deb"
popd
popd
fi
git submodule sync
git submodule update --init --recursive
root_dir=$(pwd)
install_dir=/tmp/scitt
mkdir -p $install_dir
# Note: this is a development build.
# See docker/ for a non-development build.
CC="$CC" CXX="$CXX" \
cmake -GNinja -B build/app \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCOMPILE_TARGET="${PLATFORM}" \
-DBUILD_TESTS="${BUILD_TESTS}" \
-DCMAKE_INSTALL_PREFIX=$install_dir \
-DENABLE_CLANG_TIDY="${ENABLE_CLANG_TIDY}" \
"$root_dir/app"
ninja -C build/app ${NINJA_FLAGS} --verbose
ninja -C build/app ${NINJA_FLAGS} install