Scaffold base build files for dual mode
This commit is contained in:
50
.gitignore
vendored
50
.gitignore
vendored
@@ -1,2 +1,48 @@
|
||||
.venv
|
||||
.idea
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# SCons
|
||||
.sconsign.dblite
|
||||
.sconf_temp/
|
||||
*.sconsign
|
||||
|
||||
# IDEs
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Godot-specific
|
||||
bin/
|
||||
gen/
|
||||
godot-cpp/
|
||||
demo/bin/
|
||||
demo/.godot/
|
||||
.venv/
|
||||
|
||||
@@ -19,6 +19,8 @@ env = SConscript("godot-cpp/SConstruct")
|
||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||
env.Append(CPPPATH=["src/"])
|
||||
|
||||
# Context-specific define for GDExtension
|
||||
env.Append(CPPDEFINES=["GD_EXTENSION_BUILD"])
|
||||
env.Append(CPPDEFINES=[f"{constant_prefix}_GDEXTENSION"])
|
||||
sources = Glob("src/*.cpp")
|
||||
|
||||
|
||||
16
SCsub
Normal file
16
SCsub
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
|
||||
Import("env")
|
||||
|
||||
# Define the context constant for module build
|
||||
env.Append(CPPDEFINES=["GODOT_MODULE_BUILD"])
|
||||
|
||||
# Sources to include in the module
|
||||
module_sources = Glob("src/*.cpp")
|
||||
module_sources += Glob("*.cpp")
|
||||
|
||||
env.add_source_files(env.modules_sources, module_sources)
|
||||
|
||||
# Include paths for the module
|
||||
env.Append(CPPPATH=[Dir("."), Dir("src")])
|
||||
@@ -1,5 +1,46 @@
|
||||
//
|
||||
// Created by andrew on 3/17/26.
|
||||
//
|
||||
#include "register_types.h"
|
||||
|
||||
#include "register_types.h"
|
||||
#ifdef GD_EXTENSION_BUILD
|
||||
#include <gdextension_interface.h>
|
||||
#include <godot_cpp/core/defs.hpp>
|
||||
#include <godot_cpp/godot.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
void initialize_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register classes here
|
||||
}
|
||||
|
||||
void uninitialize_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
// Initialization.
|
||||
GDExtensionBool GDE_EXPORT extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||
|
||||
init_obj.register_initializer(initialize_module);
|
||||
init_obj.register_terminator(uninitialize_module);
|
||||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||
|
||||
return init_obj.init();
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(GODOT_MODULE_BUILD)
|
||||
#include "register_types.h"
|
||||
|
||||
void register_types() {
|
||||
// Register classes here
|
||||
}
|
||||
|
||||
void unregister_types() {
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
//
|
||||
// Created by andrew on 3/17/26.
|
||||
//
|
||||
#ifndef REGISTER_TYPES_H
|
||||
#define REGISTER_TYPES_H
|
||||
|
||||
#ifndef DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
#define DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
#ifdef GD_EXTENSION_BUILD
|
||||
#include <godot_cpp/core/class_db.hpp>
|
||||
using namespace godot;
|
||||
#elif defined(GODOT_MODULE_BUILD)
|
||||
#include "core/object/class_db.h"
|
||||
#endif
|
||||
|
||||
#ifdef
|
||||
void register_types();
|
||||
void unregister_types();
|
||||
|
||||
#endif //DUAL_GDEXTENSION_MODULE_TEMPLATE_REGISTER_TYPES_H
|
||||
#endif // REGISTER_TYPES_H
|
||||
|
||||
Reference in New Issue
Block a user