forked from eclipse-kuksa/kuksa-incubation
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-seatctrl.sh
executable file
·54 lines (45 loc) · 1.95 KB
/
build-seatctrl.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
#!/bin/bash
#********************************************************************************
# Copyright (c) 2022 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License 2.0 which is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#*******************************************************************************/
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="$SCRIPT_DIR/src/lib/seat_adjuster/seat_controller/"
TARGET_ARCH="x86_64"
BUILD_DIR="$SCRIPT_DIR/build_seat_controller/$TARGET_ARCH"
set -e -x
BUILD_TYPE="$1"
[ -z "$BUILD_TYPE" ] && BUILD_TYPE="Debug"
# NOTE: coverage requires Debug build...
echo "Build and install seat_controller ($BUILD_TYPE) for host architecture."
# Enable testing (on host)
CMAKE_OPT="-DSDV_BUILD_TESTING=ON -DSDV_COVERAGE=ON -DCONAN_CMAKE_SILENT_OUTPUT=ON -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
# Create Build Environment
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
cmake -E make_directory "$BUILD_DIR"
conan install -if="$BUILD_DIR" --build=missing --profile:build=default --profile:host="${SCRIPT_DIR}/toolchains/target_${TARGET_ARCH}_${BUILD_TYPE}" "$SCRIPT_DIR"
cd "$BUILD_DIR"
# shellcheck disable=SC1091
source activate.sh # Set environment variables for cross build
# shellcheck disable=SC2086
cmake "${SOURCE_DIR}" ${CMAKE_OPT}
sleep 1
cmake --build .
# Build
echo "Test on host architecture."
make -j
# Run Unit Tests
ctest -j -T memcheck -C $BUILD_TYPE --output-on-failure
# Generate Code Coverage
make report_codecov_vservice-seat-ctrl
make report_codecov_vservice-seat-ctrl_html
make report_codecov_vservice-seat-ctrl_lcov