aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default-emcc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-07-22 11:27:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-07-22 11:27:44 +0200
commit52b1db8897dc987dfac2d84dc2f09776174f98be (patch)
treed429ed389db24cff644a8fe6579df1c252ab6f90 /etc/environments/default-emcc
parentc354d340978d986586c1a314973a37cd801160db (diff)
Add Emscripten environment script
Diffstat (limited to 'etc/environments/default-emcc')
-rwxr-xr-xetc/environments/default-emcc45
1 files changed, 45 insertions, 0 deletions
diff --git a/etc/environments/default-emcc b/etc/environments/default-emcc
new file mode 100755
index 0000000..509542f
--- /dev/null
+++ b/etc/environments/default-emcc
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# file : etc/environments/default-emcc
+# license : TBC; see accompanying LICENSE file
+
+#
+# Environment setup script for C/C++ compilation with Emscripten using
+# NodeJS as a test runner.
+#
+
+# NOTE: don't forget to adjust the target mode selection below.
+#
+c=emcc
+cxx=em++
+
+# $1 - target
+# $2 - bbot executable (if absent, then run $SHELL)
+# $3+ - bbot options
+
+set -e # Exit on errors.
+
+# Based on target determine what we are building.
+#
+# Note: there is talk of 64-bit WASM so let's keep this infra around.
+#
+mode=
+case "$1" in
+ wasm32-*)
+ #mode=
+ ;;
+ *)
+ echo "unknown target: '$1'" 1>&2
+ exit 1
+ ;;
+esac
+shift
+
+if test $# -ne 0; then
+ exec "$@" cc config.c="$c $mode" config.cxx="$cxx $mode" config.test.runner=nodejs
+else
+ echo "config.c=$c $mode" 1>&2
+ echo "config.cxx=$cxx $mode" 1>&2
+ echo "config.test.runner=nodejs" 1>&2
+ exec $SHELL -i
+fi