Javascript bindings (#14)

* Initial version ready

- bindings are in `bindings/emscripten.cpp`
- minimal Javascript example is in `examples/ggwave-js`

* add npm package + add test-ggwave.js

* js : rename export name to "ggwave_factory"

* update to v0.1.5

* Update README.md

* npm : add npm-publish target
This commit is contained in:
Georgi Gerganov
2021-01-24 17:25:58 +02:00
committed by GitHub
parent 105e0fd48d
commit 19f353018d
19 changed files with 485 additions and 57 deletions

View File

@@ -0,0 +1,24 @@
set(TARGET libggwave)
add_executable(${TARGET}
emscripten.cpp
)
target_link_libraries(${TARGET} PRIVATE
ggwave
)
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
--bind \
-s MODULARIZE=1 \
-s SINGLE_FILE=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORT_NAME=\"'ggwave_factory'\" \
")
add_custom_command(
TARGET libggwave POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/bin/libggwave.js
${CMAKE_CURRENT_SOURCE_DIR}/ggwave.js
)