parent
c4d3f019da
commit
18bfa133ab
|
@ -80,11 +80,11 @@ jobs:
|
||||||
|
|
||||||
- name: 🌐 Web (wasm32)
|
- name: 🌐 Web (wasm32)
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
platform: javascript
|
platform: web
|
||||||
artifact-name: godot-cpp-javascript-wasm32-release
|
artifact-name: godot-cpp-web-wasm32-release
|
||||||
artifact-path: bin/libgodot-cpp.javascript.template_release.wasm32.a
|
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
|
||||||
run-tests: false
|
run-tests: false
|
||||||
cache-name: javascript-wasm32
|
cache-name: web-wasm32
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
|
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
|
||||||
|
@ -115,7 +115,7 @@ jobs:
|
||||||
sudo apt-get install -qqq build-essential pkg-config
|
sudo apt-get install -qqq build-essential pkg-config
|
||||||
|
|
||||||
- name: Web dependencies
|
- name: Web dependencies
|
||||||
if: ${{ matrix.platform == 'javascript' }}
|
if: ${{ matrix.platform == 'web' }}
|
||||||
uses: mymindstorm/setup-emsdk@v12
|
uses: mymindstorm/setup-emsdk@v12
|
||||||
with:
|
with:
|
||||||
version: ${{env.EM_VERSION}}
|
version: ${{env.EM_VERSION}}
|
||||||
|
|
|
@ -21,5 +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.debug.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.wasm"
|
||||||
web.release.wasm32 = "res://bin/libgdexample.javascript.template_release.wasm32.wasm"
|
web.release.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.wasm"
|
||||||
|
|
|
@ -33,7 +33,7 @@ def validate_parent_dir(key, val, env):
|
||||||
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
|
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
|
||||||
|
|
||||||
|
|
||||||
platforms = ("linux", "macos", "windows", "android", "ios", "javascript")
|
platforms = ("linux", "macos", "windows", "android", "ios", "web")
|
||||||
|
|
||||||
# CPU architecture options.
|
# CPU architecture options.
|
||||||
architecture_array = [
|
architecture_array = [
|
||||||
|
@ -222,7 +222,7 @@ def generate(env):
|
||||||
env["arch"] = "universal"
|
env["arch"] = "universal"
|
||||||
elif env["platform"] == "android":
|
elif env["platform"] == "android":
|
||||||
env["arch"] = "arm64"
|
env["arch"] = "arm64"
|
||||||
elif env["platform"] == "javascript":
|
elif env["platform"] == "web":
|
||||||
env["arch"] = "wasm32"
|
env["arch"] = "wasm32"
|
||||||
else:
|
else:
|
||||||
host_machine = platform.machine().lower()
|
host_machine = platform.machine().lower()
|
||||||
|
|
|
@ -11,34 +11,34 @@ def generate(env):
|
||||||
print("Only wasm32 supported on web. Exiting.")
|
print("Only wasm32 supported on web. Exiting.")
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
|
||||||
|
# Emscripten toolchain
|
||||||
env["CC"] = "emcc"
|
env["CC"] = "emcc"
|
||||||
env["CXX"] = "em++"
|
env["CXX"] = "em++"
|
||||||
env["AR"] = "emar"
|
env["AR"] = "emar"
|
||||||
env["RANLIB"] = "emranlib"
|
env["RANLIB"] = "emranlib"
|
||||||
env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"])
|
|
||||||
env.Append(LINKFLAGS=["-s", "SIDE_MODULE=1"])
|
|
||||||
env["SHOBJSUFFIX"] = ".bc"
|
|
||||||
env["SHLIBSUFFIX"] = ".wasm"
|
|
||||||
# Use TempFileMunge since some AR invocations are too long for cmd.exe.
|
# Use TempFileMunge since some AR invocations are too long for cmd.exe.
|
||||||
# Use POSIX-style paths, required with TempFileMunge.
|
# Use POSIX-style paths, required with TempFileMunge.
|
||||||
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)}"
|
||||||
|
|
||||||
|
# All intermediate files are just object files.
|
||||||
|
env["OBJSUFFIX"] = ".o"
|
||||||
|
env["SHOBJSUFFIX"] = ".o"
|
||||||
|
|
||||||
|
# Static libraries clang-style.
|
||||||
|
env["LIBPREFIX"] = "lib"
|
||||||
|
env["LIBSUFFIX"] = ".a"
|
||||||
|
|
||||||
|
# Shared library as wasm.
|
||||||
|
env["SHLIBSUFFIX"] = ".wasm"
|
||||||
|
|
||||||
# Thread support (via SharedArrayBuffer).
|
# Thread support (via SharedArrayBuffer).
|
||||||
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
|
|
||||||
# All intermediate files are just LLVM bitcode.
|
# Build as side module (shared library).
|
||||||
env["OBJPREFIX"] = ""
|
env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"])
|
||||||
env["OBJSUFFIX"] = ".bc"
|
env.Append(LINKFLAGS=["-s", "SIDE_MODULE=1"])
|
||||||
env["PROGPREFIX"] = ""
|
|
||||||
# Program() output consists of multiple files, so specify suffixes manually at builder.
|
|
||||||
env["PROGSUFFIX"] = ""
|
|
||||||
env["LIBPREFIX"] = "lib"
|
|
||||||
env["LIBSUFFIX"] = ".a"
|
|
||||||
env["LIBPREFIXES"] = ["$LIBPREFIX"]
|
|
||||||
env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
|
|
||||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
|
||||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
|
||||||
|
|
||||||
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
|
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
|
Loading…
Reference in New Issue