mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-16 10:02:59 -07:00
hopefully fix compilation for everythign
This commit is contained in:
parent
aaf1632951
commit
2b29dbbc42
8 changed files with 22 additions and 14 deletions
|
@ -330,7 +330,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
int fileListSize = fileList.size();
|
int fileListSize = fileList.size();
|
||||||
Globals::Instance->singleThreaded = false;
|
//Globals::Instance->singleThreaded = false;
|
||||||
|
|
||||||
for (int i = 0; i < fileListSize; i++)
|
for (int i = 0; i < fileListSize; i++)
|
||||||
Globals::Instance->workerData[i] = new FileWorker();
|
Globals::Instance->workerData[i] = new FileWorker();
|
||||||
|
|
|
@ -801,9 +801,11 @@ void ZFile::GenerateSourceHeaderFiles()
|
||||||
OutputFormatter formatter;
|
OutputFormatter formatter;
|
||||||
|
|
||||||
formatter.Write("#pragma once\n");
|
formatter.Write("#pragma once\n");
|
||||||
|
bool first = true;
|
||||||
for (ZResource* res : resources)
|
for (ZResource* res : resources)
|
||||||
{
|
{
|
||||||
std::string resSrc = res->GetSourceOutputHeader("");
|
std::string resSrc = res->GetSourceOutputHeader("", first);
|
||||||
|
first = false;
|
||||||
formatter.Write(resSrc);
|
formatter.Write(resSrc);
|
||||||
|
|
||||||
if (resSrc != "")
|
if (resSrc != "")
|
||||||
|
@ -812,7 +814,7 @@ void ZFile::GenerateSourceHeaderFiles()
|
||||||
|
|
||||||
for (auto& sym : symbolResources)
|
for (auto& sym : symbolResources)
|
||||||
{
|
{
|
||||||
formatter.Write(sym.second->GetSourceOutputHeader(""));
|
formatter.Write(sym.second->GetSourceOutputHeader("", first));
|
||||||
}
|
}
|
||||||
|
|
||||||
formatter.Write(ProcessExterns());
|
formatter.Write(ProcessExterns());
|
||||||
|
|
|
@ -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)
|
if (Globals::Instance->otrMode && genOTRDef)
|
||||||
{
|
{
|
||||||
std::string str = "";;
|
std::string str = "";;
|
||||||
|
@ -348,11 +352,13 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
|
||||||
else
|
else
|
||||||
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
|
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());
|
str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str());
|
||||||
myset.insert(name);
|
#endif
|
||||||
} else {
|
totalset.insert(name);
|
||||||
str += StringHelper::Sprintf("\nextern static const char %s[];", name.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
[[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const;
|
[[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const;
|
||||||
|
|
||||||
virtual void GetSourceOutputCode(const std::string& prefix);
|
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();
|
virtual void CalcHash();
|
||||||
/**
|
/**
|
||||||
* Exports the resource to binary format
|
* Exports the resource to binary format
|
||||||
|
|
|
@ -48,7 +48,7 @@ std::string ZString::GetBodySourceCode() const
|
||||||
return StringHelper::Sprintf("\t\"%s\"", strData.data());
|
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());
|
return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
||||||
std::string GetBodySourceCode() const 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;
|
std::string GetSourceTypeName() const override;
|
||||||
ZResourceType GetResourceType() const override;
|
ZResourceType GetResourceType() const override;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ size_t ZSymbol::GetRawDataSize() const
|
||||||
return typeSize;
|
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)
|
if (isArray)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override;
|
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;
|
std::string GetSourceTypeName() const override;
|
||||||
ZResourceType GetResourceType() const override;
|
ZResourceType GetResourceType() const override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue