2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Huge compile performance refactor

This commit is contained in:
Jack Andersen
2017-12-28 21:56:31 -10:00
parent bc055b9126
commit aae0dc56b7
53 changed files with 1523 additions and 1729 deletions

View File

@@ -5,11 +5,7 @@ add_executable(hecl main.cpp
ToolExtract.hpp
ToolInit.hpp
ToolHelp.hpp
ToolGroup.hpp
ToolCook.hpp
ToolClean.hpp
ToolAdd.hpp
ToolRemove.hpp
ToolSpec.hpp
../DataSpecRegistry.hpp)
if(COMMAND add_sanitizers)
@@ -30,4 +26,8 @@ target_link_libraries(hecl
hecl-common hecl-blender-addon athena-core nod
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS})
if(COMMAND cotire)
cotire(hecl)
endif()
endif()

View File

@@ -1,60 +0,0 @@
#ifndef CTOOL_ADD
#define CTOOL_ADD
#include "ToolBase.hpp"
#include <stdio.h>
class ToolAdd final : public ToolBase
{
public:
ToolAdd(const ToolPassInfo& info)
: ToolBase(info)
{
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.beginWrap();
help.wrap(_S("hecl-add - Add working files to the HECL index\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl add [<pathspec>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command stages a file or glob-pattern of files within the project database ")
_S("for inclusion in the "));
help.wrapBold(_S("hecl cook"));
help.wrap(_S(" process.\n\n")
_S("Files added in this manner automatically become 'explicit' database ")
_S("objects. 'Explicit objects' will not be removed in housekeeping tasks automatically ")
_S("performed by HECL's library functions, unless the user (re)moves the file ")
_S("using the filesystem.\n\n")
_S("For details on explicit vs. implicit objects, view the "));
help.wrapBold(_S("hecl cook"));
help.wrap(_S(" documentation.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<pathspec>..."), _S("input file(s)"));
help.beginWrap();
help.wrap(_S("Working file(s) containing production data to be cooked by HECL. ")
_S("Glob-strings may be specified (e.g. "));
help.wrapBold(_S("*.blend"));
help.wrap(_S(") to automatically add all matching files to the database.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("add");}
int run()
{
return 0;
}
};
#endif // CTOOL_ADD

View File

@@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#ifndef _WIN32
#include <unistd.h>

View File

@@ -1,70 +0,0 @@
#ifndef CTOOL_CLEAN
#define CTOOL_CLEAN
#include "ToolBase.hpp"
#include <stdio.h>
class ToolClean final : public ToolBase
{
public:
ToolClean(const ToolPassInfo& info)
: ToolBase(info)
{
}
~ToolClean()
{
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.beginWrap();
help.wrap(_S("hecl-clean - Delete cached cooked objects referenced via working files\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl clean [-ri] [<pathspec>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command performs an immediate deletion of cooked objects cached ")
_S("within the project database. It may operate on a subset of objects or the ")
_S("entire project.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<pathspec>..."), _S("clean path(s)"));
help.beginWrap();
help.wrap(_S("When one or more paths are specified in the command, the clean process will ")
_S("restrict object deletion to only the working file(s) specified. If "));
help.wrapBold(_S("-r"));
help.wrap(_S(" is also specifed, directories may be provided as well. If no path(s) specified, ")
_S("the entire project is cleaned.\n"));
help.endWrap();
help.optionHead(_S("-r"), _S("recursion"));
help.beginWrap();
help.wrap(_S("Enables recursive file-matching for cleaning entire directories of working files.\n"));
help.endWrap();
help.optionHead(_S("-i"), _S("follow implicit links"));
help.beginWrap();
help.wrap(_S("Enables implicit object traversal and cleaning. This is only useful if one or more paths ")
_S("are specified. For objects supporting implicit-gathering, this will query those ")
_S("objects for their current implicit links and ensure the linked-objects are cleaned ")
_S("as well.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("clean");}
int run()
{
return 0;
}
};
#endif // CTOOL_CLEAN

View File

@@ -2,7 +2,7 @@
#define CTOOL_COOK
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
#include "hecl/ClientProcess.hpp"
class ToolCook final : public ToolBase

View File

@@ -2,7 +2,7 @@
#define CTOOL_EXTRACT
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
#if _WIN32
#include <conio.h>

View File

@@ -1,69 +0,0 @@
#ifndef CTOOL_GROUP
#define CTOOL_GROUP
#include "ToolBase.hpp"
#include <stdio.h>
class ToolGroup final : public ToolBase
{
public:
ToolGroup(const ToolPassInfo& info)
: ToolBase(info)
{
if (!info.project)
LogModule.report(logvisor::Fatal, "hecl group must be ran within a project directory");
}
~ToolGroup()
{
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.beginWrap();
help.wrap(_S("hecl-group - Fork a project directory as an explicit group\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl group [-D] <dir>\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command turns a nested subdirectory of the project into a HECL group. ")
_S("Groups play an important role in the resulting structure of the packaged ")
_S("database. All objects in HECL belong to a group of some sort since the runtime ")
_S("only provides loading functions for groups. Ungrouped ")
_S("objects in the project root are individually added to 'loose groups'.\n\n With "));
help.wrapBold(_S("hecl group"));
help.wrap(_S(", explicit groups may be defined (e.g. a stage, level, area, loadable segment). "));
help.wrap(_S("Groups are defined by filesystem directories relative to the project root ")
_S("and may be loaded within the runtime using the relative path as a lookup-string. ")
_S("Sub-directories that aren't explicitly made into a group inherit the group-status ")
_S("of the parent directory.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<dir>"), _S("group directory path"));
help.beginWrap();
help.wrap(_S("Directory to fork as an explicit group\n"));
help.endWrap();
help.optionHead(_S("-D"), _S("delete group"));
help.beginWrap();
help.wrap(_S("Remove's directory's status as an explicit group; restoring its inheritance ")
_S("from the parent directory.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("group");}
int run()
{
return 0;
}
};
#endif // CTOOL_GROUP

View File

@@ -2,7 +2,7 @@
#define CTOOL_HELP
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
#include <functional>
class ToolHelp final : public ToolBase
@@ -66,16 +66,8 @@ public:
helpFunc = ToolSpec::Help;
else if (toolName == _S("extract"))
helpFunc = ToolExtract::Help;
else if (toolName == _S("add"))
helpFunc = ToolAdd::Help;
else if (toolName == _S("remove") || toolName == _S("rm"))
helpFunc = ToolRemove::Help;
else if (toolName == _S("group"))
helpFunc = ToolGroup::Help;
else if (toolName == _S("cook"))
helpFunc = ToolCook::Help;
else if (toolName == _S("clean"))
helpFunc = ToolClean::Help;
else if (toolName == _S("package") || toolName == _S("pack"))
helpFunc = ToolPackage::Help;
else if (toolName == _S("help"))

View File

@@ -2,7 +2,7 @@
#define CTOOL_INIT
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
class ToolInit final : public ToolBase
{

View File

@@ -4,7 +4,7 @@
#include <vector>
#include <string>
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
class ToolPackage final : public ToolBase
{

View File

@@ -1,62 +0,0 @@
#ifndef CTOOL_REMOVE
#define CTOOL_REMOVE
#include "ToolBase.hpp"
#include <stdio.h>
class ToolRemove final : public ToolBase
{
public:
ToolRemove(const ToolPassInfo& info)
: ToolBase(info)
{
}
~ToolRemove()
{
}
static void Help(HelpOutput& help)
{
help.secHead(_S("NAME"));
help.beginWrap();
help.wrap(_S("hecl-rm\n"));
help.wrap(_S("hecl-remove - Remove working files from the HECL index\n"));
help.endWrap();
help.secHead(_S("SYNOPSIS"));
help.beginWrap();
help.wrap(_S("hecl remove [-r] [<pathspec>...]\n"));
help.endWrap();
help.secHead(_S("DESCRIPTION"));
help.beginWrap();
help.wrap(_S("This command removes a file, directory, or glob-pattern of files from the project database. ")
_S("Once a file is removed, any cooked cache objects are deleted automatically. "));
help.wrapBold(_S("The working file itself is not deleted from the filesystem.\n"));
help.endWrap();
help.secHead(_S("OPTIONS"));
help.optionHead(_S("<pathspec>..."), _S("input file(s)"));
help.beginWrap();
help.wrap(_S("Working file(s) to be removed from the project database. ")
_S("Glob-strings may be specified (e.g. "));
help.wrapBold(_S("*.blend"));
help.wrap(_S(") to automatically remove all matching files from the database.\n"));
help.endWrap();
help.optionHead(_S("-r"), _S("recursion"));
help.beginWrap();
help.wrap(_S("Enables recursive file-matching for removing entire directories of working files.\n"));
help.endWrap();
}
hecl::SystemString toolName() const {return _S("remove");}
int run()
{
return 0;
}
};
#endif // CTOOL_REMOVE

View File

@@ -2,7 +2,7 @@
#define CTOOL_SPEC
#include "ToolBase.hpp"
#include <stdio.h>
#include <cstdio>
#include <map>
class ToolSpec final : public ToolBase

View File

@@ -7,15 +7,15 @@
#endif
#include <clocale>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cstdarg>
#include <signal.h>
#include <regex>
#include <list>
#include "hecl/Database.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "hecl/Blender/Connection.hpp"
#include "logvisor/logvisor.hpp"
logvisor::Module LogModule("hecl::Driver");
@@ -24,11 +24,7 @@ logvisor::Module LogModule("hecl::Driver");
#include "ToolInit.hpp"
#include "ToolSpec.hpp"
#include "ToolExtract.hpp"
#include "ToolAdd.hpp"
#include "ToolRemove.hpp"
#include "ToolGroup.hpp"
#include "ToolCook.hpp"
#include "ToolClean.hpp"
#include "ToolPackage.hpp"
#include "ToolHelp.hpp"
@@ -58,7 +54,7 @@ static void printHelp(const hecl::SystemChar* pname)
#elif HECL_VER
hecl::Printf(_S(" Version " HECL_VER_S "\nUsage: %s extract|init|add|remove|group|cook|clean|package|help\n"), pname);
#else
hecl::Printf(_S("\nUsage: %s extract|init|add|remove|group|cook|clean|package|help\n"), pname);
hecl::Printf(_S("\nUsage: %s extract|init|cook|package|help\n"), pname);
#endif
}
@@ -68,7 +64,7 @@ static const hecl::SystemRegex regOPEN(_S("-o([^\"]*|\\S*)"), std::regex::ECMASc
/* SIGINT will gracefully close blender connections and delete blends in progress */
static void SIGINTHandler(int sig)
{
hecl::BlenderConnection::Shutdown();
hecl::blender::Connection::Shutdown();
exit(1);
}
@@ -259,16 +255,8 @@ int main(int argc, const char** argv)
tool.reset(new ToolSpec(info));
else if (toolName == _S("extract"))
tool.reset(new ToolExtract(info));
else if (toolName == _S("add"))
tool.reset(new ToolAdd(info));
else if (toolName == _S("remove") || toolName == _S("rm"))
tool.reset(new ToolRemove(info));
else if (toolName == _S("group"))
tool.reset(new ToolGroup(info));
else if (toolName == _S("cook"))
tool.reset(new ToolCook(info));
else if (toolName == _S("clean"))
tool.reset(new ToolClean(info));
else if (toolName == _S("package") || toolName == _S("pack"))
tool.reset(new ToolPackage(info));
else if (toolName == _S("help"))
@@ -304,14 +292,14 @@ int main(int argc, const char** argv)
int retval = tool->run();
if (logvisor::ErrorCount > ErrorRef)
{
hecl::BlenderConnection::Shutdown();
hecl::blender::Connection::Shutdown();
#if WIN_PAUSE
system("PAUSE");
#endif
return -1;
}
hecl::BlenderConnection::Shutdown();
hecl::blender::Connection::Shutdown();
#if WIN_PAUSE
system("PAUSE");
#endif