-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·69 lines (59 loc) · 1.25 KB
/
build.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
set -u
mode=$(echo $1 | sed "s/\/$//")
if [ $mode != "browser" ] && [ $mode != "main" ]
then
echo "need to specify 'browser' or 'main' as the first argument"
exit 1
fi
# Copying over the Javascript files.
destdir=$mode
rm -rf ${destdir}
mkdir -p ${destdir}
cp js/*.js $destdir
cp -r js/internal $destdir
if [ $mode == "main" ]
then
keep=node
else
keep=web
fi
mkdir ${destdir}/abstract
to_rename=$(ls js/abstract/*_${keep}.js)
for x in ${to_rename[@]}
do
newname=$(basename $x | sed "s/_${keep}\\.js$/.js/g")
cp $x ${destdir}/abstract/$newname
done
# Building the Wasm files.
builddir=build_$mode
if [ $mode == "main" ]
then
node_flag=ON
else
node_flag=OFF
fi
if [ ! -e $builddir ]
then
mkdir $builddir
echo "{}" > $builddir/package.json # avoid assuming ES6 syntax for igraph config scripts.
emcmake cmake \
-S . \
-B $builddir \
-DCOMPILE_NODE=${node_flag} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=extern/installed \
-DTATAMI_HDF5_FIND_HDF5=OFF
fi
cd $builddir
emmake make
final=../${destdir}/wasm
mkdir -p ${final}
cp -r scran.* ${final}
if [ $mode == "main" ]
then
# For easier testing.
mkdir -p ../js/wasm
cp -r scran.* ../js/wasm
fi