Skip to content

Commit

Permalink
update emcc build opts, update compile-bc
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 13, 2016
1 parent 189d1e9 commit 07d1652
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,20 @@ make config=release_sse ex-glfw01 && bin/release/ex-glfw01
To compile with Emscripten & open in browser: [[http://localhost:8000/glfw.html][http://localhost:8000/glfw.html]]

#+BEGIN_SRC shell
# build LLVM bitcode of library (libcthing.bc)
# build LLVM bitcode of library (./obj/libcthing.bc)
./compile-bc

# compile example for browser & link with lib
emcc -Os -DCT_FEATURE_LOG -DNDEBUG \
emcc -O2 -DCT_FEATURE_LOG -DCT_NO_EXPORT -DNDEBUG \
-s 'USE_GLFW=3' \
-s 'ELIMINATE_DUPLICATE_FUNCTIONS=1' \
-s 'NO_EXIT_RUNTIME=1' \
--llvm-lto 1 \
--closure 1 \
--preload-file assets/suzanne.stl \
-Isrc \
-o glfw.html \
examples/glfw/*.c libcthing.bc
examples/glfw/*.c obj/libcthing.bc

# launch server
python -m SimpleHTTPServer
Expand Down
4 changes: 3 additions & 1 deletion compile-bc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ for d in $SRC_DIRS; do for f in `ls $d/*.c`; do SRC="$SRC $f"; done; done;

CFLAGS="-std=c11 -Os -Isrc -DCT_NO_EXPORT"
EMFLAGS="-s ASM_JS=1 -s ASSERTIONS=0 --js-library src/rt_cthing.js"
OUT=libcthing.bc
BUILD_DIR=obj
OUT=$BUILD_DIR/libcthing.bc

usage()
{
Expand Down Expand Up @@ -48,6 +49,7 @@ echo "cflags: $CFLAGS"
echo "emflags: $EMFLAGS"
echo "src: $SRC"

mkdir -p $BUILD_DIR
time emcc $CFLAGS $EMFLAGS -o $OUT $SRC

ls -la $OUT

0 comments on commit 07d1652

Please sign in to comment.