mirror of
https://github.com/Heretek-AI/GDevelop-Heretek.git
synced 2026-10-12 02:02:42 +00:00
Fix GDevelop.js build on Windows when Visual Studio is installed and update README
This commit is contained in:
@@ -9,3 +9,4 @@ WebIDLGrammar.pkl
|
||||
examples/demo-generated-code.js
|
||||
examples/demo-generated-game.json
|
||||
**/.DS_Store
|
||||
emsdk
|
||||
|
||||
+36
-19
@@ -1,33 +1,51 @@
|
||||
module.exports = function(grunt) {
|
||||
var fs = require('fs');
|
||||
var isWin = /^win/.test(process.platform);
|
||||
const fs = require('fs');
|
||||
const isWin = /^win/.test(process.platform);
|
||||
|
||||
var emscriptenPath = process.env.EMSCRIPTEN;
|
||||
var emscriptenMemoryProfiler = emscriptenPath + '/src/memoryprofiler.js';
|
||||
var cmakeToolchainpath =
|
||||
const buildOutputPath = '../Binaries/Output/libGD.js/Release/';
|
||||
const buildPath = '../Binaries/embuild';
|
||||
|
||||
const emscriptenPath = process.env.EMSCRIPTEN;
|
||||
const emscriptenMemoryProfiler = emscriptenPath + '/src/memoryprofiler.js';
|
||||
const cmakeToolchainpath =
|
||||
emscriptenPath + '/cmake/Modules/Platform/Emscripten.cmake';
|
||||
var buildOutputPath = '../Binaries/Output/libGD.js/Release/';
|
||||
var buildPath = '../Binaries/embuild';
|
||||
|
||||
var cmakeBinary = 'emconfigure cmake';
|
||||
var makeBinary = 'emmake make';
|
||||
let cmakeBinary = 'emconfigure cmake';
|
||||
let makeBinary = 'emmake make';
|
||||
let cmakeArgs = '';
|
||||
|
||||
// Find CMake and make in default paths on Windows
|
||||
// Use more specific paths on Windows
|
||||
if (isWin) {
|
||||
makeBinary = 'emmake "C:\\MinGW\\bin\\mingw32-make"';
|
||||
if (fs.existsSync('C:\\Program Files\\CMake\\bin\\cmake')) {
|
||||
cmakeBinary = 'emconfigure "C:\\Program Files\\CMake\\bin\\cmake"';
|
||||
} else if (fs.existsSync('C:\\Program Files (x86)\\CMake\\bin\\cmake')) {
|
||||
cmakeBinary = 'emconfigure "C:\\Program Files (x86)\\CMake\\bin\\cmake"';
|
||||
// Use make from MinGW
|
||||
if (!fs.existsSync('C:\\MinGW\\bin\\mingw32-make.exe')) {
|
||||
console.error(
|
||||
"🔴 Can't find mingw32-make in C:\\MinGW. Make sure MinGW is installed."
|
||||
);
|
||||
return;
|
||||
}
|
||||
makeBinary = 'emmake "C:\\MinGW\\bin\\mingw32-make"';
|
||||
|
||||
// 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"';
|
||||
} else if (fs.existsSync('C:\\Program Files (x86)\\CMake\\bin\\cmake.exe')) {
|
||||
cmakeBinary = 'emconfigure "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."
|
||||
);
|
||||
}
|
||||
|
||||
cmakeArgs = '-G "MinGW Makefiles"';
|
||||
}
|
||||
|
||||
//Sanity checks
|
||||
if (!process.env.EMSCRIPTEN) {
|
||||
console.error('🔴 EMSCRIPTEN env. variable is not set');
|
||||
console.log(
|
||||
'⚠️ Please set Emscripten environment by launching `emsdk_env` script (`emsdk_env.bat` on Windows)'
|
||||
'⚠️ Please set Emscripten environment by launching `emsdk_env` script (or `emsdk_env.bat` on Windows).'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!fs.existsSync(emscriptenMemoryProfiler)) {
|
||||
console.error(
|
||||
@@ -75,8 +93,7 @@ module.exports = function(grunt) {
|
||||
cmake: {
|
||||
src: [buildPath + '/CMakeCache.txt', 'CMakeLists.txt'],
|
||||
command:
|
||||
cmakeBinary +
|
||||
' ../.. -DFULL_VERSION_NUMBER=FALSE',
|
||||
cmakeBinary + ' ' + cmakeArgs + ' ../.. -DFULL_VERSION_NUMBER=FALSE',
|
||||
options: {
|
||||
execOptions: {
|
||||
cwd: buildPath,
|
||||
@@ -114,7 +131,7 @@ module.exports = function(grunt) {
|
||||
clean: {
|
||||
options: { force: true },
|
||||
build: {
|
||||
src: [buildOutputPath + 'libGD.js', buildOutputPath + 'libGD.min.js'],
|
||||
src: [buildPath, buildOutputPath + 'libGD.js', buildOutputPath + 'libGD.min.js'],
|
||||
},
|
||||
},
|
||||
compress: {
|
||||
|
||||
+17
-24
@@ -1,33 +1,29 @@
|
||||
# GDevelop.js
|
||||
|
||||
This is a port of some parts of **GDevelop** to Javascript using **[Emscripten]**.
|
||||
This is the port of GDevelop core classes to JavaScript. This allow [GDevelop Core libraries](https://github.com/4ian/GDevelop) to run in a browser or on Node.js.
|
||||
|
||||
GDevelop is a full featured, cross-platform, open-source game creator software requiring no programming skills. Download it on [the official website](https://gdevelop-app.com).
|
||||
> 🎮 GDevelop is a full featured, cross-platform, open-source game development software requiring no programming skills. Download it on [the official website](https://gdevelop-app.com).
|
||||
|
||||
## How to build
|
||||
|
||||
- Make sure you have [CMake 3.5+](http://www.cmake.org/)
|
||||
> 👋 Usually if you're working on GDevelop editor or extensions in JavaScript, you don't need rebuilding GDevelop.js. If you want to make changes in C++ extensions or classes, read this section.
|
||||
|
||||
- On Windows, install MinGW (only `mingw32-base-bin` is required).
|
||||
- Make sure you have [CMake 3.5+](http://www.cmake.org/) and [Node.js](nodejs.org/) installed.
|
||||
|
||||
- On Windows, install [MinGW](https://osdn.net/projects/mingw/releases/) (only `mingw32-base-bin` package is required).
|
||||
|
||||
- Install [Emscripten](https://github.com/kripken/emscripten), as explained on the [Emscripten installation instructions](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html):
|
||||
|
||||
```shell
|
||||
git clone https://github.com/juj/emsdk.git
|
||||
cd emsdk
|
||||
./emsdk update
|
||||
./emsdk install sdk-1.37.37-64bit
|
||||
./emsdk activate sdk-1.37.37-64bit
|
||||
source ./emsdk_env.sh
|
||||
```
|
||||
| Linux/macOS | Windows |
|
||||
|-------------|---------|
|
||||
| `git clone https://github.com/juj/emsdk.git` | `git clone https://github.com/juj/emsdk.git` |
|
||||
| `cd emsdk` | `cd emsdk`|
|
||||
| `./emsdk update` | `emsdk update` |
|
||||
| `./emsdk install sdk-1.37.37-64bit` | `emsdk install sdk-1.37.37-64bit` |
|
||||
| `./emsdk activate sdk-1.37.37-64bit` | `emsdk activate sdk-1.37.37-64bit` |
|
||||
| `source ./emsdk_env.sh` | `emsdk_env.bat` |
|
||||
|
||||
(on Windows run `emsdk` instead of `./emsdk`, and `emsdk_env.bat` instead of `source ./emsdk_env.sh`. For up-to-date information, check again [Emscripten installation instructions](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)).
|
||||
|
||||
- Make sure you have Node.js installed and grunt:
|
||||
|
||||
```shell
|
||||
npm install -g grunt-cli
|
||||
```
|
||||
> For up-to-date information, check again [Emscripten installation instructions](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html).
|
||||
|
||||
- Launch the build from GDevelop.js folder:
|
||||
|
||||
@@ -39,7 +35,7 @@ source ./emsdk_env.sh
|
||||
|
||||
Output is created in _/path/to/GD/Binaries/Output/libGD.js/_.
|
||||
|
||||
- You can then launch GDevelop 5 that will use your build of Gdevelop.js:
|
||||
- You can then launch GDevelop 5 that will use your build of GDevelop.js:
|
||||
|
||||
```shell
|
||||
cd ..
|
||||
@@ -61,7 +57,6 @@ npm test
|
||||
The grunt _build_ task:
|
||||
|
||||
- create `Binaries/embuild` directory,
|
||||
- patch SFML `Config.hpp` file to make Emscripten recognized as a linux target,
|
||||
- launch CMake inside to compile GDevelop with _Emscripten toolchain file_,
|
||||
- update the glue.cpp and glue.js from Bindings.idl using _Emscripten WebIDL Binder_,
|
||||
- launch the compilation with _make_ and wrap the generated `libGD.js.raw` into the final `libGD.js` file.
|
||||
@@ -70,7 +65,5 @@ It also create a compressed `libGD.js.gz` file which is handy for distributing t
|
||||
|
||||
## Documentation
|
||||
|
||||
- The file [Bindings.idl](https://github.com/4ian/GDevelop.js/blob/master/Bindings/Bindings.idl) describes all the classes available in GDevelop.js.
|
||||
- The file [Bindings.idl](https://github.com/4ian/GDevelop/blob/master/GDevelop.js/Bindings/Bindings.idl) describes all the classes available in GDevelop.js.
|
||||
- Refer to [GDevelop documentation](http://4ian.github.io/GD-Documentation/GDCore%20Documentation/) for detailed documentation of the original C++ classes.
|
||||
|
||||
[emscripten]: https://github.com/kripken/emscripten
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "grunt build",
|
||||
"clean": "grunt clean",
|
||||
"test": "jest"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user