hopefully fix compilation for everythign

This commit is contained in:
Jeffrey Crowell 2022-07-08 01:04:49 -04:00
parent aaf1632951
commit 2b29dbbc42
8 changed files with 22 additions and 14 deletions

View file

@ -330,7 +330,7 @@ int main(int argc, char* argv[])
auto start = std::chrono::steady_clock::now();
int fileListSize = fileList.size();
Globals::Instance->singleThreaded = false;
//Globals::Instance->singleThreaded = false;
for (int i = 0; i < fileListSize; i++)
Globals::Instance->workerData[i] = new FileWorker();

View file

@ -801,9 +801,11 @@ void ZFile::GenerateSourceHeaderFiles()
OutputFormatter formatter;
formatter.Write("#pragma once\n");
bool first = true;
for (ZResource* res : resources)
{
std::string resSrc = res->GetSourceOutputHeader("");
std::string resSrc = res->GetSourceOutputHeader("", first);
first = false;
formatter.Write(resSrc);
if (resSrc != "")
@ -812,7 +814,7 @@ void ZFile::GenerateSourceHeaderFiles()
for (auto& sym : symbolResources)
{
formatter.Write(sym.second->GetSourceOutputHeader(""));
formatter.Write(sym.second->GetSourceOutputHeader("", first));
}
formatter.Write(ProcessExterns());

View file

@ -305,9 +305,13 @@ void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix)
}
}
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, bool first)
{
static std::set<std::string> myset;
static std::set<std::string> totalset;
std::string s2 = name;
if (first) {
totalset.clear();
}
if (Globals::Instance->otrMode && genOTRDef)
{
std::string str = "";;
@ -348,11 +352,13 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
else
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
if (myset.find(name) == myset.end()) {
if (totalset.find(name) == totalset.end()) {
#ifdef _WIN32
str += StringHelper::Sprintf("\nstatic const __declspec(align(2)) char %s[] = d%s;", name.c_str(), name.c_str());
#else
str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str());
myset.insert(name);
} else {
str += StringHelper::Sprintf("\nextern static const char %s[];", name.c_str());
#endif
totalset.insert(name);
}
return str;

View file

@ -116,7 +116,7 @@ public:
[[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const;
virtual void GetSourceOutputCode(const std::string& prefix);
virtual std::string GetSourceOutputHeader(const std::string& prefix);
virtual std::string GetSourceOutputHeader(const std::string& prefix, bool first=true);
virtual void CalcHash();
/**
* Exports the resource to binary format

View file

@ -48,7 +48,7 @@ std::string ZString::GetBodySourceCode() const
return StringHelper::Sprintf("\t\"%s\"", strData.data());
}
std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, bool first)
{
return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data());
}

View file

@ -13,7 +13,7 @@ public:
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
std::string GetBodySourceCode() const override;
std::string GetSourceOutputHeader(const std::string& prefix) override;
std::string GetSourceOutputHeader(const std::string& prefix, bool first = true) override;
std::string GetSourceTypeName() const override;
ZResourceType GetResourceType() const override;

View file

@ -74,7 +74,7 @@ size_t ZSymbol::GetRawDataSize() const
return typeSize;
}
std::string ZSymbol::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix)
std::string ZSymbol::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix, bool first)
{
if (isArray)
{

View file

@ -18,7 +18,7 @@ public:
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
std::string GetSourceOutputHeader(const std::string& prefix) override;
std::string GetSourceOutputHeader(const std::string& prefix, bool first=true) override;
std::string GetSourceTypeName() const override;
ZResourceType GetResourceType() const override;