Skip to content

A free and open-source implementation of the Astron client protocol for C++ applications targeting Web Assembly.

License

Notifications You must be signed in to change notification settings

maxrdz/astron.libwasm

astron.libwasm

An open-source implementation of the Astron client protocol for C++ applications targeting Web Assembly.

This implementation will only be targeting Web Assembly, as it is portable to any operating system and any architecture that is supported by a Javascript engine. (Chrome v8, NodeJS)

For the internal (server-side) implementation of Astron, check out astron.libts.

Building from Source

The following instructions assume that you're using a Linux based or Unix-like Operating System.

Before compiling the source code, you first need to generate the Makefile using CMake. NOTE: You need to run emcmake to run cmake so that it sets the various environment variables that are needed for CMake to generate for the em++ compiler.

It is required that you have the Emscripten SDK installed in your system and added to your PATH in order to use the tools from the emsdk.

On Linux: To configure & build for release, run the following commands:

$ emcmake cmake . -Bbuild-release -DCMAKE_BUILD_TYPE=Release
$ cd build-release && make

CMake generates a Makefile by default. If you would like to use Ninja as your generator, use the following shell command instead.

$ emcmake cmake . -GNinja -Bbuild-release -DCMAKE_BUILD_TYPE=Release
$ cd build-release && ninja

astron.libwasm is always compiled as a static library, not Web Assembly. It is compiled with Emscripten so that your own application can be linked with this static library and target Web Assembly.

Using Panda3D (webgl-port) in examples

I've built in the option to compile the example programs with the WebGL port of Panda3D. This port of Panda can be viewed under the webgl-port branch of the Panda3D git repository. Link to the webgl-port branch.

This port of Panda targets Web Assembly. Due to its restrictions on the browser, and current specification, Panda has to be built into static libraries. It is then statically linked to the example program(s). You can view the CMakeLists.txt file and how it links with Panda.

Once you have the static libraries built, copy the .a (or .lib) files over to the example/ directory of this repository. Use the -DUSE_PANDA=1 flag when compiling the examples. Read the CMakeLists.txt file for specific instructions on where to move the generated Panda headers.

For instructions on building Panda3D for WebGL with Emscripten, see the building instructions written by rdb.

Feel free to also check out my detailed build guide at the Panda3D discourse.

Troubleshooting

When using astron.libwasm, all output is flushed to the JavaScript console. In most browsers, pressing the F12 key should open this console.

For astron.libwasm developers, it is recommended that you compile with -DCMAKE_BUILD_TYPE=Debug as this disables all compiler / linker optimizations and compiles with Clang's undefined behavior & address sanitizers (UBSan & ASan) for catching bugs faster. There is a considerable performance and size penalty to doing this; expect a larger static library!

Contributing

Before writing your first contribution, please make sure to read the contributing guidelines.

For astron.libwasm developers: To regenerate the parser / lexer in src/file, please use the bash script lexparse.sh inside the directory.

Reporting Vulnerabilities

Please read the security policy document for more information on reporting software vulnerabilities.

About

A free and open-source implementation of the Astron client protocol for C++ applications targeting Web Assembly.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published