Skip to content

Commit

Permalink
Scripts for setting up the environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Aug 29, 2021
1 parent a9b502b commit 08f9b61
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/native_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os-type: [windows-latest]
configuration: [Debug, MinSizeRel]
configuration: [Debug, Release]

steps:
- uses: actions/checkout@v2
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/wasm_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@ jobs:
with:
node-version: 16.x
- name: Get Emscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd ${{github.workspace}}/emsdk
./emsdk.bat install latest
./emsdk.bat activate latest
./emsdk.bat install mingw-4.6.2-32bit
./emsdk.bat activate mingw-4.6.2-32bit
cd ${{github.workspace}}
run: run: ./build_setup_emscripten_win.bat
- name: Build WASM
run: ./wasm_build_win.bat ${{matrix.configuration}}
run: ./build_wasm_win.bat ${{matrix.configuration}}
- name: Update Package
if: ${{ matrix.configuration == 'Release' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
emsdk/*
emsdk
build/*
build_wasm/*
package-lock.json
Expand Down
38 changes: 8 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,50 +84,28 @@ assimpjs.then ((ajs) => {

## How to build on Windows?

A set of batch scripts are prepared for building on Windows.

### 1. Install Prerequisites

Install [CMake](https://cmake.org) (3.6 minimum version is needed). Make sure that the cmake executable is in the PATH.

### 2. Install Emscripten SDK

You can find detailed instruction on [Emscripten Download and install](https://emscripten.org/docs/getting_started/downloads.html) page. You have to use the following commands to set up the environment:
Run the Emscripten setup script.

```
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
emsdk install latest
emsdk activate latest
emsdk install mingw-4.6.2-32bit
emsdk activate mingw-4.6.2-32bit
cd ..
build_setup_emscripten_win.bat
```

### 3. Compile the WASM library

#### With a predefined script

The easiest way to build is to simply run the `wasm_build_win_release.bat` script.

```
wasm_build_win_release.bat
```

#### Manually

Set up the emscripten environment:
Run the release build script.

```
emsdk\emsdk_env.bat
build_wasm_win_release.bat
```

Generate makefile project with emcmake:
### 4. Build the native project (optional)

```
emcmake cmake -B build_wasm -G "Unix Makefiles" -DEMSCRIPTEN=1 -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_BUILD_TYPE=Release .
```

Build the project:

```
emmake mingw32-make -C build_wasm
```
If you want to debug the code, it's useful to build a native project. To do that, just use cmake to generate the project of your choice.
11 changes: 11 additions & 0 deletions build_setup_emscripten_win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pushd %~dp0

call git clone https://github.com/emscripten-core/emsdk.git
call cd emsdk
call emsdk install latest
call emsdk activate latest
call emsdk install mingw-4.6.2-32bit
call emsdk activate mingw-4.6.2-32bit
call cd ..

popd
File renamed without changes.
2 changes: 1 addition & 1 deletion wasm_build_dist.bat → build_wasm_win_dist.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pushd %~dp0

call wasm_build_win_release.bat || goto :error
call build_wasm_win_release.bat || goto :error
echo Build Succeeded.

call set TEST_CONFIG=Release
Expand Down
1 change: 1 addition & 0 deletions build_wasm_win_release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
call build_wasm_win.bat Release
1 change: 0 additions & 1 deletion wasm_build_win_release.bat

This file was deleted.

0 comments on commit 08f9b61

Please sign in to comment.