Compare commits

...

11 Commits

Author SHA1 Message Date
Florian Rival
afc2d284c1 Fix missing distutils 2023-11-21 18:27:45 +01:00
Florian Rival
c2ed4e9910 Fix test not finishing on CircleCI Linux machines 2023-11-21 16:19:05 +01:00
Florian Rival
8d2341bd21 Try forceExit 2023-11-21 15:36:56 +01:00
Florian Rival
b187d9ec98 Merge branch 'master' into emsdk-update 2023-11-21 14:45:46 +01:00
Florian Rival
d2da102830 Add --detectOpenHandles 2023-11-21 14:45:06 +01:00
Florian Rival
a6c4f742c2 Comment debugging options to see if the test in the CI pass 2023-09-08 14:40:43 +02:00
Florian Rival
e6935206c0 Try without wasm-exceptions flag 2023-09-08 14:18:35 +02:00
Florian Rival
00190de683 Revert to Node 16 on Travis for now 2023-09-07 10:52:10 +02:00
Florian Rival
7a8c359379 Upgrade CircleCI/AppVeyor to Emscripten 3.1.21 2023-09-07 09:24:01 +02:00
Florian Rival
29aa2479f6 Upgrade Travis to Emscripten 3.1.21 and Node.js 18 2023-09-07 09:20:46 +02:00
Arthur Pacaud
7010b6880d Update Emscripten version 2023-09-07 04:31:09 +02:00
8 changed files with 60 additions and 31 deletions

View File

@@ -30,7 +30,7 @@ jobs:
- run:
name: Install Emscripten (for GDevelop.js)
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
# GDevelop.js dependencies
- restore_cache:
@@ -107,7 +107,7 @@ jobs:
- run:
name: Install Emscripten (for GDevelop.js)
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
- run:
name: Install system dependencies for Electron builder
@@ -127,7 +127,8 @@ jobs:
# Build GDevelop.js (and run tests to ensure it works)
- run:
name: Build GDevelop.js
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test && cd ..
# Use "--runInBand" as it's faster and avoid deadlocks on CircleCI Linux machines (probably because limited in processes number).
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test -- --runInBand && cd ..
# GDevelop IDE dependencies (after building GDevelop.js to avoid downloading a pre-built version)
- run:
@@ -184,7 +185,7 @@ jobs:
- run:
name: Install Emscripten (for GDevelop.js)
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
# GDevelop.js dependencies
- restore_cache:
@@ -200,7 +201,8 @@ jobs:
# Build GDevelop.js (and run tests to ensure it works)
- run:
name: Build GDevelop.js
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test && cd ..
# Use "--runInBand" as it's faster and avoid deadlocks on CircleCI Linux machines (probably because limited in processes number).
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test -- --runInBand && cd ..
- save_cache:
paths:

View File

@@ -14,7 +14,7 @@ tasks:
init: |
sudo apt-get update
sudo apt install cmake python-is-python3 python3-distutils -y
git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
cd GDevelop.js
npm install
source ../emsdk/emsdk_env.sh && npm run build -- --dev

View File

@@ -39,7 +39,7 @@ install:
- cd ..
# Install Emscripten (for GDevelop.js)
- git clone https://github.com/juj/emsdk.git
- cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
- cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
# Install GDevelop.js dependencies
- cd GDevelop.js && npm install && cd ..
# Build GDevelop.js

View File

