Skip to content

Commit

Permalink
rename emcc artefact, update readme (add TOC)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 20, 2016
1 parent bfc7603 commit 867fe84
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
54 changes: 44 additions & 10 deletions README.org
@@ -1,5 +1,29 @@
* c.thi.ng

* Contents :toc_3_gh:
- [[#cthing][c.thi.ng]]
- [[#overview][Overview]]
- [[#data-structures][Data structures]]
- [[#memory-management][Memory management]]
- [[#math][Math]]
- [[#simulation][Simulation]]
- [[#geometry][Geometry]]
- [[#examples][Examples]]
- [[#1d2d-cellular-automata][1D/2D Cellular automata]]
- [[#diffusion-limited-aggregation][Diffusion-Limited Aggregation]]
- [[#poisson-disc-sampling-image-conversion][Poisson disc sampling image conversion]]
- [[#verlet-physics][Verlet physics]]
- [[#requirements][Requirements]]
- [[#dependencies][Dependencies]]
- [[#build--test][Build & test]]
- [[#build-static-library][Build static library]]
- [[#build-source-x-ref][Build source x-ref]]
- [[#disassemble--list-symbols][Disassemble & list symbols]]
- [[#compile-with-emscripten][Compile with emscripten]]
- [[#build-customization][Build customization]]
- [[#contributors][Contributors]]
- [[#license][License]]

** Overview

WIP
Expand Down Expand Up @@ -200,16 +224,26 @@ nm -g -j bin/release/libcthing.a | grep --color=never _ct_
** Compile with emscripten

#+BEGIN_SRC shell
# help / usage
./compile -h

# compile with tests, closure pass & remove duplicate fns
./compile -tdc

python3 -m http.server

# in browser dev console - http://localhost:8000/
# geom(); geom._main()
# help / usage
./compile -h
# Usage:
# -a : separate asm.js output
# -c : enable Closure compiler step
# -d : remove duplicate functions
# -D SYM : add define
# -h : show this help
# -k : enable runtime checks
# -m : enable memory checks
# -s : enable SSE (SIMD.js)
# -t : include tests

# compile with tests, closure pass & remove duplicate fns
./compile -tdc

python3 -m http.server

# in browser dev console - http://localhost:8000/
cthing(); cthing._main()
#+END_SRC

** Build customization
Expand Down
6 changes: 3 additions & 3 deletions compile
Expand Up @@ -7,8 +7,8 @@ SRC="src/data/adjacency.c src/data/cons.c src/data/consrc.c src/data/hashset.c s
TESTS=
CFLAGS="-std=c11 -Os -Isrc"
EMFLAGS="-s ASM_JS=1 -s ASSERTIONS=0 -s INVOKE_RUN=0 -s AGGRESSIVE_VARIABLE_ELIMINATION=1 -s MODULARIZE=1 -s NO_EXIT_RUNTIME=1 -s TOTAL_MEMORY='48*1024*1024'"
OUT=geom.js
MIN=geom.min.js
OUT=cthing.js
MIN=cthing.min.js

usage()
{
Expand Down Expand Up @@ -70,7 +70,7 @@ time emcc $CFLAGS \
--emit-symbol-map \
$EMFLAGS \
-s "TOTAL_STACK=1*1024*1024" \
-s "EXPORT_NAME='geom'" \
-s "EXPORT_NAME='cthing'" \
-o $OUT \
$SRC \
$TESTS
Expand Down
4 changes: 2 additions & 2 deletions index.html
Expand Up @@ -10,8 +10,8 @@
</div>
<!--
<script>var Module = Module || {};</script>
<script src="geom.asm.js" type="text/javascript"></script>
<script src="cthing.asm.js" type="text/javascript"></script>
-->
<script src="geom.min.js" type="text/javascript"></script>
<script src="cthing.min.js" type="text/javascript"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions postprocess.js
@@ -1,6 +1,6 @@
fs=require('fs');
src=fs.readFileSync('geom.js','utf8');
src=fs.readFileSync('cthing.js','utf8');
src=src.replace(/_ct_\w+_\d+:[\w\$]+,?/g, '');
src=src.replace(/\w+\._ct_\w+_\d+\=\w+._ct_\w+_\d+;/g, '');
src=src.replace(/\s{2,}/g,' ');
fs.writeFileSync('geom.min.js', src, 'utf8');
fs.writeFileSync('cthing.min.js', src, 'utf8');

0 comments on commit 867fe84

Please sign in to comment.