Improved compile time significantly

This commit is contained in:
2023-02-24 00:06:12 -08:00
parent bc972cbb57
commit 7b5bb990b0
9 changed files with 60 additions and 17 deletions

View File

@ -117,15 +117,15 @@ function(tool_scenecomponent clazz hfile)
)
if(NOT TARGET sceneitemcomponentgen_cmd)
add_custom_target(sceneitemcomponentgen_cmd
COMMAND sceneitemcomponentgen --input="${DAWN_TEMP_DIR}/SceneItemComponents.txt" --output="${DAWN_GENERATED_DIR}/scene/SceneItemComponentListItems.hpp"
COMMAND sceneitemcomponentgen --input="${DAWN_TEMP_DIR}/SceneItemComponents.txt" --output="${DAWN_GENERATED_DIR}/scene/SceneItemComponentListItems.cpp"
COMMENT "Generating scene item component ${hfile}::${clazz}"
DEPENDS sceneitemcomponentgen
)
target_sources(${DAWN_TARGET_NAME}
PRIVATE
${DAWN_GENERATED_DIR}/scene/SceneItemComponentListItems.cpp
)
endif()
target_include_directories(${DAWN_TARGET_NAME}
PUBLIC
${DAWN_GENERATED_DIR}
)
add_dependencies(sceneitemcomponentgen ${clazz}_scenecomponent)
add_dependencies(${DAWN_TARGET_NAME} sceneitemcomponentgen_cmd)
endfunction()

View File

@ -14,21 +14,27 @@ void SceneItemComponentRootGen::generate(
std::vector<struct SceneItemComponent> *info,
std::string tabs = ""
) {
struct ClassGenInfo clazz;
clazz.clazz = "SceneItemComponentListItems";
clazz.extend = "SceneItemComponentList";
clazz.includes.push_back("#include \"scene/SceneItemComponentList.hpp\"");
line(out, "#include \"scene/SceneItemComponentList.hpp\"", tabs);
line(out, "", tabs);
auto it = info->begin();
while(it != info->end()) {
auto c = *it;
clazz.includes.push_back("#include \"" + c.header + "\"");
line(&clazz.constructorCode, "this->append<" + c.clazz + ">();", "");
line(out, "#include \"" + c.header + "\"", tabs);
++it;
}
line(out, "", tabs);
line(out, "using namespace Dawn;", tabs);
line(out, "", tabs);
classGen(out, clazz);
line(out, "SceneItemComponentList::SceneItemComponentList() {", tabs);
it = info->begin();
while(it != info->end()) {
auto c = *it;
line(out, "this->append<" + c.clazz + ">();", tabs + " ");
++it;
}
line(out, "}", tabs);
}
std::vector<std::string> SceneItemComponentRegister::getRequiredFlags() {