Commit 3b322f60 authored by Jack Andersen's avatar Jack Andersen

Windows build fixes

parent 5dd72b97
......@@ -51,6 +51,10 @@ else()
endif()
if(MSVC)
# Override CMake defaults to disable RTTI
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /GR-" CACHE STRING
"Flags used by the CXX compiler during all build types." FORCE)
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
add_compile_options(/arch:AVX2)
add_compile_definitions(__SSE4_1__=1)
......@@ -75,9 +79,10 @@ if(MSVC)
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
_CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1
_SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
_ENABLE_EXTENDED_ALIGNED_STORAGE=1)
_ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1 _HAS_EXCEPTIONS=0)
add_compile_options(/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 /wd4068
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_OPTIONS})
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 /wd4661
/wd5045 ${VS_OPTIONS})
if(WINDOWS_STORE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"$ENV{PROGRAMFILES\(X86\)}/Microsoft Visual Studio/2017/Community/Common7/IDE/VC/vcpackages\" /AI\"$ENV{PROGRAMFILES\(X86\)}/Windows Kits/10/UnionMetadata\"")
......
......@@ -631,8 +631,6 @@ struct _CRSM {
}
}
};
extern template struct PPImpl<_CRSM<UniqueID32>>;
extern template struct PPImpl<_CRSM<UniqueID64>>;
template <class IDType>
using CRSM = PPImpl<_CRSM<IDType>>;
......
......@@ -98,8 +98,6 @@ struct _DPSM {
}
}
};
extern template struct PPImpl<_DPSM<UniqueID32>>;
extern template struct PPImpl<_DPSM<UniqueID64>>;
template <class IDType>
using DPSM = PPImpl<_DPSM<IDType>>;
......
......@@ -89,8 +89,6 @@ struct _ELSM {
}
}
};
extern template struct PPImpl<_ELSM<UniqueID32>>;
extern template struct PPImpl<_ELSM<UniqueID64>>;
template <class IDType>
using ELSM = PPImpl<_ELSM<IDType>>;
......
......@@ -279,8 +279,6 @@ struct _GPSM {
}
}
};
extern template struct PPImpl<_GPSM<UniqueID32>>;
extern template struct PPImpl<_GPSM<UniqueID64>>;
template <class IDType>
using GPSM = PPImpl<_GPSM<IDType>>;
......
......@@ -41,7 +41,7 @@ struct PPImpl : BigDNA, _Basis {
}
}
void _read(athena::io::IStreamReader& r) {
constexpr void _read(athena::io::IStreamReader& r) {
constexpr FourCC RefType = uint32_t(_Basis::Type);
DNAFourCC clsId;
clsId.read(r);
......@@ -72,7 +72,7 @@ struct PPImpl : BigDNA, _Basis {
}
}
void _write(athena::io::IStreamWriter& w) {
constexpr void _write(athena::io::IStreamWriter& w) {
constexpr DNAFourCC RefType = uint32_t(_Basis::Type);
RefType.write(w);
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
......@@ -96,7 +96,7 @@ struct PPImpl : BigDNA, _Basis {
w.writeBytes("_END", 4);
}
void _binarySize(std::size_t& s) {
constexpr void _binarySize(std::size_t& s) {
constexpr DNAFourCC RefType = uint32_t(_Basis::Type);
RefType.binarySize(s);
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
......@@ -146,7 +146,7 @@ struct PPImpl : BigDNA, _Basis {
}
}
void _write(athena::io::YAMLDocWriter& w) {
constexpr void _write(athena::io::YAMLDocWriter& w) {
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
if (_shouldStore(p, defaultBool)) {
using Tp = std::decay_t<decltype(p)>;
......@@ -165,7 +165,7 @@ struct PPImpl : BigDNA, _Basis {
});
}
void gatherDependencies(std::vector<hecl::ProjectPath>& deps) {
constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& deps) {
_Basis::Enumerate([&](FourCC fcc, auto& p, bool defaultBool = false) {
using Tp = std::decay_t<decltype(p)>;
if constexpr (!std::is_same_v<Tp, bool> && !std::is_same_v<Tp, uint32_t> && !std::is_same_v<Tp, float>)
......@@ -173,8 +173,8 @@ struct PPImpl : BigDNA, _Basis {
});
}
void gatherDependencies(std::vector<hecl::ProjectPath>& deps) const {
const_cast<std::remove_const_t<decltype(*this)>>(*this).gatherDependencies(deps);
constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& deps) const {
const_cast<PPImpl&>(*this).gatherDependencies(deps);
}
};
......@@ -350,7 +350,6 @@ struct _RealElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IRealElement>& elemPtr) {}
};
extern template struct PEImpl<_RealElementFactory>;
using RealElementFactory = PEImpl<_RealElementFactory>;
struct IIntElement : IElement {
......@@ -404,7 +403,6 @@ struct _IntElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IIntElement>& elemPtr) {}
};
extern template struct PEImpl<_IntElementFactory>;
using IntElementFactory = PEImpl<_IntElementFactory>;
struct IVectorElement : IElement {
......@@ -458,7 +456,6 @@ struct _VectorElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IVectorElement>& elemPtr) {}
};
extern template struct PEImpl<_VectorElementFactory>;
using VectorElementFactory = PEImpl<_VectorElementFactory>;
struct IColorElement : IElement {
......@@ -490,7 +487,6 @@ struct _ColorElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IColorElement>& elemPtr) {}
};
extern template struct PEImpl<_ColorElementFactory>;
using ColorElementFactory = PEImpl<_ColorElementFactory>;
struct IModVectorElement : IElement {
......@@ -532,7 +528,6 @@ struct _ModVectorElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IModVectorElement>& elemPtr) {}
};
extern template struct PEImpl<_ModVectorElementFactory>;
using ModVectorElementFactory = PEImpl<_ModVectorElementFactory>;
struct IEmitterElement : IElement {
......@@ -558,7 +553,6 @@ struct _EmitterElementFactory {
static constexpr void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
const std::unique_ptr<IEmitterElement>& elemPtr) {}
};
extern template struct PEImpl<_EmitterElementFactory>;
using EmitterElementFactory = PEImpl<_EmitterElementFactory>;
struct IUVElement : IElement {
......@@ -1315,8 +1309,6 @@ struct _UVElementFactory {
elemPtr->gatherDependencies(pathsOut);
}
};
extern template struct PEImpl<_UVElementFactory<UniqueID32>>;
extern template struct PEImpl<_UVElementFactory<UniqueID64>>;
template <class IDType>
using UVElementFactory = PEImpl<_UVElementFactory<IDType>>;
......
......@@ -115,8 +115,6 @@ struct _SWSH {
}
}
};
extern template struct PPImpl<_SWSH<UniqueID32>>;
extern template struct PPImpl<_SWSH<UniqueID64>>;
template <class IDType>
using SWSH = PPImpl<_SWSH<IDType>>;
......
......@@ -133,8 +133,6 @@ struct _WPSM {
}
}
};
extern template struct PPImpl<_WPSM<UniqueID32>>;
extern template struct PPImpl<_WPSM<UniqueID64>>;
template <class IDType>
using WPSM = PPImpl<_WPSM<IDType>>;
......
......@@ -1018,7 +1018,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes) {
if (sub.name == ch.name) {
hecl::SystemStringConv chSysName(ch.name);
ch.cskr = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, sub.cskrId));
hecl::SystemStringConv cskrIdSys(sub.cskrId);
ch.cskr = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, cskrIdSys));
/* Add subtype AABBs */
ch.animAABBs.reserve(actor.actions.size());
......@@ -1039,9 +1040,10 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
[](const auto& p) { return p.name == "ICE"; });
if (search != sub.overlayMeshes.cend()) {
hecl::SystemStringConv overlaySys(search->name);
hecl::SystemStringConv cskrIdSys(search->cskrId);
ch.cmdlIce = search->mesh;
ch.cskrIce = inPath.ensureAuxInfo(
fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, search->cskrId));
ch.cskrIce =
inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, cskrIdSys));
}
}
......@@ -1060,7 +1062,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
hecl::SystemStringConv sysStr(prim.animName);
for (const DNAANCS::Action& act : actor.actions) {
if (act.name == prim.animName) {
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, act.animId));
hecl::SystemStringConv animIdSys(act.animId);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, animIdSys));
prim.animId = pathOut;
break;
}
......@@ -1073,14 +1076,15 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
ancs.animationSet.animResources.reserve(actor.actions.size());
for (const DNAANCS::Action& act : actor.actions) {
hecl::SystemStringConv sysStr(act.name);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, act.animId));
hecl::SystemStringConv animIdSys(act.animId);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, animIdSys));
ancs.animationSet.animResources.emplace_back();
ancs.animationSet.animResources.back().animId = pathOut;
/* Check for associated EVNT YAML */
hecl::SystemString testPrefix(inPath.getWithExtension(
fmt::format(fmt(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent());
hecl::SystemString testPrefix(
inPath.getWithExtension(fmt::format(fmt(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent());
hecl::ProjectPath evntYamlPath;
for (const auto& ent : dEnum) {
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
......@@ -1104,8 +1108,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
static const hecl::SystemRegex regCskrNameId(_SYS_STR(R"((.*)_[0-9a-fA-F]{8}\.CSKR)"),
std::regex::ECMAScript | std::regex::optimize);
static const hecl::SystemRegex regCskrName(_SYS_STR(R"((.*)\.CSKR)"),
std::regex::ECMAScript | std::regex::optimize);
static const hecl::SystemRegex regCskrName(_SYS_STR(R"((.*)\.CSKR)"), std::regex::ECMAScript | std::regex::optimize);
bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor,
const std::function<bool(const hecl::ProjectPath& modelPath)>& modelCookFunc) {
......@@ -1198,8 +1201,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
const std::string& name = boneNames[bIdx];
auto search = boneIdMap.find(name);
if (search == boneIdMap.cend())
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
inPath.getRelativePathUTF8());
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8());
virtualBone.first.emplace_back(search->second, weight);
}
virtualBone.second = skinIO.readUint32Big();
......@@ -1337,8 +1339,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
const std::string& name = boneNames[bIdx];
auto search = boneIdMap.find(name);
if (search == boneIdMap.cend())
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
inPath.getRelativePathUTF8());
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8());
virtualBone.emplace_back(search->second, weight);
}
}
......@@ -1358,8 +1359,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
const std::string& name = boneNames[bIdx];
auto search = boneIdMap.find(name);
if (search == boneIdMap.cend())
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
inPath.getRelativePathUTF8());
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name, inPath.getRelativePathUTF8());
skinOut.writeUint32Big(search->second);
}
}
......@@ -1381,8 +1381,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
static const hecl::SystemRegex regAnimNameId(_SYS_STR(R"((.*)_[0-9a-fA-F]{8}\.ANIM)"),
std::regex::ECMAScript | std::regex::optimize);
static const hecl::SystemRegex regAnimName(_SYS_STR(R"((.*)\.ANIM)"),
std::regex::ECMAScript | std::regex::optimize);
static const hecl::SystemRegex regAnimName(_SYS_STR(R"((.*)\.ANIM)"), std::regex::ECMAScript | std::regex::optimize);
bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor,
hecl::blender::DataStream& ds, bool pc) {
......@@ -1416,8 +1415,8 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
ANIM anim(action, boneIdMap, *rigInv, pc);
/* Check for associated EVNT YAML */
hecl::SystemString testPrefix(inPath.getWithExtension(
fmt::format(fmt(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent());
hecl::SystemString testPrefix(
inPath.getWithExtension(fmt::format(fmt(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent());
hecl::ProjectPath evntYamlPath;
for (const auto& ent : hecl::DirectoryEnumerator(inPath.getParentPath().getAbsolutePath())) {
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
......
......@@ -307,20 +307,22 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
}
hecl::SystemStringConv chSysName(sub.name);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, sub.cskrId)));
hecl::SystemStringConv sysCskrId(sub.cskrId);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, sysCskrId)));
const auto& arm = actor.armatures[sub.armature];
if (hecl::IsPathBlend(arm.path))
pathsOut.push_back(arm.path);
for (const auto& overlay : sub.overlayMeshes) {
hecl::SystemStringConv overlaySys(overlay.name);
if (hecl::IsPathBlend(overlay.mesh)) {
flattenDependenciesBlend(overlay.mesh, pathsOut, btok);
pathsOut.push_back(overlay.mesh);
}
hecl::SystemStringConv overlaySys(overlay.name);
hecl::SystemStringConv sysCskrId(overlay.cskrId);
pathsOut.push_back(asGlob.ensureAuxInfo(
fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, overlay.cskrId)));
fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, sysCskrId)));
}
}
};
......@@ -337,8 +339,8 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
}
hecl::SystemStringConv chSysName(att.name);
pathsOut.push_back(
asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, att.cskrId)));
hecl::SystemStringConv sysCskrId(att.cskrId);
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, sysCskrId)));
if (att.armature >= 0) {
const auto& arm = actor.armatures[att.armature];
......
Subproject commit 837029ec8dfcf2fc758af8f30ab0b293380fb33f
Subproject commit 5f350365e688e773f9c08f372b70ca325358913e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment