Skip to content

Commit

Permalink
Merge pull request #30 from BayernMuller/chore/create-bindings-dir
Browse files Browse the repository at this point in the history
chore/create-bindings-directory
  • Loading branch information
BayernMuller authored Dec 19, 2024
2 parents 727d668 + 6c30e0b commit 9497731
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/wasm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
wasm-build:
Expand All @@ -33,7 +34,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: wasm/Dockerfile
file: bindings/wasm/Dockerfile
tags: vibra-wasm:latest
push: false
load: true
Expand All @@ -47,12 +48,12 @@ jobs:
- name: Run Docker container for WASM build
run: |
docker run --rm -v $(pwd):/app vibra-wasm:latest bash -c "cd wasm && ./build-wasm.sh"
docker run --rm -v $(pwd):/app vibra-wasm:latest bash -c "cd bindings/wasm && ./build-wasm.sh"
- name: Upload WASM artifacts
uses: actions/upload-artifact@v3
with:
name: wasm-build
path: |
wasm/build/vibra.wasm
wasm/build/vibra.js
bindings/wasm/build/vibra.wasm
bindings/wasm/build/vibra.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<th>Build Status</th>
</tr>
<tr>
<td><a href="wasm/README.md">WebAssembly</a></td>
<td><a href="bindings/wasm/README.md">WebAssembly</a></td>
<td>-</td>
<td><img src="https://github.com/bayernmuller/vibra/actions/workflows/wasm-build.yaml/badge.svg"/></td>
</tr>
Expand All @@ -77,7 +77,7 @@
</table>

### Building the WebAssembly Version
* Please refer to **[wasm/README.md](wasm/README.md)** for instructions on building and running the WebAssembly version of vibra.
* Please refer to **[bindings/wasm/README.md](bindings/wasm/README.md)** for instructions on building and running the WebAssembly version of vibra.

### Building the Native Version

Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions wasm/README.md → bindings/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ Follow these steps to build the WebAssembly version of Vibra:

4. Build the Docker image:
```bash
docker build -f wasm/Dockerfile -t vibra-wasm .
docker build -f bindings/wasm/Dockerfile -t vibra-wasm .
```

5. Run the Docker container to compile the WebAssembly files:
```bash
docker run --rm -v $(pwd):/app vibra-wasm bash -c "cd wasm && ./build-wasm.sh"
docker run --rm -v $(pwd):/app vibra-wasm bash -c "cd bindings/wasm && ./build-wasm.sh"
```

6. After compilation, you'll find the following files in the `wasm/build` directory:
```bash
$ ls -l wasm/build
$ ls -l bindings/wasm/build
.rw-r--r-- jayden staff 88 KB Wed Sep 11 23:07:52 2024 vibra.js
.rwxr-xr-x jayden staff 804 KB Wed Sep 11 23:07:52 2024 vibra.wasm
```

##### If you can't build the WebAssembly version, you can download `vibra.wasm` and `vibra.js` from GitHub workflow artifacts.
* https://github.com/BayernMuller/vibra/actions/workflows/wasm-build.yaml
* Please download `vibra.wasm` and `vibra.js` from the latest successful run.
* and put them in the `vibra/wasm/build` directory to run the demo Node.js app.
* and put them in the `vibra/bindings/wasm/build` directory to run the demo Node.js app.

### 2. Running the Demo Node.js App "vibrajs"

To run the demo Node.js application:

1. Install dependencies and build the CLI app:
```bash
cd wasm
cd bindings/wasm
npm install
npm run build
npm link
Expand Down
2 changes: 1 addition & 1 deletion wasm/build-wasm.sh → bindings/wasm/build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -rf build
mkdir -p build
cd build || exit 1

emcmake cmake .. \
emcmake cmake ../.. \
-DLIBRARY_ONLY=ON \
-DFFTW3_PATH=/usr/local \
-DCMAKE_INSTALL_PREFIX=/usr/local
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9497731

Please sign in to comment.