Skip to content

Commit

Permalink
Fix some C++ warnings and improve GDevelop.js README
Browse files Browse the repository at this point in the history
Don't show in changelog
  • Loading branch information
4ian committed Nov 22, 2023
1 parent 71b369d commit b7da436
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"memory_resource": "cpp",
"__bits": "cpp",
"__verbose_abort": "cpp",
"variant": "cpp"
"variant": "cpp",
"charconv": "cpp"
},
"files.exclude": {
"Binaries/*build*": true,
Expand Down
5 changes: 0 additions & 5 deletions Core/GDCore/IDE/ExtensionsLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void ExtensionsLoader::LoadAllExtensions(const gd::String &directory,
struct dirent *lecture;
DIR *rep;
rep = opendir(directory.c_str());
int l = 0;

if (rep == NULL) {
cout << "Unable to open Extensions (" << directory << ") directory."
Expand All @@ -63,8 +62,6 @@ void ExtensionsLoader::LoadAllExtensions(const gd::String &directory,

LoadExtension(directory + "/" + lec, platform, forgiving);
librariesLoaded.push_back(directory + "/" + lec);

l++;
}
}

Expand Down Expand Up @@ -103,7 +100,6 @@ void ExtensionsLoader::ExtensionsLoadingDone(const gd::String &directory) {
struct dirent *lecture;
DIR *rep;
rep = opendir(directory.c_str());
int l = 0;

if (rep == NULL) {
cout << "Unable to open Extensions (" << directory << ") directory."
Expand All @@ -118,7 +114,6 @@ void ExtensionsLoader::ExtensionsLoadingDone(const gd::String &directory) {
lec.find(".xgd" + suffix, lec.length() - 4 - suffix.length()) !=
string::npos) {
librariesLoaded.push_back(directory + "/" + lec);
l++;
}
}

Expand Down
3 changes: 0 additions & 3 deletions Core/GDCore/IDE/Project/ProjectResourcesCopier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ bool ProjectResourcesCopier::CopyAllResourcesTo(
// Copy resources
map<gd::String, gd::String>& resourcesNewFilename =
resourcesMergingHelper.GetAllResourcesOldAndNewFilename();
unsigned int i = 0;
for (map<gd::String, gd::String>::const_iterator it =
resourcesNewFilename.begin();
it != resourcesNewFilename.end();
Expand All @@ -71,8 +70,6 @@ bool ProjectResourcesCopier::CopyAllResourcesTo(
destinationFile + _("\"."));
}
}

++i;
}

return true;
Expand Down
56 changes: 23 additions & 33 deletions GDevelop.js/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# GDevelop.js

This is the port of GDevelop core classes to WebAssembly+JavaScript. This allows [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 development software requiring no programming skills. Download it on [the official website](https://gdevelop.io).
These are the bindings of GDevelop core classes to WebAssembly+JavaScript. This allows [GDevelop Core libraries](https://github.com/4ian/GDevelop) to run in a browser or on Node.js.

## How to build

Expand All @@ -16,46 +14,38 @@ This is the port of GDevelop core classes to WebAssembly+JavaScript. This allows

- 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):

```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.
```bash
git clone https://github.com/emscripten-core/emsdk/
cd emsdk
git pull
./emsdk install 3.1.21
./emsdk activate 3.1.21
```

- 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` |
| 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
npm install
npm run build
```
```bash
cd GDevelop.js
npm install # Only the first time.
npm run build # After any C++ changes.
```

> ⚠️ If the npm install fails, relaunch it in a different terminal using a recent Node.js and npm version (to avoid using the old npm version from Emscripten).
> ℹ️ 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.
-> ⏱ The linking (last step) of the build can be made a few seconds faster by specifying `-- --dev`.

- You can then launch GDevelop 5 that will use your build of GDevelop.js:

```bash
cd ..
cd newIDE/app
npm install
npm start
```
```bash
cd ..
cd newIDE/app
npm install
npm start
```

More information in [GDevelop 5 README](https://github.com/4ian/GDevelop/blob/master/newIDE/README.md).

Expand Down

0 comments on commit b7da436

Please sign in to comment.