3 # Copyright (C) 2018-2019 Intel Corporation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 echo "Error on or near line $1: $2; exiting with status ${code}"
22 echo "Error on or near line $1; exiting with status ${code}"
26 trap 'error ${LINENO}' ERR
28 SAMPLES_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
30 printf "\nSetting environment variables for building samples...\n"
32 if [ -z "$INTEL_OPENVINO_DIR" ]; then
33 if [ -e "$SAMPLES_PATH/../../bin/setupvars.sh" ]; then
34 setvars_path="$SAMPLES_PATH/../../bin/setupvars.sh"
35 elif [ -e "$SAMPLES_PATH/../../../bin/setupvars.sh" ]; then
36 setvars_path="$SAMPLES_PATH/../../../bin/setupvars.sh"
38 printf "Error: Failed to set the environment variables automatically. To fix, run the following command:\n source <INSTALL_DIR>/bin/setupvars.sh\n where INSTALL_DIR is the OpenVINO installation directory.\n\n"
41 if ! source $setvars_path ; then
42 printf "Unable to run ./setupvars.sh. Please check its presence. \n\n"
46 # case for run with `sudo -E`
47 source "$INTEL_OPENVINO_DIR/bin/setupvars.sh"
50 if ! command -v cmake &>/dev/null; then
51 printf "\n\nCMAKE is not installed. It is required to build Inference Engine samples. Please install it. \n\n"
55 build_dir=$HOME/inference_engine_samples_build
60 if [ $OS_PATH == "x86_64" ]; then
65 if [ -e $build_dir/CMakeCache.txt ]; then
66 rm -rf $build_dir/CMakeCache.txt
70 cmake -DCMAKE_BUILD_TYPE=Release $SAMPLES_PATH
73 printf "\nBuild completed, you can find binaries for all samples in the $build_dir/${OS_PATH}/Release subfolder.\n\n"