aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default-emcc
blob: 9a8e59548bb0d9e2e76d03c3040502626cc76f39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

# file      : etc/environments/default-emcc
# license   : MIT; 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