-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Ultimaker/NP-76_wasm_bindings
NP-310 wasm bindings
- Loading branch information
Showing
14 changed files
with
3,669 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: NPM package | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Sync pip requirements | ||
run: curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/.github/workflows/requirements-runner.txt | ||
working-directory: .github/workflows | ||
|
||
- name: Setup Python and pip | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.x | ||
cache: pip | ||
cache-dependency-path: .github/workflows/requirements-runner.txt | ||
|
||
- name: Install Python requirements and Create default Conan profile | ||
run: pip install -r .github/workflows/requirements-runner.txt | ||
|
||
- name: Install Linux system requirements for building | ||
run: | | ||
mkdir runner_scripts | ||
cd runner_scripts | ||
curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/runner_scripts/ubuntu_setup.sh | ||
chmod +x ubuntu_setup.sh | ||
sudo ./ubuntu_setup.sh | ||
- name: Setup pipeline caches | ||
run: | | ||
mkdir -p /home/runner/.conan/downloads | ||
mkdir -p /home/runner/.conan/data | ||
- name: Create default Conan profile | ||
run: conan profile new default --detect | ||
|
||
- name: Get Conan configuration | ||
run: | | ||
conan config install https://github.com/Ultimaker/conan-config.git | ||
conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" | ||
- name: Cache Conan packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: /home/runner/.conan/data | ||
key: ${{ runner.os }}-conan-data-${{ github.run_id }} | ||
restore-keys: | | ||
${{ runner.os }}-conan-data- | ||
- name: Cache Conan downloads | ||
uses: actions/cache@v3 | ||
with: | ||
path: /home/runner/.conan/downloads | ||
key: ${{ runner.os }}-conan-downloads-${{ github.run_id }} | ||
restore-keys: | | ||
${{ runner.os }}-conan-downloads- | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ./DulcificumJS/.nvmrc | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@ultimaker' | ||
|
||
- name: NPM install and publish | ||
run: | | ||
npm run install_dulcificum | ||
npm ci | ||
npm publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: DulcificumJS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.github/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} | ||
@ultimaker:registry=https://npm.pkg.github.com | ||
always-auth=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Dulcificum JS | ||
|
||
A worker that runs Dulcificum in a browser using the Emscripten to compile for wasm | ||
|
||
## System Requirements | ||
|
||
### Windows | ||
- Python 3.11 or higher | ||
- Ninja 1.10 or higher | ||
- VS2022 or higher | ||
- CMake 3.23 or higher | ||
- nmake | ||
|
||
### MacOs | ||
- Python 3.11 or higher | ||
- Ninja 1.10 or higher | ||
- apply clang 11 or higher | ||
- CMake 3.23 or higher | ||
- make | ||
- | ||
### Linux | ||
- Python 3.11 or higher | ||
- Ninja 1.10 or higher | ||
- gcc 13 or higher | ||
- CMake 3.23 or higher | ||
- make | ||
|
||
# Installation | ||
We are using conan to manage our C++ dependencies and build configuration. If you have never used Conan read their documentation which is quite extensive and well maintained. | ||
|
||
1. Configure Conan | ||
|
||
2. Before you start, if you use conan for other (big) projects as well, it's a good idea to either switch conan-home and/or backup your existing conan configuration(s). | ||
|
||
That said, installing our config goes as follows: | ||
|
||
``` | ||
pip install conan==1.64 | ||
conan config install https://github.com/ultimaker/conan-config.git | ||
conan profile new default --detect --force | ||
``` | ||
|
||
2. Installing NodeJS deps | ||
|
||
Using Dulcificum in this project follows normal NodeJS package conventions. During an explicit user instigated pre-install step, | ||
we use Conan (installed and setup above), to build or download the wasm binaries from the JFrog Artifactory. | ||
and installing these in `src/Dulcificum/` | ||
|
||
``` | ||
npm run install_dulcificum | ||
npm install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
add_executable(dulcificum_js DulcificumJS.cpp) | ||
target_link_options(dulcificum_js | ||
PUBLIC | ||
"SHELL:-s USE_ES6_IMPORT_META=1" | ||
"SHELL:-s FORCE_FILESYSTEM=1" | ||
"SHELL:-s EXPORT_NAME=dulcificum" | ||
"SHELL:-s MODULARIZE=1" | ||
"SHELL:-s EXPORT_ES6=1" | ||
"SHELL:-s SINGLE_FILE=1" | ||
"SHELL:-s ALLOW_MEMORY_GROWTH=1" | ||
"SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=0" | ||
"SHELL:--bind" | ||
"SHELL:-l embind" | ||
"SHELL: --embind-emit-tsd dulcificum_js.d.ts" | ||
) | ||
target_link_libraries(dulcificum_js PUBLIC dulcificum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <dulcificum.h> | ||
#include <emscripten/bind.h> | ||
|
||
EMSCRIPTEN_BINDINGS(dulcificum) | ||
{ | ||
emscripten::function("gcode_2_miracle_jtp", &dulcificum::GCode2Miracle_JTP); | ||
} |
Oops, something went wrong.