mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-07 02:12:07 +03:00
Merge pull request #1350 from eska014/html5-april18
Update HTML5 documentation
This commit is contained in:
@@ -13,39 +13,34 @@ To compile export templates for the Web, the following is required:
|
||||
- `Emscripten 1.37.9+ <http://emscripten.org/>`__: If the version available
|
||||
per package manager is not recent enough, the best alternative is to install
|
||||
using the `Emscripten SDK <http://kripken.github.io/emscripten-site/docs/gettng_started/downloads.html>`__
|
||||
(Install in a path without spaces, i.e. not in ``Program Files``)
|
||||
- `Python 2.7+ or Python 3.5+ <https://www.python.org/>`__
|
||||
- `SCons <http://www.scons.org>`__ build system
|
||||
|
||||
Building export templates
|
||||
-------------------------
|
||||
|
||||
Start a terminal and set the environment variable ``EMSCRIPTEN_ROOT`` to the
|
||||
installation directory of Emscripten:
|
||||
Before starting, confirm that the Emscripten configuration file exists and
|
||||
specifies all settings correctly. This file is available as ``~/.emscripten``
|
||||
on UNIX-like systems and ``%USERPROFILE%\.emscripten`` on Windows. It's usually
|
||||
written by the Emscripten SDK, e.g. when invoking ``emsdk activate latest``,
|
||||
or by your package manager. It's also created when starting Emscripten's
|
||||
``emcc`` program if the file doesn't exist.
|
||||
|
||||
If you installed Emscripten via the Emscripten SDK, declare the variable with a
|
||||
path to the downloaded folder::
|
||||
|
||||
export EMSCRIPTEN_ROOT=~/emsdk/emscripten/master
|
||||
|
||||
If you installed Emscripten via package manager, the path can be retrieved with
|
||||
the ``em-config`` command::
|
||||
|
||||
export EMSCRIPTEN_ROOT=`em-config EMSCRIPTEN_ROOT`
|
||||
|
||||
On Windows you can set the environment variable in the system settings or in
|
||||
the command prompt::
|
||||
|
||||
set EMSCRIPTEN_ROOT="C:\emsdk\emscripten\master"
|
||||
|
||||
Now go to the root directory of the engine source code and instruct SCons to
|
||||
build the JavaScript platform. Specify ``target`` as either ``release`` for a
|
||||
release build or ``release_debug`` for a debug build::
|
||||
Open a terminal and navigate to the root directory of the engine source code.
|
||||
Then instruct SCons to build the JavaScript platform. Specify ``target`` as
|
||||
either ``release`` for a release build or ``release_debug`` for a debug build::
|
||||
|
||||
scons platform=javascript tools=no target=release
|
||||
scons platform=javascript tools=no target=release_debug
|
||||
|
||||
The engine will now be compiled to WebAssembly by Emscripten. If all goes well,
|
||||
By default, the :ref:`JavaScript singleton <doc_javascript_eval>` will be built
|
||||
into the engine. Since ``eval()`` calls can be a security concern, the
|
||||
``javascript_eval`` option can be used to build without the singleton::
|
||||
|
||||
scons platform=javascript tools=no target=release javascript_eval=no
|
||||
scons platform=javascript tools=no target=release_debug javascript_eval=no
|
||||
|
||||
The engine will now be compiled to WebAssembly by Emscripten. Once finished,
|
||||
the resulting file will be placed in the ``bin`` subdirectory. Its name is
|
||||
``godot.javascript.opt.zip`` for release or ``godot.javascript.opt.debug.zip``
|
||||
for debug.
|
||||
@@ -76,10 +71,10 @@ translated into actual WebAssembly using a tool called ``s2wasm``.
|
||||
Emscripten manages these processes as well, so we just invoke SCons.
|
||||
|
||||
In order to choose one of the two methods, the ``LLVM_ROOT`` variable in the
|
||||
Emscripten configuration file ``~/.emscripten`` is set. If it points to a
|
||||
directory containing binaries of Emscripten's *fastcomp* fork of clang,
|
||||
``asm2wasm`` is used. This is the default in a normal Emscripten installation.
|
||||
Otherwise, LLVM binaries built with the WebAssembly backend will be expected
|
||||
and ``s2wasm`` is used. On Windows, make sure to escape backslashes of paths
|
||||
within this file as double backslashes ``\\`` or use Unix-style paths with
|
||||
a single forward slash ``/``.
|
||||
Emscripten configuration file is used. If it points to a directory containing
|
||||
binaries of Emscripten's *fastcomp* fork of clang, ``asm2wasm`` is used.
|
||||
This is the default in a normal Emscripten installation. Otherwise,
|
||||
LLVM binaries built with the WebAssembly backend will be expected and
|
||||
``s2wasm`` is used. On Windows, make sure to escape backslashes of paths within
|
||||
this file as double backslashes ``\\`` or use Unix-style paths with a single
|
||||
forward slash ``/``.
|
||||
|
||||
Reference in New Issue
Block a user