1
1
#! /usr/bin/env bash
2
2
set -e
3
+
3
4
dir=$( cd " $( dirname " $0 " ) " ; pwd)
4
5
rootdir=" $dir /../.."
5
- dotnet_configuration=Release
6
- configuration=debug
6
+ dotnet_configuration=DebugOpt
7
+ make_configuration=debug
8
+ platform=x64
7
9
jsinterp=" $dir /runtime/build/qjs"
8
10
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
+ }
21
17
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
23
45
24
46
if [ " $CI " = " true" ]; then
25
47
red=" "
31
53
reset=` tput sgr0`
32
54
fi
33
55
56
+ # 1) Generate
34
57
generate=true
35
-
36
58
if [ $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"
40
61
fi
41
62
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 gmake
67
+ config= $make_configuration emmake make -C " $dir /gen "
47
68
69
+ # 3) Test
70
+ echo
48
71
echo " ${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