Skip to content

Commit

Permalink
Added build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Sep 23, 2024
1 parent 141887b commit 36650bd
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 0 deletions.
53 changes: 53 additions & 0 deletions script/full_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

if [ -z "${CC}" -o -z "${CXX}" ]; then
echo "ERROR: Compilers are not provided"
exit 1
fi

if [ -z "${BUILD_TYPE}" ]; then
echo "ERROR: Build type not provided"
exit 1
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR=$( dirname ${SCRIPT_DIR} )

if [ -z "${BUILD_DIR}" ]; then
export BUILD_DIR="${ROOT_DIR}/build.full.${CC}.${BUILD_TYPE}"
fi

if [ -z "${INSTALL_DIR}" ]; then
export INSTALL_DIR=${BUILD_DIR}/install
fi

if [ -z "${USE_CCACHE}" ]; then
export USE_CCACHE=ON
fi

if [ -z "${DEFAULT_SANITIZERS}" ]; then
export DEFAULT_SANITIZERS=ON
fi

if [ -z "${QT_VER}" ]; then
export QT_VER=5
fi

if [ -z "${PROJ_INCLUDE}" ]; then
export PROJ_INCLUDE="config/All.cmake"
fi

mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
cmake .. \
-DCMAKE_PROJECT_INCLUDE=${PROJ_INCLUDE} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DOPT_USE_CCACHE=${USE_CCACHE} \
-DOPT_WITH_DEFAULT_SANITIZERS=${DEFAULT_SANITIZERS} -DOPT_QT_MAJOR_VERSION=${QT_VER} "$@"

procs=$(nproc)
if [ -n "${procs}" ]; then
procs_param="--parallel ${procs}"
fi

cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} ${procs_param}
6 changes: 6 additions & 0 deletions script/full_debug_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export BUILD_TYPE=Debug
exec ${SCRIPT_DIR}/full_build.sh "$@"

13 changes: 13 additions & 0 deletions script/full_debug_build_clang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [ -z "${CC}" ]; then
export CC=clang
fi

if [ -z "${CXX}" ]; then
export CXX=clang++
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec ${SCRIPT_DIR}/full_debug_build.sh "$@"

6 changes: 6 additions & 0 deletions script/full_debug_build_clang_develop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PROJ_INCLUDE="config/AllDevelop.cmake"
exec ${SCRIPT_DIR}/full_debug_build_clang.sh "$@"

13 changes: 13 additions & 0 deletions script/full_debug_build_gcc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [ -z "${CC}" ]; then
export CC=gcc
fi

if [ -z "${CXX}" ]; then
export CXX=g++
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec ${SCRIPT_DIR}/full_debug_build.sh "$@"

0 comments on commit 36650bd

Please sign in to comment.