diff --git a/extra/scripts/build.sh b/extra/scripts/build.sh index c6399906ead13549018c1b3b3980605cd5a90915..dd5b646b78ecd0ad405be2bea95f308227c32736 100755 --- a/extra/scripts/build.sh +++ b/extra/scripts/build.sh @@ -4,6 +4,7 @@ BUILD_THREADS="$(grep -c processor /proc/cpuinfo)" BUILD_DIR= BUILD_MODE= BUILD_SYSTEM= +INSTALL_DIR="install" RUN_TESTS=1 is_installed() { @@ -131,6 +132,7 @@ cat >&2 << EOF Building Algorithms Library Core from $ROOT: - Mode: $BUILD_MODE - Into: $ROOT/$BUILD_DIR $BUILD_DIR_SYMLINK + - Install: $ROOT/$BUILD_DIR/$INSTALL_DIR - Threads: $BUILD_THREADS - Builder: $BUILD_SYSTEM - Testing: $RUN_TESTS @@ -154,7 +156,7 @@ else fi -CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$BUILD_MODE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" +CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$BUILD_MODE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=${ROOT}/${BUILD_DIR}/${INSTALL_DIR}" if [[ $BUILD_SYSTEM == "ninja" ]]; then CMAKE_FLAGS="$CMAKE_FLAGS -GNinja" fi @@ -163,11 +165,13 @@ cmake $CMAKE_FLAGS ${ROOT} # build and test if [[ $BUILD_SYSTEM == "ninja" ]]; then ninja -j${BUILD_THREADS} || exit 1 + ninja install -j${BUILD_THREADS} || exit 1 if [[ $RUN_TESTS -ne 0 ]]; then ctest . --output-on-failure -j ${BUILD_THREADS} || exit 1 fi else make -j${BUILD_THREADS} || exit 1 + make install -j${BUILD_THREADS} || exit 1 if [[ $RUN_TESTS -ne 0 ]]; then make test ARGS="-j${BUILD_THREADS} --output-on-failure" || exit 1 fi