#!/bin/bash
-# Find absolute path to ROOT_DIR
-export ROOT_DIR=$(pwd)/..
-export ROOT_DIR=`cd "${ROOT_DIR}";pwd`
+source env.sh
+source env_standalone.sh
-SRC_DIR=${ROOT_DIR}/sources
-
-BUILD_DIR=build
-INSTALL_DIR=install
-if [ $1 ]; then
- BUILD_DIR=${BUILD_DIR}-$1
- INSTALL_DIR=${INSTALL_DIR}-$1
+CMAKE_ARGS=""
+if [ -f GCOV ]; then
+ echo "Use GCOV..."
+ source env_lcov.sh
+ CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
+ CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=ON"
+elif [ -f DEBUG ]; then
+ CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
+else
+ CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
fi
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR}"
+CMAKE_ARGS="${CMAKE_ARGS} ${SOURCES_DIR}"
-source ${SRC_DIR}/salome_env.sh
-source ${SRC_DIR}/linux_env.sh $1
-mkdir -p ${ROOT_DIR}/${BUILD_DIR}
-cd ${ROOT_DIR}/${BUILD_DIR}
+mkdir -p ${BUILD_DIR}
+cd ${BUILD_DIR}
-CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
-CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/${INSTALL_DIR}"
-CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
+set -e
cmake -G "Unix Makefiles" ${CMAKE_ARGS}
make -j$(nproc) install