Begin plugin api
This commit is contained in:
@@ -2,6 +2,4 @@ let project = new Project('plugins');
|
||||
|
||||
project.addFile('sources/**');
|
||||
|
||||
project.addDefine('WITH_PLUGIN_EMBED');
|
||||
|
||||
return project;
|
||||
|
||||
@@ -2,8 +2,6 @@ let project = new Project('plugins');
|
||||
|
||||
project.addFile('sources/**');
|
||||
|
||||
project.addDefine('WITH_PLUGIN_EMBED');
|
||||
|
||||
if (platform === Platform.Windows) {
|
||||
project.addLib('sources/proc_texsynth/win32/texsynth');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ let project = new Project('plugins');
|
||||
|
||||
// project.addFile('sources/**'); ////
|
||||
|
||||
project.addDefine('WITH_PLUGIN_EMBED');
|
||||
project.addDefine('TINYUSDZ_NO_STB_IMAGE_IMPLEMENTATION');
|
||||
|
||||
project.flatten();
|
||||
|
||||
@@ -2,6 +2,4 @@ let project = new Project('plugins');
|
||||
|
||||
project.addFile('sources/**');
|
||||
|
||||
project.addDefine('WITH_PLUGIN_EMBED');
|
||||
|
||||
return project;
|
||||
|
||||
@@ -54,6 +54,8 @@ let project = new Project("Base");
|
||||
}
|
||||
}
|
||||
|
||||
project.addDefine('WITH_PLUGINS');
|
||||
project.addFile("sources/plugin_api.c");
|
||||
project.addProject("../" + dir + "/plugins");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
#include "quickjs/quickjs.h"
|
||||
|
||||
extern JSRuntime *js_runtime;
|
||||
extern JSContext *js_ctx;
|
||||
|
||||
void console_log(char *s);
|
||||
|
||||
static JSValue js_console_log(JSContext *ctx, JSValue this_val, int argc, JSValue *argv) {
|
||||
console_log(JS_ToCString(ctx, argv[0]));
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
void plugin_api_init() {
|
||||
JSValue global_obj = JS_GetGlobalObject(js_ctx);
|
||||
JS_SetPropertyStr(js_ctx, global_obj, "console_log", JS_NewCFunction(js_ctx, js_console_log, "console_log", 1));
|
||||
JS_FreeValue(js_ctx, global_obj);
|
||||
}
|
||||
Reference in New Issue
Block a user