#!/usr/bin/env bash

#
# Configure and build the CMake project with source code in the current
# directory in "$1", defaults to "./web-build"
#
# Any extra arguments passed to the script and passed to the cmake
# configuration step.
#

build_dir=$1
shift
mkdir -p ./$build_dir

cmake \
   --no-warn-unused-cli \
   -B$build_dir \
   -H. \
   -DCMAKE_BUILD_TYPE:STRING=Release \
   -DITK_DIR:PATH=/ITK-build \
   -GNinja \
     "$@" && \

cores=$(nproc)
ninja -C$build_dir -j$cores -l$cores
