This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from arcanis/master
Adds asm.js support
- Loading branch information
Showing
31 changed files
with
773 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ node_modules | |
build | ||
.DS_Store | ||
.clang_complete | ||
|
||
/browser.js | ||
emsdk_portable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
test | ||
build | ||
.gitignore | ||
emsdk_portable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
try { | ||
module.exports = require('./build/Release/superstring.node') | ||
} catch (e) { | ||
module.exports = require('./build/Debug/superstring.node') | ||
if (process.env.SUPERSTRING_USE_BROWSER_VERSION) { | ||
module.exports = require('./browser'); | ||
} else { | ||
try { | ||
module.exports = require('./build/Release/superstring.node') | ||
} catch (e) { | ||
module.exports = require('./build/Debug/superstring.node') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
EM_COMPILER_PATH=$(find emsdk_portable -name em++ | head -n1) | ||
|
||
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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
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 -j4 latest | ||
$EMSDK_PATH activate latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include <emscripten/val.h> | ||
|
||
#include "patch.h" | ||
|
||
template<> inline Patch const * emscripten::val::as<Patch const *>(void) const { | ||
using namespace emscripten; | ||
using namespace internal; | ||
|
||
EM_DESTRUCTORS destructors; | ||
EM_GENERIC_WIRE_TYPE result = _emval_as(handle, TypeID<AllowedRawPointer<Patch const>>::get(), &destructors); | ||
DestructorsRunner dr(destructors); | ||
return fromGenericWireType<Patch *>(result); | ||
} |
Oops, something went wrong.