11#! /usr/bin/env bash
22set -e
3+
34dir=$( cd " $( dirname " $0 " ) " ; pwd)
45rootdir=" $dir /../.."
5- dotnet_configuration=Release
6- configuration=debug
6+ dotnet_configuration=DebugOpt
7+ make_configuration=debug
8+ platform=x64
79jsinterp=" $dir /runtime/build/qjs"
810
9- for arg in " $@ " ; do
10- case $arg in
11- -configuration)
12- configuration=$2
13- shift
14- ;;
15- -dotnet_configuration)
16- dotnet_configuration=$2
17- shift
18- ;;
19- esac
20- done
11+ usage () {
12+ cat << EOF
13+ Usage: $( basename $0 ) [--with-node=NODE] [--make-config CONFIG] [--dotnet-config CONFIG]
14+ EOF
15+ exit 1
16+ }
2117
22- cd $dir
18+ while [[ $# -gt 0 ]]; do
19+ case " $1 " in
20+ --with-node=* )
21+ jsinterp=" ${1#* =} "
22+ shift
23+ ;;
24+ --with-node)
25+ jsinterp=" $2 "
26+ shift 2
27+ ;;
28+ --make-config|--make-configuration)
29+ make_configuration=" $2 "
30+ shift 2
31+ ;;
32+ --dotnet-config|--dotnet-configuration)
33+ dotnet_configuration=" $2 "
34+ shift 2
35+ ;;
36+ -h|--help)
37+ usage
38+ ;;
39+ * )
40+ echo " Unknown option: $1 " >&2
41+ usage
42+ ;;
43+ esac
44+ done
2345
2446if [ " $CI " = " true" ]; then
2547 red=" "
3153 reset=` tput sgr0`
3254fi
3355
56+ # 1) Generate
3457generate=true
35-
3658if [ $generate = true ]; then
37- echo " ${green} Generating bindings${reset} "
38- dotnet $rootdir /bin/${dotnet_configuration} /CppSharp.CLI.dll \
39- $dir /bindings.lua
59+ echo " ${green} Generating bindings with .NET configuration $dotnet_configuration ${reset} "
60+ dotnet " $rootdir /bin/${dotnet_configuration} /CppSharp.CLI.dll" " $dir /bindings.lua"
4061fi
4162
42- echo " ${green} Building generated binding files ${reset} "
43- premake= $rootdir /build/premake.sh
44- config= $configuration $ premake --file= $dir /premake5.lua gmake2
45- verbose=true make -C $dir /gen
46- echo
63+ # 2) Build
64+ echo " ${green} Building generated binding files (make config: $make_configuration ) ${reset} "
65+ premake= " $rootdir /build/premake.sh "
66+ " $premake " --file= $dir /premake5.lua gmake2
67+ config= $make_configuration verbose=true make -C " $dir /gen "
4768
69+ # 3) Test
70+ echo
4871echo " ${green} Executing JS tests with QuickJS${reset} "
49- cp $dir /gen/bin/$configuration /libtest.so $dir
50- $jsinterp --std $dir /test.js
72+ cp $dir /gen/bin/$make_configuration /libtest.so $dir
73+ $jsinterp --std $dir /test.js
0 commit comments