-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix warnings * Module agnostic defines GODOT_MODULE define determines how Godot sources are included All Godot sources should be included in defs.h REGISTRATION_METHOD defines the method name used to register methods and properties Method registration must be defined twice based on GODOT_MODULE NS define used for godot namespace required by anonymous namespaces when compiling as addon Define godot_error as alias of Error for module Errors used for Godot 3.x addon are defined (enables max compatibility with module and Godot 4) Godot library source file (addon specific) skipped if GODOT_MODULE present StreamPeer superclass defined depending on context StreamPeerGDNative interface defined for addon (likely to be ugliest part of module agnosticism) * Generalize signature array creation * Stream peer getter * Basic module scaffolding * Update readme * GNU++14 compiler support * Exclude godot library file for module
- Loading branch information
1 parent
c18b7d9
commit 1642e7d
Showing
13 changed files
with
222 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ addons.zip | |
*.so | ||
*.dylib | ||
*.dll | ||
*.o | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Import env and create module-specific clone | ||
Import('env') | ||
module_env = env.Clone() | ||
|
||
# Check platform specifics | ||
if env['platform']=='linuxbsd': | ||
module_env['LIBSUFFIX'] = '.a' | ||
module_env.Append(CXXFLAGS=['-std=c++17']) | ||
elif env['platform']=='osx': | ||
module_env['LIBSUFFIX'] = '.a' | ||
module_env.Append(CXXFLAGS=['-std=c++17']) | ||
env.Append(LINKFLAGS=['-framework', 'Security']) | ||
elif env['platform']=='windows': | ||
module_env['LIBSUFFIX'] = '.lib' | ||
|
||
# Explicit static libraries | ||
wasmer_library = env.File('{}wasmer{}'.format(env['LIBPREFIX'], module_env.get('LIBWASMERSUFFIX', module_env['LIBSUFFIX']))) | ||
|
||
# Linked libraries (global env) and includes (cloned env) | ||
env.Append(LIBPATH=[env.Dir('wasmer/lib').abspath]) | ||
env.Append(LIBS=[wasmer_library]) | ||
module_env.Append(CPPPATH=['wasmer/include']) | ||
|
||
# Defines for module agnosticism | ||
module_env.Append(CPPDEFINES=["GODOT_MODULE"]) | ||
|
||
# Module sources | ||
module_env.add_source_files(env.modules_sources, ['register_types.cpp', env.Glob('src/*.cpp', exclude='src/godot-library.cpp')]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def can_build(env, platform): | ||
return True | ||
|
||
def configure(env): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifdef GODOT_MODULE | ||
|
||
#include "register_types.h" | ||
|
||
#include "core/class_db.h" | ||
#include "src/godot-wasm.h" | ||
#include "src/stream-peer-wasm.h" | ||
|
||
void register_wasm_types() { | ||
ClassDB::register_class<godot::Wasm>(); | ||
ClassDB::register_class<godot::StreamPeerWasm>(); | ||
} | ||
|
||
void unregister_wasm_types() { } | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
void register_wasm_types(); | ||
void unregister_wasm_types(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.