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:
Alexander Bock
2016-07-31 19:25:15 +02:00
parent e39a7983aa
commit 393f39de2e
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ namespace {
namespace openspace {
void ModuleEngine::initialize() {
for (OpenSpaceModule* m : AllModules)
for (OpenSpaceModule* m : AllModules())
registerModule(std::unique_ptr<OpenSpaceModule>(m));
}
+4 -2
View File
@@ -8,8 +8,10 @@
@MODULE_HEADERS@
namespace openspace {
std::vector<OpenSpaceModule*> AllModules = {
@MODULE_CLASSES@};
auto AllModules = []() -> std::vector<OpenSpaceModule*> {
return {
@MODULE_CLASSES@ };
};
} // namespace openspace
+1 -1
View File
@@ -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 ()