Skip to content

bluelightning32/walnut-javascript

Repository files navigation

Building on Linux

emsdk must be installed before building the project.

$ git submodule update --recursive --init
$ mkdir release
$ cd release
$ emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
$ make -j4

Running the example via emrun on Linux

emrun is included in the emsdk. It starts up a web server to view the example. After building, from the build directory, run

$ emrun index.html

The blue objects in the rendered scene are generated by JSCAD. The red objects are generated by Walnut.

Building on Windows

From the Visual Studio Community Edition welcome screen, select Clone a repository. For the repository location, choose https://github.com/emscripten-core/emsdk.git.

After the repository is cloned and opened, open a terminal in the emsdk directory. One way is to right click on emsdk from the folder view and select open terminal.

Run these commands in the terminal:

.\emsdk install latest
.\emsdk activate latest

If you get a dialog box about a CMakeLists.txt file detected, click 'do not enable'.

If it fails with an error saying that python is not installed, then run python. That will launch the python installer. After python is installed, rerun the emsdk commands.

Close the emsdk folder, and switch to the walnut-javascript folder (clone it if you have not already).

Right click the CMakeLists.txt file, and select CMake settings for walnut-javascript.

Scroll up in the settings window to before the CMake variables and cache section.

Change the configuration type to Release.

Point the CMake toolchain file to the Emscripten.cmake file from your emsdk install. Specifically it is at upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake inside the emsdk install.

Save the settings with Ctrl-S. Regenerate the cache settings if it asks.

Inside the CMake variables and cache section, check show advanced variables, then set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to emcc.bat and em++.bat inside the upstream\emscripten directory within your emsdk install.

Save the settings with Ctrl-S again.

Close and reopen the CMake Settings to verify that the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER options are still set. If they are not, set them again and save again.

Select Build All. walnut.js and walnut.wasm should be generated in the out directory.

About

Adapter to call Walnut from JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published