From 5584a9674a92b848b931684dea8cf9fb17f7cb5c Mon Sep 17 00:00:00 2001 From: Robear Selwans Date: Fri, 21 May 2021 17:39:11 +0200 Subject: [PATCH] Initial commit --- README.md | 1 + meson.build | 32 ++++++++++++++++++++++++++++++++ meson_options.txt | 1 + meta/evmod.configvars | 2 ++ meta/evmod.events | 3 +++ meta/evmod.namespaces | 5 +++++ meta/evmod.types | 2 ++ module.lua | 6 ++++++ src/template.c | 43 +++++++++++++++++++++++++++++++++++++++++++ subprojects/evol.wrap | 7 +++++++ 10 files changed, 102 insertions(+) create mode 100644 README.md create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 meta/evmod.configvars create mode 100644 meta/evmod.events create mode 100644 meta/evmod.namespaces create mode 100644 meta/evmod.types create mode 100644 module.lua create mode 100644 src/template.c create mode 100644 subprojects/evol.wrap diff --git a/README.md b/README.md new file mode 100644 index 0000000..61ec95a --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# evolmod-template diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..492bf8b --- /dev/null +++ b/meson.build @@ -0,0 +1,32 @@ +project('template', 'c', +version : '0.1', +default_options : ['warning_level=3', 'c_std=c11']) + +src = subproject('evol').get_variable('evolmod_subdir') + '/meson.build' +dst = meson.current_source_dir() + '/import/' +run_command( 'python3', meson.source_root() + '/subprojects/evol/buildscripts/copy.py', src, dst) +subdir('import') + +mod_src = [ + 'src/template.c', +] + +mod_incdir = [ + '..', +] + +mod_deps = [ + evmod_deps, +] + +module = shared_module( + 'template', mod_src, + include_directories: mod_incdir, + dependencies: mod_deps, +) + +mod_dep = declare_dependency( + include_directories: mod_incdir, +) + +meson.override_dependency('evmod_template', mod_dep) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..21c171e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('moduleconfig', type: 'string', value: 'module.lua') diff --git a/meta/evmod.configvars b/meta/evmod.configvars new file mode 100644 index 0000000..c2ed9d8 --- /dev/null +++ b/meta/evmod.configvars @@ -0,0 +1,2 @@ +EV_CONFIG_VAR(template_var1, I32, 0) +EV_CONFIG_VAR(template_var2, SDS, "Default") diff --git a/meta/evmod.events b/meta/evmod.events new file mode 100644 index 0000000..83fb2f2 --- /dev/null +++ b/meta/evmod.events @@ -0,0 +1,3 @@ +PRIMARY(PrimaryEvent, { U32 dummy_primary; }) + +SECONDARY(PrimaryEvent, SecondaryEvent, { U32 dummy_secondary; }) diff --git a/meta/evmod.namespaces b/meta/evmod.namespaces new file mode 100644 index 0000000..9453ebd --- /dev/null +++ b/meta/evmod.namespaces @@ -0,0 +1,5 @@ +EV_NS_DEF_BEGIN(Namespace1) + +EV_NS_DEF_FN(U32, update, (F32, deltaTime)) + +EV_NS_DEF_END(Namespace1) \ No newline at end of file diff --git a/meta/evmod.types b/meta/evmod.types new file mode 100644 index 0000000..8ae62e8 --- /dev/null +++ b/meta/evmod.types @@ -0,0 +1,2 @@ +TYPE(TypeA, { I32 member1, F32 member2; }) +TYPE(TypeB, { PTR memberX, STR memberY; }) diff --git a/module.lua b/module.lua new file mode 100644 index 0000000..1f714bd --- /dev/null +++ b/module.lua @@ -0,0 +1,6 @@ +{ + name = "Template", + version = "0.1", + categories = {"Category1", "Category2"}, + dependencies = {"Dependency1", "Dependency2"} +} diff --git a/src/template.c b/src/template.c new file mode 100644 index 0000000..aaad5c9 --- /dev/null +++ b/src/template.c @@ -0,0 +1,43 @@ +#define EV_MODULE_DEFINE +#include + +#include + +EV_CONSTRUCTOR +{ + printf("Loaded template module\n"); +} + +U32 +update( + F32 deltaTime) +{ + EV_UNUSED_PARAM(deltaTime); + return 0; +} + +EV_DESTRUCTOR +{ + printf("Unloaded template module\n"); +} + +EVMODAPI bool +export_and( + bool x, + bool y) +{ + return x & y; +} + +EVMODAPI bool +export_or( + bool x, + bool y) +{ + return x | y; +} + +EV_BINDINGS +{ + EV_NS_BIND_FN(Namespace1, update, update); +} diff --git a/subprojects/evol.wrap b/subprojects/evol.wrap new file mode 100644 index 0000000..7051735 --- /dev/null +++ b/subprojects/evol.wrap @@ -0,0 +1,7 @@ +[wrap-git] +directory = evol +url = https://github.com/evol3d/evol +revision = master + +[provide] +dependency_names = evol