Merge pull request #1247 from nicholas-maltbie/nickmaltbie/javascript-wasm-fix
Javascript Web WASM Fixpull/1260/head
commit
96bec613a0
|
@ -78,8 +78,18 @@ jobs:
|
||||||
run-tests: false
|
run-tests: false
|
||||||
cache-name: ios-arm64
|
cache-name: ios-arm64
|
||||||
|
|
||||||
|
- name: 🌐 Web (wasm32)
|
||||||
|
os: ubuntu-20.04
|
||||||
|
platform: javascript
|
||||||
|
artifact-name: godot-cpp-javascript-wasm32-release
|
||||||
|
artifact-path: bin/libgodot-cpp.javascript.template_release.wasm32.a
|
||||||
|
run-tests: false
|
||||||
|
cache-name: javascript-wasm32
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
|
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
|
||||||
|
EM_VERSION: 3.1.45
|
||||||
|
EM_CACHE_FOLDER: "emsdk-cache"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -104,6 +114,13 @@ jobs:
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -qqq build-essential pkg-config
|
sudo apt-get install -qqq build-essential pkg-config
|
||||||
|
|
||||||
|
- name: Web dependencies
|
||||||
|
if: ${{ matrix.platform == 'javascript' }}
|
||||||
|
uses: mymindstorm/setup-emsdk@v12
|
||||||
|
with:
|
||||||
|
version: ${{env.EM_VERSION}}
|
||||||
|
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
|
||||||
|
|
||||||
- name: Install scons
|
- name: Install scons
|
||||||
run: |
|
run: |
|
||||||
python -m pip install scons==4.0.0
|
python -m pip install scons==4.0.0
|
||||||
|
|
|
@ -21,3 +21,5 @@ android.debug.x86_64 = "res://bin/libgdexample.android.template_debug.x86_64.so"
|
||||||
android.release.x86_64 = "res://bin/libgdexample.android.template_release.x86_64.so"
|
android.release.x86_64 = "res://bin/libgdexample.android.template_release.x86_64.so"
|
||||||
android.debug.arm64 = "res://bin/libgdexample.android.template_debug.arm64.so"
|
android.debug.arm64 = "res://bin/libgdexample.android.template_debug.arm64.so"
|
||||||
android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so"
|
android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so"
|
||||||
|
web.debug.wasm32 = "res://bin/libgdexample.javascript.template_debug.wasm32.wasm"
|
||||||
|
web.release.wasm32 = "res://bin/libgdexample.javascript.template_release.wasm32.wasm"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import os
|
import os
|
||||||
|
from SCons.Util import WhereIs
|
||||||
|
|
||||||
|
|
||||||
def exists(env):
|
def exists(env):
|
||||||
return "EM_CONFIG" in os.environ
|
return WhereIs("emcc") is not None
|
||||||
|
|
||||||
|
|
||||||
def generate(env):
|
def generate(env):
|
||||||
|
@ -10,9 +11,6 @@ def generate(env):
|
||||||
print("Only wasm32 supported on web. Exiting.")
|
print("Only wasm32 supported on web. Exiting.")
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
|
||||||
if "EM_CONFIG" in os.environ:
|
|
||||||
env["ENV"] = os.environ
|
|
||||||
|
|
||||||
env["CC"] = "emcc"
|
env["CC"] = "emcc"
|
||||||
env["CXX"] = "em++"
|
env["CXX"] = "em++"
|
||||||
env["AR"] = "emar"
|
env["AR"] = "emar"
|
||||||
|
@ -26,6 +24,10 @@ def generate(env):
|
||||||
env["ARCOM_POSIX"] = env["ARCOM"].replace("$TARGET", "$TARGET.posix").replace("$SOURCES", "$SOURCES.posix")
|
env["ARCOM_POSIX"] = env["ARCOM"].replace("$TARGET", "$TARGET.posix").replace("$SOURCES", "$SOURCES.posix")
|
||||||
env["ARCOM"] = "${TEMPFILE(ARCOM_POSIX)}"
|
env["ARCOM"] = "${TEMPFILE(ARCOM_POSIX)}"
|
||||||
|
|
||||||
|
# Thread support (via SharedArrayBuffer).
|
||||||
|
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
|
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
|
|
||||||
# All intermediate files are just LLVM bitcode.
|
# All intermediate files are just LLVM bitcode.
|
||||||
env["OBJPREFIX"] = ""
|
env["OBJPREFIX"] = ""
|
||||||
env["OBJSUFFIX"] = ".bc"
|
env["OBJSUFFIX"] = ".bc"
|
||||||
|
@ -39,9 +41,4 @@ def generate(env):
|
||||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
||||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
||||||
|
|
||||||
if env["target"] == "debug":
|
|
||||||
env.Append(CCFLAGS=["-O0", "-g"])
|
|
||||||
elif env["target"] == "release":
|
|
||||||
env.Append(CCFLAGS=["-O3"])
|
|
||||||
|
|
||||||
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
|
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
|
||||||
|
|
Loading…
Reference in New Issue