mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-24 10:20:24 +01:00
Use default export templates for HTML5
Changes Emscripten SDK version to match that used to compile the default export templates used by Godot 3.4 (in this case 2.0.25 as can be seen here: https://github.com/godotengine/build-containers/blob/3.4/Dockerfile.javascript). This means we no longer need to compile custom export templates when exporting HTML5 for Godot 3.4. Exports from other Godot versions may requiring compiling the GDNative library with a different version of the Emscripten SDK.
This commit is contained in:
parent
03583c0a1b
commit
5f7dc2c247
15 changed files with 52 additions and 119 deletions
21
.github/import_assets.tscn
vendored
Normal file
21
.github/import_assets.tscn
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "tool
|
||||
extends Timer
|
||||
|
||||
func _enter_tree():
|
||||
start()
|
||||
|
||||
func _on_timeout():
|
||||
get_tree().quit(0)
|
||||
"
|
||||
|
||||
[node name="Timer" type="Timer"]
|
||||
process_mode = 0
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
script = SubResource( 1 )
|
||||
|
||||
[connection signal="timeout" from="." to="." method="_on_timeout"]
|
74
.github/workflows/main.yml
vendored
74
.github/workflows/main.yml
vendored
|
@ -41,7 +41,10 @@ jobs:
|
|||
- name: Build godot-cpp bindings
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
working-directory: addons/godot_xterm/native
|
||||
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} godot-cpp-linux
|
||||
run: |
|
||||
docker-compose build godot-cpp-linux
|
||||
UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} godot-cpp-linux
|
||||
|
||||
- name: Build libuv
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
working-directory: addons/godot_xterm/native
|
||||
|
@ -100,7 +103,7 @@ jobs:
|
|||
if: ${{ matrix.platform == 'javascript' }}
|
||||
uses: mymindstorm/setup-emsdk@v11
|
||||
with:
|
||||
version: 3.1.5
|
||||
version: 2.0.25
|
||||
actions-cache-folder: emsdk-cache-${{ matrix.target }}
|
||||
- name: Install additional javascript build dependencies
|
||||
if: ${{ matrix.platform == 'javascript' }}
|
||||
|
@ -166,43 +169,9 @@ jobs:
|
|||
addons/godot_xterm/native/bin/*.dylib
|
||||
addons/godot_xterm/native/bin/*.dll
|
||||
|
||||
# GDNative HTML5 export templates aren't provided so we must build them
|
||||
export_template:
|
||||
name: 'Export Template'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [ release, debug ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Get godot submodule commit hash
|
||||
shell: bash
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||
run: |
|
||||
echo ::set-env name=GODOT_COMMIT_HASH::$(git ls-tree HEAD misc/export_templates/godot -l | cut -d\ -f3)
|
||||
- name: Cache export template
|
||||
uses: actions/cache@v2
|
||||
id: cache-export-template
|
||||
env:
|
||||
cache-name: cache-export-template
|
||||
with:
|
||||
path: misc/export_templates/godot/bin
|
||||
key: godot-${{ env.GODOT_COMMIT_HASH }}-${{ matrix.target }}-v${{ env.EXPORT_TEMPLATE_CACHE_VERSION }}
|
||||
- name: Build template in docker container
|
||||
if: steps.cache-export-template.outputs.cache-hit != 'true'
|
||||
run: cd misc/export_templates && ./build.sh -t ${{ matrix.target }}
|
||||
- name: Upload export template
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: html5-gdnative-export-templates
|
||||
path: misc/export_templates/godot/bin/webassembly_gdnative_${{matrix.target}}.zip
|
||||
|
||||
html5_export:
|
||||
name: 'HTML5 Export'
|
||||
needs: [ build_docker, build_native, export_template ]
|
||||
needs: [ build_docker, build_native ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -210,28 +179,27 @@ jobs:
|
|||
submodules: recursive
|
||||
- name: Setup Godot
|
||||
uses: lihop/setup-godot@v1.0.1
|
||||
with:
|
||||
export-templates: true
|
||||
- name: Install binary build artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: libgodot-xterm-release
|
||||
path: addons/godot_xterm/native/bin
|
||||
- name: Install html5 export templates
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: html5-gdnative-export-templates
|
||||
path: misc/export_templates/godot/bin
|
||||
- name: Create export directory
|
||||
run: mkdir -p docs/demo
|
||||
- name: Import assets
|
||||
shell: bash
|
||||
# The GodotXterm plugin will be disabled the first time we run the editor as resources that it depends
|
||||
# (e.g. icons) will not have been imported yet so the plugin will fail to load. Without the plugin
|
||||
# enabled resources imported by GodotXterm import plugins (e.g. .cast) will not be imported. Therefore,
|
||||
# we need to re-enable the plugin by checking out project.godot and running the editor again.
|
||||
run: godot --editor .github/import_assets.tscn && git checkout project.godot && godot --editor .github/import_assets.tscn
|
||||
- name: Export html5
|
||||
run: godot --export HTML5
|
||||
# FIXME: HTML5 Exports not properly exporting .cast files.
|
||||
# So skip upload for now.
|
||||
#- name: Upload export
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: html5-demo
|
||||
# path: docs/demo
|
||||
|
||||
run: godot --no-window --export HTML5
|
||||
- name: Upload export
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: html5-demo
|
||||
path: docs/demo
|
||||
|
||||
test:
|
||||
name: 'Test'
|
||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -10,6 +10,3 @@
|
|||
[submodule "addons/godot_xterm/native/thirdparty/libtsm"]
|
||||
path = addons/godot_xterm/native/thirdparty/libtsm
|
||||
url = https://github.com/lihop/libtsm
|
||||
[submodule "misc/export_templates/godot"]
|
||||
path = misc/export_templates/godot
|
||||
url = https://github.com/godotengine/godot
|
||||
|
|
|
@ -82,5 +82,5 @@ scons target=$target macos_arch=$(uname -m) disable_pty=$disable_pty -j$nproc
|
|||
# Use Docker to build libgodot-xterm javascript.
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
UID_GID="0:0" TARGET=$target docker-compose build javascript
|
||||
UID_GID="$(id -u):$(id -g)" TARGET=$target docker-compose run javascript
|
||||
UID_GID="$(id -u):$(id -g)" TARGET=$target docker-compose run --rm javascript
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
services:
|
||||
javascript:
|
||||
build: ../../../misc/docker
|
||||
build:
|
||||
context: .
|
||||
dockerfile: javascript.Dockerfile
|
||||
user: ${UID_GID}
|
||||
volumes:
|
||||
- .:/src
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# For convenient building of the library and gdnative export templates targeted at the javacript platform.
|
||||
FROM emscripten/emsdk:3.1.5
|
||||
FROM emscripten/emsdk:2.0.25
|
||||
RUN apt-get update && apt-get install pkg-config python3 -y
|
||||
RUN pip3 install scons
|
|
@ -3,5 +3,5 @@
|
|||
FROM kroggen/ubuntu-16.04-gcc
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y python3 python3-pip gcc-multilib g++-multilib
|
||||
RUN pip3 install scons
|
||||
RUN pip3 install scons==4.3.0
|
||||
CMD scons platform=linux generate_bindings=yes target=${TARGET:-release} bits=${BITS:-64} -j$(nproc)
|
||||
|
|
|
@ -31,7 +31,7 @@ void Terminal::_populate_key_list() {
|
|||
#define GLOBAL_CONSTANT(VAR) GlobalConstants::VAR
|
||||
#else
|
||||
#define GLOBAL_CONSTANT(VAR) get_constant(#VAR)
|
||||
const godot_dictionary _constants = godot_get_global_constants();
|
||||
const godot_dictionary _constants = godot::api->godot_get_global_constants();
|
||||
const Dictionary *constants = (Dictionary *)&_constants;
|
||||
|
||||
auto get_constant = [constants](std::string name) -> int64_t {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f9f6767722e17a1d690f7ce975e1e7f8065b61e2
|
||||
Subproject commit f4f6fac4c784da8c973ade0dbc64a9d8400ee247
|
0
docs/demo/.gitkeep
Normal file
0
docs/demo/.gitkeep
Normal file
|
@ -13,8 +13,8 @@ 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"
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/export_type=2
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
set -e
|
||||
|
||||
# Parse args.
|
||||
args=$@
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
-t|--target)
|
||||
target="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ./build.sh [-t|--target <release|debug>]";
|
||||
exit 128
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# Set defaults.
|
||||
target=${target:-debug}
|
||||
|
||||
# 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 [ -z "$(ls -A -- "$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
|
||||
UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=$target javascript
|
||||
|
||||
if [ "$target" == "debug" ]; then
|
||||
mv godot/bin/godot.javascript.debug.gdnative.zip godot/bin/webassembly_gdnative_debug.zip
|
||||
else
|
||||
mv godot/bin/godot.javascript.opt.gdnative.zip godot/bin/webassembly_gdnative_release.zip
|
||||
fi
|
|
@ -1,12 +0,0 @@
|
|||
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)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 419e713a29f20bd3351a54d1e6c4c5af7ef4b253
|
|
@ -1 +0,0 @@
|
|||
HTML5 GDNative export templates are not provided, this is just a convient script/docker-compose file for building them locally.
|
Loading…
Reference in a new issue