automerge/scripts/ci/cmake-build
alexjg 5629a7bec4
Various CI script fixes (#501)
Some of the scripts in scripts/ci were not reliable detecting the path
they were operating in. Additionally the deno_tests script was not
correctly picking up the ROOT_MODULE environment variable. Add more
robust path handling and fix the deno_tests script.
2023-01-19 15:38:27 +00:00

19 lines
775 B
Bash
Executable file

#!/usr/bin/env bash
set -eoux pipefail
# see https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
THIS_SCRIPT="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# \note CMake's default build types are "Debug", "MinSizeRel", "Release" and
# "RelWithDebInfo" but custom ones can also be defined so we pass it verbatim.
BUILD_TYPE=$1;
LIB_TYPE=$2;
if [ "$(echo "${LIB_TYPE}" | tr '[:upper:]' '[:lower:]')" == "shared" ]; then
SHARED_TOGGLE="ON"
else
SHARED_TOGGLE="OFF"
fi
C_PROJECT=$THIS_SCRIPT/../../rust/automerge-c;
mkdir -p $C_PROJECT/build;
cd $C_PROJECT/build;
cmake --log-level=ERROR -B . -S .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$SHARED_TOGGLE;
cmake --build . --target test_automerge;