Not-quite-working WASM
This commit is contained in:
parent
91bfff1a35
commit
e40a743dac
@ -5,5 +5,14 @@ set(SRC
|
|||||||
skinny_reference.c
|
skinny_reference.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(romulus-m SHARED ${SRC})
|
if(EMSCRIPTEN)
|
||||||
install(TARGETS romulus-m)
|
# WASM requires an executable, so we use a dummy target that doesn't do anything
|
||||||
|
# and link our library into it.
|
||||||
|
add_library(romulus-m STATIC ${SRC})
|
||||||
|
add_executable(romulus-m-wasm "main.c")
|
||||||
|
target_link_libraries(romulus-m-wasm PRIVATE romulus-m)
|
||||||
|
target_link_options(romulus-m-wasm PRIVATE -s EXPORTED_FUNCTIONS=['_main', '_crypto_aead_encrypt', '_crypto_aead_decrypt'])
|
||||||
|
else()
|
||||||
|
add_library(romulus-m SHARED ${SRC})
|
||||||
|
install(TARGETS romulus-m)
|
||||||
|
endif()
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define EXPORT __declspec(dllexport)
|
#define EXPORT __declspec(dllexport)
|
||||||
#else
|
#elif __linux__
|
||||||
#define EXPORT __attribute__((visibility("default")))
|
#define EXPORT __attribute__((visibility("default")))
|
||||||
|
#elif __EMSCRIPTEN__
|
||||||
|
#include <emscripten.h>
|
||||||
|
#define EXPORT EMSCRIPTEN_KEEPALIVE
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user