forked from lovasoa/highs-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·32 lines (28 loc) · 1.13 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
#!/usr/bin/env bash
set -e
root="$(dirname $(realpath "$0"))"
mkdir -p build
cd build
# Run emconfigure with the normal configure command as an argument.
emcmake cmake ../HiGHS -DOPENMP=OFF -DFAST_BUILD=OFF -DSHARED=OFF
# Run emmake with the normal make to generate wasm object files.
emmake make -j8 libhighs
# Compile the linked code generated by make to JavaScript + WebAssembly.
# 'project.o' should be replaced with the make output for your project, and
# you may need to rename it if it isn't something emcc recognizes
# (for example, it might have a different suffix like 'project.so' or
# 'project.so.1', or no suffix like just 'project' for an executable).
# If the project output is a library, you may need to add your 'main.c' file
# here as well.
# [-Ox] represents build optimisations (discussed in the next section).
export EMCC_CLOSURE_ARGS="--jscomp_off=checkTypes"
emcc -O3 \
-s EXPORTED_FUNCTIONS="@$root/exported_functions.json" \
-s EXTRA_EXPORTED_RUNTIME_METHODS="['cwrap']" \
-s MODULARIZE=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-flto \
--closure 1 \
--pre-js "$root/src/pre.js" \
--post-js "$root/src/post.js" \
lib/*.a -o highs.js