Godot Version
Latest github pull
Question
Hello,
I was trying to port a custom FFT library, couldn’t get it to register with scons when running the build (already have successful builds running for Godot, so doesn’t seem to be the issue there)
I then paired it back to the basic example found at here
register_types.h
#include "modules/register_module_types.h"
void initialize_testing_module(ModuleInitializationLevel p_level);
void uninitialize_testing_module(ModuleInitializationLevel p_level);
register_types.cpp
#include "register_types.h"
#include "testing.h"
#include "core/object/class_db.h"
void initialize_testing_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
ClassDB::register_class<Testing>();
}
void uninitialize_testing_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
// Nothing to do here in this example.
}
testing.h
#pragma once
#include "core/object/ref_counted.h"
class Testing : Public RefCounted {
GDCLASS(Testing, RefCounted);
int count;
protected:
static void _bind_methods();
public:
void add(int p_value);
void reset();
int get_total() const;
Testing();
}
testing.cpp
#include "testing.h"
void Testing::add(int p_value) {
count += p_value;
}
void Testing::reset() {
count = 0;
}
int Testing::get_total() const {
return count;
}
void Testing::_bind_methods() {
ClassDB::bind_method(D_METHOD("add", "value"), &Testing::add);
ClassDB::bind_method(D_METHOD("reset"), &Testing::reset);
ClassDB::bind_method(D_METHOD("get_total"), &Testing::get_total);
}
Testing::Testing() {
count = 0;
}
SCSub
# SCsub
Import('env')
env.add_source_files(env.modules_sources, "*.cpp") # Add all cpp files to the build
config.py
# config.py
def can_build(env, platform):
return True
def configure(env):
pass
Am I missing something? Did using the name Testing alias something existing? I tried an alternate name and no avail there either.
Running scons inside the godot cloned root, with my added folders in godot/modules/mymodulename (Matching whatever the class registration is)
New to working with Godot, but not C++, although I’m unfamiliar with scons. When I logged a full clean build after deleting the bin and .dblite they never show up in the output for either my custom FFT module or the simple testing module folder.