Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Add script for installing emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Mar 3, 2017
1 parent afd2299 commit 74c4502
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
.clang_complete

/browser.js
emsdk_portable
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test
build
.gitignore
emsdk_portable
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
"browser": "./browser",
"scripts": {
"build:node": "node-gyp configure build",
"build:browser": "em++ --bind -o browser.js -O3 -std=c++14 -I src/bindings/em -I src/core --pre-js src/bindings/em/prologue.js --post-js src/bindings/em/epilogue.js src/core/*.cc src/bindings/em/*.cc -s TOTAL_MEMORY=134217728 --memory-init-file 0",
"build:browser:maybe": "test -f browser.js || test -n \"$CI\" || ! command -v em++ 2>&1 > /dev/null || npm run build:browser",
"build:all": "npm run build:node && npm run build:browser",
"install": "npm run build:node && npm run build:browser:maybe",
"test-native": "script/test-native.js",
"build:browser": "script/build-browser-version.sh",
"build": "npm run build:node && npm run build:browser",
"test:native": "script/test-native.js",
"test:node": "mocha test/js/*.js",
"test:browser": "FORCE_BROWSER_FALLBACK=1 mocha test/js/*.js",
"test:all": "npm run test:node && npm run test:browser",
"test": "npm run test:all",
"test": "npm run test:node && npm run test:browser",
"benchmark": "node benchmark/marker-index.benchmark.js",
"prepublish": "npm run standard",
"prepublish": "not-in-install && npm run build:browser || in-install",
"standard": "standard --recursive src test",
"ci": "npm run standard && node-gyp rebuild --debug --tests && npm run test"
"ci": "script/install-emscripten.sh && npm run standard && node-gyp rebuild --debug --tests && npm run test"
},
"repository": {
"type": "git",
Expand All @@ -39,6 +36,7 @@
},
"devDependencies": {
"chai": "^2.0.0",
"in-publish": "^2.0.0",
"mocha": "^2.3.4",
"random-seed": "^0.2.0",
"segfault-handler": "^1.0.0",
Expand Down
19 changes: 19 additions & 0 deletions script/build-browser-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

EM_COMPILER_PATH=$(find ./emsdk_portable/emscripten -name em++ | head -n1)

ONEONEONEONE
echo "Running ${EM_COMPILER_PATH}"
${EM_COMPILER_PATH} \
--bind \
-o browser.js \
-O3 \
-std=c++14 \
-I src/bindings/em \
-I src/core \
--pre-js src/bindings/em/prologue.js \
--post-js src/bindings/em/epilogue.js \
src/core/*.cc \
src/bindings/em/*.cc \
-s TOTAL_MEMORY=134217728 \
--memory-init-file 0 \
15 changes: 15 additions & 0 deletions script/install-emscripten.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

EMSCRIPTEN_DOWNLOAD_URL='https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz'
EMSDK_PATH="./emsdk_portable/emsdk"

if [ ! -f $EMSDK_PATH ]; then
echo 'Downloading emscripten SDK installer...'
curl $EMSCRIPTEN_DOWNLOAD_URL | tar xz
fi

echo 'Installing emscripten SDK...'

$EMSDK_PATH update
$EMSDK_PATH install latest
$EMSDK_PATH activate latest

0 comments on commit 74c4502

Please sign in to comment.