3 export SCRIPT_BASE
=$
(dirname `readlink -f $0`)
4 export BASE
=${SCRIPT_BASE}/..
5 export BUILD
=${BASE}/build
37 supported_build_types
=("Debug" "Release")
38 repository
=${DOCKER_REPOSITORY:-marnav}
39 account
=${DOCKER_ACCOUNT:-mariokonrad}
41 export NUM_PROC
=${NUM_PROC:-$(nproc --ignore=2)}
52 --volume $
(pwd):$
(pwd) \
55 --user $
(id
-u):$
(id
-g) \
64 dockerid
=${account}/${repository}:${compiler}
65 builddir
=${BUILD_DIR:-${BUILD}/$(echo "${dockerid}_${build_type}" | tr '/:' '__')}
67 if [ ! -d ${builddir} ] ; then
71 docker_run
${dockerid} "cmake -B ${builddir} -DCMAKE_BUILD_TYPE=${build_type} ${BASE}"
72 docker_run ${dockerid} "cmake --build ${builddir} -j ${NUM_PROC}"
73 docker_run
${dockerid} "cmake --build ${builddir} --target unittest"
74 docker_run
${dockerid} "cmake --build ${builddir} --target test"
79 echo "usage: $(basename $0) compiler build-type"
81 echo " supported compilers:"
82 for v
in ${supported_compilers[@]} ; do
86 echo " supported build types:"
87 for v
in ${supported_build_types[@]} ; do
93 function check_supported_compilers
()
96 for v
in ${supported_compilers[@]} ; do
97 if [ "${v}" == "${compiler}" ] ; then
101 echo "error: specified compiler not supported: ${compiler}"
105 function check_supported_build_types
()
108 for v
in ${supported_build_types[@]} ; do
109 if [ "${v}" == "${build_type}" ] ; then
113 echo "error: specified build type not supported: ${build_type}"
117 if [ $# -ne 2 ] ; then
122 check_supported_compilers
$1
123 check_supported_build_types
$2