mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Let the module registration script return a lambda that will contain all modules, thus removing the static initialization order problem
This commit is contained in:
@@ -40,7 +40,7 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
void ModuleEngine::initialize() {
|
||||
for (OpenSpaceModule* m : AllModules)
|
||||
for (OpenSpaceModule* m : AllModules())
|
||||
registerModule(std::unique_ptr<OpenSpaceModule>(m));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
@MODULE_HEADERS@
|
||||
namespace openspace {
|
||||
|
||||
std::vector<OpenSpaceModule*> AllModules = {
|
||||
@MODULE_CLASSES@};
|
||||
auto AllModules = []() -> std::vector<OpenSpaceModule*> {
|
||||
return {
|
||||
@MODULE_CLASSES@ };
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ function (handle_internal_modules)
|
||||
#"#endif\n\n"
|
||||
)
|
||||
|
||||
list(APPEND MODULE_CLASSES " new ${MODULE_NAME},\n")
|
||||
list(APPEND MODULE_CLASSES " new ${MODULE_NAME},\n")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user