parent
108fe84e7e
commit
f2fe271198
7 changed files with 78 additions and 6 deletions
@ -0,0 +1,13 @@ |
||||
## Add support for `find_library` in Emscripten |
||||
|
||||
The `find_library` method can be used to find your own JavaScript |
||||
libraries. The limitation is that they must have the file extension |
||||
`.js`. Other library lookups will look up "native" libraries from the |
||||
system like currently. A typical usage would look like this: |
||||
|
||||
```meson |
||||
glue_lib = cc.find_library('gluefuncs.js', |
||||
dirs: meson.current_source_dir()) |
||||
executable('prog', 'prog.c', |
||||
dependencies: glue_lib) |
||||
``` |
@ -0,0 +1,8 @@ |
||||
project('jslib', 'c') |
||||
|
||||
cc = meson.get_compiler('c') |
||||
|
||||
sf_dep = cc.find_library('somefuncs.js', dirs: meson.current_source_dir()) |
||||
|
||||
executable('libcallc', 'prog.c', |
||||
dependencies: sf_dep) |
@ -0,0 +1,10 @@ |
||||
#include <stdio.h> |
||||
#include <emscripten.h> |
||||
|
||||
extern void sample_function(); |
||||
|
||||
int main() { |
||||
printf("Hello World\n"); |
||||
// sampleFunction(); ????
|
||||
return 0; |
||||
} |
@ -0,0 +1,6 @@ |
||||
mergeInto(LibraryManager.library, { |
||||
sample_function__sig: 'v', |
||||
sample_function: function() { |
||||
alert("Something happened!"); |
||||
}, |
||||
}); |
Loading…
Reference in new issue