@@ -12,8 +12,17 @@ if(NOT EMSCRIPTEN)
endif()
# Compilation flags (https://emscripten.org/docs/tools_reference/emcc.html):
add_compile_options(-O2) # Optimizations during compilation
#add_compile_options(-g --profiling) # Uncomment for debugging + profiling support
add_compile_options(-O3 -flto) # Optimizations during compilation
# add_compile_options(-fwasm-exceptions) # Enable exceptions
if(NOT DISABLE_EMSCRIPTEN_LINK_OPTIMIZATIONS)
add_compile_options(-flto) # The compiler needs to know if there will be link time optimisations
endif()
# Compiler debugging options
#
# add_compile_options(-fsanitize=address) # Uncomment to auto-detect occurences of memory bugs (memory leak, use after free, overflows, ...) - also enable linking below!
# add_compile_options(-fsanitize=undefined) # Uncomment to auto-detect occurences of undefined behavior - also enable linking below!
# add_compile_options(-g) # Uncomment for debugging support
# add_compile_options(--profiling) # Uncomment for profiling support
# Common directories:
@@ -64,7 +73,7 @@ if(DISABLE_EMSCRIPTEN_LINK_OPTIMIZATIONS)
message(STATUS "Disabling optimization at link time for (slightly) faster build")
target_link_libraries(GD "-O0")
else()
target_link_libraries(GD "-O2")
target_link_libraries(GD "-O3 -flto")
endif()
target_link_libraries(GD "--post-js ${GD_base_dir}/GDevelop.js/Bindings/glue.js")
target_link_libraries(GD "--post-js ${GD_base_dir}/GDevelop.js/Bindings/postjs.js")
@@ -73,7 +82,17 @@ target_link_libraries(GD "-s EXPORT_NAME=\"initializeGDevelopJs\"") # Global fun
target_link_libraries(GD "-s TOTAL_MEMORY=48MB") # Get some initial memory size that is a bit bigger than the default.
target_link_libraries(GD "-s ALLOW_MEMORY_GROWTH=1")
target_link_libraries(GD "-s ERROR_ON_UNDEFINED_SYMBOLS=0")
target_link_libraries(GD "-s \"EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPreMain', 'calledRun', 'UTF8ToString']\"")
target_link_libraries(GD "-s \"EXPORTED_FUNCTIONS=['_free']\"")
# Linker debugging options
#
# target_link_libraries(GD "-s DEMANGLE_SUPPORT=1") # Demangle stack traces
# target_link_libraries(GD "-s ASSERTIONS=1") # Basic runtime memory allocation checks (necessary for wasm exceptions stack traces)
# target_link_libraries(GD "-s ASSERTIONS=2 -s SAFE_HEAP=1") # Uncomment to do runtime checks for memory allocations and access errors
# target_link_libraries(GD "-fsanitize=address") # Uncomment to auto-detect occurences of memory bugs (memory leak, use after free, overflows, ...) - also enable compiling above!
# target_link_libraries(GD "-fsanitize=undefined") # Uncomment to auto-detect occurences of undefined behavior - also enable compiling above!
# target_link_libraries(--cpuprofiler) # Uncomment for interactive performance profiling
# target_link_libraries(--memoryprofiler) # Uncomment for interactive memory profiling
# Even if we're building an "executable", prefix it by lib as it's used as a library.
set_target_properties(GD PROPERTIES PREFIX "lib")

View File

