|
|
@ -1,25 +1,47 @@ |
|
|
|
#!/usr/bin/env bash |
|
|
|
#!/usr/bin/env bash |
|
|
|
set -e |
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
dir=$(cd "$(dirname "$0")"; pwd) |
|
|
|
dir=$(cd "$(dirname "$0")"; pwd) |
|
|
|
rootdir="$dir/../.." |
|
|
|
rootdir="$dir/../.." |
|
|
|
dotnet_configuration=Release |
|
|
|
dotnet_configuration=DebugOpt |
|
|
|
configuration=debug |
|
|
|
make_configuration=debug |
|
|
|
|
|
|
|
platform=x64 |
|
|
|
jsinterp="$dir/runtime/build/qjs" |
|
|
|
jsinterp="$dir/runtime/build/qjs" |
|
|
|
|
|
|
|
|
|
|
|
for arg in "$@"; do |
|
|
|
usage() { |
|
|
|
case $arg in |
|
|
|
cat <<EOF |
|
|
|
-configuration) |
|
|
|
Usage: $(basename $0) [--with-node=NODE] [--make-config CONFIG] [--dotnet-config CONFIG] |
|
|
|
configuration=$2 |
|
|
|
EOF |
|
|
|
shift |
|
|
|
exit 1 |
|
|
|
;; |
|
|
|
} |
|
|
|
-dotnet_configuration) |
|
|
|
|
|
|
|
dotnet_configuration=$2 |
|
|
|
|
|
|
|
shift |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd $dir |
|
|
|
while [[ $# -gt 0 ]]; do |
|
|
|
|
|
|
|
case "$1" in |
|
|
|
|
|
|
|
--with-node=*) |
|
|
|
|
|
|
|
jsinterp="${1#*=}" |
|
|
|
|
|
|
|
shift |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
--with-node) |
|
|
|
|
|
|
|
jsinterp="$2" |
|
|
|
|
|
|
|
shift 2 |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
--make-config|--make-configuration) |
|
|
|
|
|
|
|
make_configuration="$2" |
|
|
|
|
|
|
|
shift 2 |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
--dotnet-config|--dotnet-configuration) |
|
|
|
|
|
|
|
dotnet_configuration="$2" |
|
|
|
|
|
|
|
shift 2 |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
-h|--help) |
|
|
|
|
|
|
|
usage |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Unknown option: $1" >&2 |
|
|
|
|
|
|
|
usage |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
if [ "$CI" = "true" ]; then |
|
|
|
if [ "$CI" = "true" ]; then |
|
|
|
red="" |
|
|
|
red="" |
|
|
@ -31,20 +53,21 @@ else |
|
|
|
reset=`tput sgr0` |
|
|
|
reset=`tput sgr0` |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 1) Generate |
|
|
|
generate=true |
|
|
|
generate=true |
|
|
|
|
|
|
|
|
|
|
|
if [ $generate = true ]; then |
|
|
|
if [ $generate = true ]; then |
|
|
|
echo "${green}Generating bindings${reset}" |
|
|
|
echo "${green}Generating bindings with .NET configuration $dotnet_configuration${reset}" |
|
|
|
dotnet $rootdir/bin/${dotnet_configuration}/CppSharp.CLI.dll \ |
|
|
|
dotnet "$rootdir/bin/${dotnet_configuration}/CppSharp.CLI.dll" "$dir/bindings.lua" |
|
|
|
$dir/bindings.lua |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "${green}Building generated binding files${reset}" |
|
|
|
# 2) Build |
|
|
|
premake=$rootdir/build/premake.sh |
|
|
|
echo "${green}Building generated binding files (make config: $make_configuration)${reset}" |
|
|
|
config=$configuration $premake --file=$dir/premake5.lua gmake2 |
|
|
|
premake="$rootdir/build/premake.sh" |
|
|
|
verbose=true make -C $dir/gen |
|
|
|
"$premake" --file=$dir/premake5.lua gmake2 |
|
|
|
echo |
|
|
|
config=$make_configuration verbose=true make -C "$dir/gen" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 3) Test |
|
|
|
|
|
|
|
echo |
|
|
|
echo "${green}Executing JS tests with QuickJS${reset}" |
|
|
|
echo "${green}Executing JS tests with QuickJS${reset}" |
|
|
|
cp $dir/gen/bin/$configuration/libtest.so $dir |
|
|
|
cp $dir/gen/bin/$make_configuration/libtest.so $dir |
|
|
|
$jsinterp --std $dir/test.js |
|
|
|
$jsinterp --std $dir/test.js |
|
|
|