Update files for javascript build and export

Adds some files to making building and export for HTML5 more convenient.
This commit is contained in:
Leroy Hopson 2021-06-15 13:54:35 +07:00
parent 2f4cbacf15
commit bdda1458c0
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
11 changed files with 83 additions and 26 deletions

View file

@ -2,7 +2,7 @@
set -e set -e
# Get the absolute path to the directory this script is in. #GODOT_DIR Get the absolute path to the directory this script is in.
NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
@ -34,6 +34,6 @@ scons generate_bindings=yes -j$(nproc)
cd ${NATIVE_DIR} cd ${NATIVE_DIR}
scons -j$(nproc) scons -j$(nproc)
echo "To Build libgodot-xterm for javascript platform inside a docker container, run:" # Use Docker to build libgodot-xterm javascript.
echo 'UID_GID="$(id -u):$(id -g)" docker-compose run javascript-build' UID_GID="0:0" docker-compose build javascript
UID_GID="$(id -u):$(id -g)" docker-compose run javascript

View file

@ -1,6 +1,14 @@
services: services:
javascript-build: javascript:
build: misc/docker build: ../../../misc/docker
user: ${UID_GID} user: ${UID_GID}
volumes: volumes:
- .:/godot - .:/src
command:
- /bin/bash
- -c
- |
cd /src/thirdparty/godot-cpp
scons platform=javascript target=debug -j$$(nproc)
cd /src
scons platform=javascript target=debug -j$$(nproc)

View file

@ -1,12 +0,0 @@
FROM ponders/godot-cpp-ci
RUN git clone https://github.com/emscripten-core/emsdk.git
WORKDIR emsdk
RUN ./emsdk install 2.0.10
RUN ./emsdk activate 2.0.10
RUN chmod -R 777 /emsdk
WORKDIR /godot
RUN apt-get update && apt-get install -y vim
COPY ./build.sh /build.sh
RUN chmod +x /build.sh
CMD /build.sh

View file

@ -1,7 +0,0 @@
#!/bin/bash
source /emsdk/emsdk_env.sh
export EM_CACHE=/godot/.emcache
cd /godot/thirdparty/godot-cpp
scons platform=javascript -j$(nproc)
cd /godot
scons platform=javascript -j$(nproc)

View file

@ -5,5 +5,9 @@ mkShell {
scons scons
cacert # Required for git clone on GithHub actions runner. cacert # Required for git clone on GithHub actions runner.
# Used to build for javascript platform.
docker
docker-compose
]; ];
} }

24
export_presets.cfg Normal file
View file

@ -0,0 +1,24 @@
[preset.0]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter="misc/*, addons/godot_xterm/native/thirdparty/*"
export_path="export/index.html"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug="./misc/export_templates/godot/bin/webassembly_gdnative_debug.zip"
custom_template/release="./misc/export_templates/godot/bin/webassembly_gdnative_release.zip"
variant/export_type=2
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/experimental_virtual_keyboard=false

4
misc/docker/Dockerfile Normal file
View file

@ -0,0 +1,4 @@
# For convenient building of the library and gdnative export templates targeted at the javacript platform.
FROM emscripten/emsdk:2.0.10
RUN apt-get update && apt-get install pkg-config python3 -y
RUN pip3 install scons

23
misc/export_templates/build.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
set -e
# Get the absolute path to the directory this script is in.
EXPORT_TEMPLATES_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Update git submodules.
GODOT_DIR=${EXPORT_TEMPLATES_DIR}/godot
if [ ! -d "$GODOT_DIR" ]; then
cd ${EXPORT_TEMPLATES_DIR}
git submodule update --init --recursive -- $GODOT_DIR
fi
# Use Docker to build HTML5 GDNative export templates.
UID_GID="0:0" docker-compose build javascript
# Debug
UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=debug javascript
mv godot/bin/godot.javascript.debug.gdnative.zip godot/bin/webassembly_gdnative_debug.zip
### Release
UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=release javascript
mv godot/bin/godot.javascript.opt.gdnative.zip godot/bin/webassembly_gdnative_release.zip

View file

@ -0,0 +1,12 @@
services:
javascript:
build: ../docker
user: ${UID_GID}
volumes:
- ./godot:/src
command:
- /bin/bash
- -c
- |
cd src
scons platform=javascript tools=no gdnative_enabled=yes target=$${TARGET} -j$$(nproc)

View file

@ -0,0 +1 @@
HTML5 GDNative export templates are not provided, this is just a convient script/docker-compose file for building them locally.