@@ -10,7 +10,7 @@ module.exports = function (grunt) {
const buildOutputPath = '../Binaries/embuild/GDevelop.js/';
const buildPath = '../Binaries/embuild';
let cmakeBinary = 'emconfigure cmake';
let cmakeBinary = 'emcmake cmake';
let cmakeGeneratorArgs = [];
let makeBinary = 'emmake make';
let makeArgs = ['-j 4'];
@@ -44,11 +44,11 @@ module.exports = function (grunt) {
// Find CMake in usual folders or fallback to PATH.
if (fs.existsSync('C:\\Program Files\\CMake\\bin\\cmake.exe')) {
cmakeBinary = 'emconfigure "C:\\Program Files\\CMake\\bin\\cmake"';
cmakeBinary = 'emcmake "C:\\Program Files\\CMake\\bin\\cmake"';
} else if (
fs.existsSync('C:\\Program Files (x86)\\CMake\\bin\\cmake.exe')
) {
cmakeBinary = 'emconfigure "C:\\Program Files (x86)\\CMake\\bin\\cmake"';
cmakeBinary = 'emcmake "C:\\Program Files (x86)\\CMake\\bin\\cmake"';
} else {
console.log(
"⚠️ Can't find CMake in its usual Program Files folder. Make sure you have cmake in your PATH instead."

View File

@@ -9,24 +9,30 @@ This is the port of GDevelop core classes to WebAssembly+JavaScript. This allows
> 👋 Usually, if you're working on the GDevelop editor or extensions in JavaScript, you don't need to rebuild GDevelop.js. If you want to make changes in C++ extensions or classes, read this section.
- Prerequisite tools installed:
- [CMake 3.17+](http://www.cmake.org/) (3.5+ should work on Linux/macOS). On macOS, you can install it via Homebrew (recommended for Apple M1 Architectures).
- [Node.js](https://nodejs.org/). (We recommend using [nvm](https://github.com/nvm-sh/nvm) to be able to switch between Node versions easily).
- Python (via [pyenv](https://github.com/pyenv/pyenv) for versions management).
- Install [Emscripten](https://github.com/kripken/emscripten), as explained below or on the [Emscripten installation instructions](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html):
- Install [Emscripten](https://github.com/kripken/emscripten) version `3.1.21`, as explained below or on the [Emscripten installation instructions](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html):
| Linux/macOS | Windows |
| -------------------------------------------- | -------------------------------------------- |
| `git clone https://github.com/juj/emsdk.git` | `git clone https://github.com/juj/emsdk.git` |
| `cd emsdk` | `cd emsdk` |
| `git pull` | `git pull` |
| `./emsdk install 1.39.6` | `emsdk install 1.39.6` |
| `./emsdk activate 1.39.6` | `emsdk activate 1.39.6` |
| `source ./emsdk_env.sh` | `emsdk_env.bat` |
```bash
git clone https://github.com/emscripten-core/emsdk/
cd emsdk
git pull
./emsdk install 3.1.21
./emsdk activate 3.1.21
```
> ⚠️ If you are on Apple M1, this version of emsdk may not be available for this architecture and you will get an error when installing it, indicating a missing binary. If this is the case, a workaround is to modify the `emsdk.py` line 132 with `machine = 'x86_64'` to ensure a correct binary is downloaded.
- Launch the build from GDevelop.js folder:
- Whenever you try to build GDevelop.js in the future, you will have to load the emsdk environement into your terminal window again by running:
| Linux/macOS | Windows (Powershell) | Windows (cmd.exe) |
| ----------------------- | -------------------- | ----------------- |
| `source ./emsdk_env.sh` | `./emsdk_env.ps1` | `./emsdk_env.bat` |
- With the emscripten environement loaded into your terminal, launch the build from GDevelop.js folder:
```bash
cd GDevelop.js
@@ -38,6 +44,8 @@ npm run build
> Output is created in _/path/to/GD/Binaries/embuild/GDevelop.js/_ and also copied to GDevelop 5 IDE (`newIDE` folder).
> You only need to run `npm install` the first time you make a build.
-> ⏱ The linking (last step) of the build can be made a few seconds faster by specifying `-- --dev`. Be sure to remove it before building a release version, as this disable "link-time optimizations" of the generated WebAssembly module.
- You can then launch GDevelop 5 that will use your build of GDevelop.js:

Binary file not shown.

View File

@@ -19,8 +19,6 @@ init:
install:
# Build GDevelop.js (and run tests to ensure it works).
# (in a subshell to avoid Emscripten polluting the Node.js and npm version for the rest of the build)
# Also install setuptools as our old version of Emscripten uses distutils which was removed in Python 3.12.
# setuptools will make distutils available again (but we should migrate to a newer Emscripten version).
- cmd: >-
cd GDevelop.js
@@ -30,16 +28,18 @@ install:
cd emsdk
emsdk install 1.39.6
CMD /C "emsdk activate 1.39.6 && pip install setuptools && cd .. && npm run build"
emsdk install 3.1.21
CMD /C "emsdk activate 3.1.21 && cd .. && npm run build"
cd ..\..
# Build GDevelop IDE
# Build GDevelop IDE.
# Also install setuptools as something requires distutils in electron-app, and it was removed in Python 3.12.
# setuptools will make distutils available again (but we should migrate our packages probably).
- cmd: >-
pip install setuptools
cd newIDE\app
npm -v && npm install