-
-
Notifications
You must be signed in to change notification settings - Fork 25
Home
You need to build if you make changes to the source code in artoolkit.api.js, ARToolkitJS.cpp or any other file in the emscripten
folder. Before building the project you need to clone the repository. Follow the instructions.
- Clone this repository
- Clone ARToolKit5 project to get the latest source files. From within JSARToolKitNFT directory do
git submodule update --init
. If you already cloned ARToolKit5 to a different directory you can:
- create a link in the
jsartoolkitNFT/emscripten/
directory that points to ARToolKit5 (jsartoolkitNFT/emscripten/artoolkit5
) (Linux and macOS only) - or, set the
ARTOOLKIT5_ROOT
environment variable to point to your ARToolKit5 clone - or, change the
tools/makem.js
file to point to your ARToolKit5 clone (line 20)
NOTE:
When writing JavaScript and making changes be aware that the emscripten uglifier does not support the ES6 syntax.
- Install Docker (if you havn't already): get Docker
- Clone ARToolKit5 repository on your machine:
git submodule update --init
npm install
- From inside jsartoolkitNFT directory run
docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten-slim:latest bash
to download and start the container, in preparation for the build -
docker exec emscripten npm run build-local
to build JS version of ARToolKit5 -
docker exec emscripten npm run build-local-no-libar
to build JS version of artoolkit5 without rebuilding libar.bc -
docker stop emscripten
to stop the container after the build, if needed -
docker rm emscripten
to remove the container -
docker rmi trzeci/emscripten-slim:latest
to remove the Docker image, if you don't need it anymore - The build artifacts will appear in
/build
. There's a build with debug symbols inartoolkitNFT.debug.js
file and the optimized build with bundled JS API inartoolkitNFT.min.js
; also, a WebAssembly build artoolkitNFT_wasm.js and artoolkitNFT_wasm.wasm
To prevent issues with Emscripten setup and to not have to maintain several build environments (macOS, Windows, Linux) we only maintain the Build using Docker. Following are the instructions of the last know build on Linux which we verified are working. Use at own risk. Not working on macOS!
-
Install build tools
-
Install node.js (https://nodejs.org/en/)
-
Install python2 (https://www.python.org/downloads/)
-
Install emscripten (https://emscripten.org/docs/getting_started/downloads.html#download-and-install) We used emscripten version 1.39.5-fastcomp
1.38.44-fastcomp
JSARToolKitNFT aim is to create a Javascript version of artoolkit5. First, you need the ARToolKit5 repository on your machine:
- Clone ARToolKit5 project to get the latest source files. From within jsartoolkit5 directory do
git submodule update --init
. If you already cloned ARToolKit5 to a different directory you can:
- create a link in the
jsartoolkitNFT/emscripten/
directory that points to ARToolKit5 (jsartoolkitNFT/emscripten/artoolkit5
) - or, set the
ARTOOLKIT5_ROOT
environment variable to point to your ARToolKit5 clone - or, change the
tools/makem.js
file to point to your ARToolKit5 clone (line 20)
-
Building
-
Make sure
EMSCRIPTEN
env variable is set (e.g.EMSCRIPTEN=/usr/lib/emsdk_portable/emscripten/master/ node tools/makem.js
-
Run
npm install
-
Run
npm run build-local
During development, you can run npm run watch
, it will rebuild the library everytime you change ./js/
directory. You can also run the script with the option npm run build-local-no-libar
if you have already build libar.bc and you don't want to rebuild.
- The built ASM.js files are in
/build
. There's a build with debug symbols inartoolkitNFT.debug.js
and the optimized build with bundled JS API inartoolkitNFT.min.js
.