Skip to content

Commit

Permalink
Update Emscripten's minimum version requirement and related documenta…
Browse files Browse the repository at this point in the history
…tion. (#312)
  • Loading branch information
kevingpqi123 authored Nov 6, 2024
1 parent d7461e0 commit 4f1fc12
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 32 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
path: |
web/emsdk
web/node_modules
key: tgfx-environment-web-20231130
key: tgfx-environment-web-20241106
restore-keys: tgfx-environment-web-

- name: Get Third-Party Cache
Expand All @@ -171,10 +171,16 @@ jobs:
run: |
cd web
npm install
git clone https://github.com/emscripten-core/emsdk.git
if [ ! -d "emsdk" ]; then
git clone https://github.com/emscripten-core/emsdk.git
else
cd emsdk
git pull
cd ..
fi
cd emsdk
./emsdk install 3.1.20
./emsdk activate 3.1.20
./emsdk install 3.1.71
./emsdk activate 3.1.71
shell: bash

- name: Run depsync
Expand All @@ -196,7 +202,7 @@ jobs:
path: |
web/emsdk
web/node_modules
key: tgfx-environment-web-20231130
key: tgfx-environment-web-20241106

- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TGFX utilizes the **C++17** features for development. Below are the minimum tool
- CMake 3.13.0+
- QT 5.13.0+
- NDK 19.2+ (**19.2.5345600 recommended**)
- Emscripten 3.1.20+ (**3.1.20 recommended**)
- Emscripten 3.1.58+


Please pay attention to the following additional notices:
Expand Down Expand Up @@ -207,12 +207,11 @@ At last, launch XCode and open the `mac/Hello2D.xcworkspace`. You'll be ready to
### Web

The web demo project requires the **Emscripten SDK**. You can download and install
it from the [official website](https://emscripten.org/). We recommend using the **3.1.20** version,
which has been fully tested with the tgfx library. If you are on macOS, you can also install it
using the following script:
it from the [official website](https://emscripten.org/). We recommend using the latest version.
If you are on macOS, you can also install it using the following script:

```
web/script/install-emscripten.sh
brew install emscripten
```

To begin, navigate to the `web/` directory and execute the following command to install the
Expand Down Expand Up @@ -251,6 +250,14 @@ npm run build:debug

With these steps completed, you will be able to debug C++ files directly within Chrome DevTools.

The above commands will build and run a single-threaded version. To build a multithreaded version,
just add the suffix ":mt" to each command. For example:
```
npm run build:mt
npm run build:mt:debug
npm run serser:mt
```

To build the demo project in CLion, please Open the `Settings` panel in CLion and go to
`Build, Execution, Deployment` > `CMake`. Create a new build target. And then set the `CMake options`
to the following value:
Expand Down
3 changes: 3 additions & 0 deletions src/layers/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ std::shared_ptr<Layer> Layer::removeChildAt(int index) {
}

void Layer::removeChildren(int beginIndex, int endIndex) {
if (_children.empty()) {
return;
}
if (beginIndex < 0 || static_cast<size_t>(beginIndex) >= _children.size()) {
LOGE("The supplied beginIndex is out of bounds.");
return;
Expand Down
2 changes: 1 addition & 1 deletion sync_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd $(dirname $0)
if [[ `uname` == 'Darwin' ]]; then
if [ ! $(which emcc) ]; then
echo "emscripten not found. Trying to install..."
./web/script/install-emscripten.sh
brew install emscripten
fi
fi

Expand Down
2 changes: 2 additions & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ types
*.js.map
demo/*.js
demo/wasm
demo/wasm-mt
demo/build-hello2d
demo/.hello2d.wasm.md5
demo/.hello2d.wasm-mt.md5
src/wasm
emsdk/

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"typings": "types/tgfx.d.ts",
"scripts": {
"clean:tgfx": "rimraf lib/ types/",
"clean": "npm run clean:tgfx && rimraf demo/build demo/wasm demo/*.md5 demo/*.js demo/*.map demo/cmake-build-*",
"clean": "npm run clean:tgfx && rimraf demo/build demo/wasm demo/wasm-mt demo/.*.md5 demo/*.js demo/*.map demo/cmake-build-*",
"build:tgfx": "npm run clean:tgfx && tsc -p ./tsconfig.type.json && rollup -c ./script/rollup.tgfx.js",
"build": "node script/cmake.demo.js -a wasm && npm run build:tgfx && rollup -c ./script/rollup.demo.js",
"build:debug": "node script/cmake.demo.js -a wasm --debug && npm run build:tgfx && rollup -c ./script/rollup.demo.js",
Expand Down
20 changes: 0 additions & 20 deletions web/script/install-emscripten.sh

This file was deleted.

0 comments on commit 4f1fc12

Please sign in to comment.