#!/usr/bin/env bash set -e dir=$(cd "$(dirname "$0")"; pwd) rootdir="$dir/../.." dotnet_configuration=DebugOpt make_configuration=debug platform=x64 jsinterp="$dir/runtime/build/qjs" usage() { cat <&2 usage ;; esac done if [ "$CI" = "true" ]; then red="" green="" reset="" else red=`tput setaf 1` green=`tput setaf 2` reset=`tput sgr0` fi # 1) Generate generate=true if [ $generate = true ]; then echo "${green}Generating bindings with .NET configuration $dotnet_configuration${reset}" dotnet "$rootdir/bin/${dotnet_configuration}/CppSharp.CLI.dll" "$dir/bindings.lua" fi # 2) Build echo "${green}Building generated binding files (make config: $make_configuration)${reset}" premake="$rootdir/build/premake.sh" "$premake" --file=$dir/premake5.lua gmake2 config=$make_configuration verbose=true make -C "$dir/gen" # 3) Test echo echo "${green}Executing JS tests with QuickJS${reset}" cp $dir/gen/bin/$make_configuration/libtest.so $dir $jsinterp --std $dir/test.js