Skip to content

Commit 50186d2

Browse files
committed
Version 2.0.5
- Static bitcode version included for custom WebAssembly builds. - "statictest" example project for the static bitcode version.
1 parent 44b7477 commit 50186d2

9 files changed

+76
-4
lines changed

Diff for: .gitattributes

-2
This file was deleted.

Diff for: statictest/build.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
echo "Don't forget to run this before using this terminal window:"
2+
echo "source /PATH/TO/emsdk_env.sh --build=Release"
3+
echo
4+
echo "You might need to run this using sudo as well."
5+
6+
em++ --bind \
7+
./main.cpp \
8+
../superpowered.bc \
9+
-I../../SuperpoweredSDK/Superpowered \
10+
-s WASM=1 \
11+
-s MODULARIZE=1 \
12+
-s SINGLE_FILE=1 \
13+
-s EXPORT_NAME="'TestModule'" \
14+
-O3 -g0 \
15+
-o testmodule.js
16+
17+
# EXPORT_ES6 option does not work as described at
18+
# https://github.com/kripken/emscripten/issues/6284, so we have to
19+
# manually add this by '--post-js' setting when the Emscripten compilation.
20+
echo "export default TestModule;" >> ./testmodule.js

Diff for: statictest/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Superpowered Static WASM Include Demo</title>
8+
</head>
9+
<body>
10+
<script src="main.js" type="module"></script>
11+
</body>
12+
</html>

Diff for: statictest/main.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "Superpowered.h"
2+
#include "SuperpoweredSimple.h"
3+
#include <emscripten.h>
4+
#include <emscripten/bind.h>
5+
6+
static unsigned int testFunction() {
7+
Superpowered::Initialize("ExampleLicenseKey-WillExpire-OnNextUpdate", false, false, false, false, false, false, false);
8+
return Superpowered::Version();
9+
}
10+
11+
EMSCRIPTEN_BINDINGS (TEST) {
12+
emscripten::function("testFunction", &testFunction);
13+
}

Diff for: statictest/main.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import TestModule from './testmodule.js'
2+
3+
var test = TestModule({
4+
postRun: function() {
5+
document.write(test.testFunction());
6+
}
7+
});

Diff for: statictest/testmodule.js

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: superpowered-worker.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: superpowered.bc

429 KB
Binary file not shown.

Diff for: superpowered.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)