[nostalgia] Split part of Core out into Foundation, add module system
This commit is contained in:
20
src/nostalgia/appmodules/CMakeLists.txt
Normal file
20
src/nostalgia/appmodules/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
add_library(
|
||||
NostalgiaAppModules OBJECT
|
||||
appmodules.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(NostalgiaAppModules PRIVATE -Wsign-conversion)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
NostalgiaAppModules PUBLIC
|
||||
NostalgiaCore
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
appmodules.hpp
|
||||
DESTINATION
|
||||
include/nostalgia/appmodules
|
||||
)
|
27
src/nostalgia/appmodules/appmodules.cpp
Normal file
27
src/nostalgia/appmodules/appmodules.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/array.hpp>
|
||||
|
||||
#include <nostalgia/foundation/module.hpp>
|
||||
|
||||
#include <nostalgia/core/module.hpp>
|
||||
|
||||
namespace nostalgia {
|
||||
|
||||
void loadModules() noexcept {
|
||||
static bool done = false;
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
const ox::Array<foundation::Module*, 1> mods = {
|
||||
&core::CoreModule::mod,
|
||||
};
|
||||
for (const auto m : mods) {
|
||||
foundation::registerModule(m);
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
|
||||
}
|
11
src/nostalgia/appmodules/appmodules.hpp
Normal file
11
src/nostalgia/appmodules/appmodules.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace nostalgia {
|
||||
|
||||
void loadModules() noexcept;
|
||||
|
||||
}
|
Reference in New Issue
Block a user