Windows build fixes

This commit is contained in:
Jack Andersen 2019-07-27 15:19:48 -10:00
parent 08d15514a9
commit 7b05b41d34
14 changed files with 38 additions and 30 deletions

View File

@ -38,7 +38,7 @@ public:
} }
} }
if (!m_spec) if (!m_spec)
LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName);
continue; continue;
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-')) } else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue; continue;

View File

@ -62,7 +62,7 @@ public:
newProjRoot.makeDir(); newProjRoot.makeDir();
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot)); m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
if (logvisor::ErrorCount > ErrorRef) if (logvisor::ErrorCount > ErrorRef)
LogModule.report(logvisor::Fatal, fmt("unable to init project at '{}'"), rootDir); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to init project at '{}'")), rootDir);
LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), rootDir); LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), rootDir);
m_useProj = m_fallbackProj.get(); m_useProj = m_fallbackProj.get();
} else } else

View File

@ -82,7 +82,7 @@ public:
} }
} }
if (!m_spec) if (!m_spec)
LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to find data spec '{}'")), specName);
continue; continue;
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-')) } else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue; continue;

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit 0ada695c7a9a774a233211fe73e86b0779c3073a Subproject commit ffbd1a0bcda633d324eb82cd55fa14dcb2f33401

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit ae5d7e51316d149e1f52ff715a7e72a5c6906db5 Subproject commit af50bc0bc21855dbe2b49cb5b40fdde1f4a925f9

View File

@ -85,5 +85,7 @@ struct hash<hecl::FourCC> {
}; };
} // namespace std } // namespace std
FMT_CUSTOM_FORMATTER(hecl::FourCC, fmt("{:.4s}"), obj.getChars()) FMT_CUSTOM_FORMATTER(hecl::FourCC, "{:c}{:c}{:c}{:c}",
FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, fmt("{:.4s}"), obj.getChars()) obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3])
FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, "{:c}{:c}{:c}{:c}",
obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3])

View File

@ -577,7 +577,7 @@ public:
return SystemString(beginIt, absPathForward.cend()); return SystemString(beginIt, absPathForward.cend());
} }
} }
LogModule.report(logvisor::Fatal, fmt("unable to resolve '{}' as project relative '{}'"), absPath, m_projRoot); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath, m_projRoot);
return SystemString(); return SystemString();
} }
@ -1269,5 +1269,5 @@ struct hash<hecl::Hash> {
}; };
} // namespace std } // namespace std
FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, fmt("{}"), obj.str()) FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, "{}", obj.str())
FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, fmt("{}"), obj.sys_str()) FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, "{}", obj.sys_str())

View File

@ -284,7 +284,7 @@ Connection::Connection(int verbosityLevel) {
/* User-specified blender path */ /* User-specified blender path */
#if _WIN32 #if _WIN32
wchar_t BLENDER_BIN_BUF[2048]; std::wstring blenderBinBuf;
const wchar_t* blenderBin = _wgetenv(L"BLENDER_BIN"); const wchar_t* blenderBin = _wgetenv(L"BLENDER_BIN");
#else #else
const char* blenderBin = getenv("BLENDER_BIN"); const char* blenderBin = getenv("BLENDER_BIN");
@ -307,18 +307,16 @@ Connection::Connection(int verbosityLevel) {
/* No steam; try default */ /* No steam; try default */
wchar_t progFiles[256]; wchar_t progFiles[256];
if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256)) if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256))
BlenderLog.report(logvisor::Fatal, L"unable to determine 'Program Files' path"); BlenderLog.report(logvisor::Fatal, fmt(L"unable to determine 'Program Files' path"));
_snwprintf(BLENDER_BIN_BUF, 2048, L"%s\\Blender Foundation\\Blender\\blender.exe", progFiles); blenderBinBuf = fmt::format(fmt(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
blenderBin = BLENDER_BIN_BUF; blenderBin = blenderBinBuf.c_str();
if (!RegFileExists(blenderBin)) if (!RegFileExists(blenderBin))
BlenderLog.report(logvisor::Fatal, L"unable to find blender.exe"); BlenderLog.report(logvisor::Fatal, fmt(L"unable to find blender.exe"));
} }
} }
wchar_t cmdLine[2048]; std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""),
_snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR " %d \"%s\"", blenderShellPath, uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath);
blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel,
blenderAddonPath.c_str());
STARTUPINFO sinfo = {sizeof(STARTUPINFO)}; STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
HANDLE nulHandle = CreateFileW(L"nul", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sattrs, OPEN_EXISTING, HANDLE nulHandle = CreateFileW(L"nul", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sattrs, OPEN_EXISTING,
@ -333,11 +331,12 @@ Connection::Connection(int verbosityLevel) {
sinfo.hStdOutput = consoleOutWrite; sinfo.hStdOutput = consoleOutWrite;
} }
if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) { if (!CreateProcessW(blenderBin, const_cast<wchar_t*>(cmdLine.c_str()), NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) {
LPWSTR messageBuffer = nullptr; LPWSTR messageBuffer = nullptr;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
BlenderLog.report(logvisor::Fatal, L"unable to launch blender from %s: %s", blenderBin, messageBuffer); BlenderLog.report(logvisor::Fatal, fmt(L"unable to launch blender from {}: {}"), blenderBin, messageBuffer);
} }
close(m_writepipe[0]); close(m_writepipe[0]);
@ -359,7 +358,7 @@ Connection::Connection(int verbosityLevel) {
if (err == ERROR_BROKEN_PIPE) if (err == ERROR_BROKEN_PIPE)
break; // pipe done - normal exit path. break; // pipe done - normal exit path.
else else
BlenderLog.report(logvisor::Error, fmt("Error with ReadFile: %08X"), err); // Something bad happened. BlenderLog.report(logvisor::Error, fmt("Error with ReadFile: {:08X}"), err); // Something bad happened.
} }
// Display the character read on the screen. // Display the character read on the screen.
@ -461,11 +460,15 @@ Connection::Connection(int verbosityLevel) {
BlenderLog.report(logvisor::Fatal, fmt("Unable to launch blender: {}"), lineBuf + 9); BlenderLog.report(logvisor::Fatal, fmt("Unable to launch blender: {}"), lineBuf + 9);
} else if (!strncmp(lineBuf, "NOBLENDER", 9)) { } else if (!strncmp(lineBuf, "NOBLENDER", 9)) {
_closePipe(); _closePipe();
#if _WIN32
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), blenderBin);
#else
if (blenderBin) if (blenderBin)
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}' or '{}'")), blenderBin, BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}' or '{}'")), blenderBin,
DEFAULT_BLENDER_BIN); DEFAULT_BLENDER_BIN);
else else
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN); BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN);
#endif
} else if (!strcmp(lineBuf, "NOT280")) { } else if (!strcmp(lineBuf, "NOT280")) {
_closePipe(); _closePipe();
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Installed blender version must be >= 2.80"))); BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Installed blender version must be >= 2.80")));

View File

@ -87,8 +87,10 @@ target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp)
target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp) target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp)
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp) add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
target_include_directories(hecl-compilers PUBLIC ../include) get_target_property(BOO_INCLUDES boo INTERFACE_INCLUDE_DIRECTORIES)
target_link_libraries(hecl-compilers PUBLIC boo athena-core logvisor) target_include_directories(hecl-compilers PUBLIC ../include ${BOO_INCLUDES})
target_link_libraries(hecl-compilers PUBLIC athena-core logvisor xxhash
glslang OSDependent OGLCompiler SPIRV glslang-default-resource-limits)
if(COMMAND add_sanitizers) if(COMMAND add_sanitizers)
add_sanitizers(hecl-full) add_sanitizers(hecl-full)

View File

@ -89,7 +89,8 @@ ClientProcess::Worker::Worker(ClientProcess& proc, int idx) : m_proc(proc), m_id
void ClientProcess::Worker::proc() { void ClientProcess::Worker::proc() {
ClientProcess::ThreadWorker.reset(this); ClientProcess::ThreadWorker.reset(this);
logvisor::RegisterThreadName(fmt::format(fmt("HECL Worker {}"), m_idx).c_str()); std::string thrName = fmt::format(fmt("HECL Worker {}"), m_idx);
logvisor::RegisterThreadName(thrName.c_str());
std::unique_lock<std::mutex> lk(m_proc.m_mutex); std::unique_lock<std::mutex> lk(m_proc.m_mutex);
while (m_proc.m_running) { while (m_proc.m_running) {

View File

@ -100,7 +100,7 @@ struct ShaderCompiler<PlatformType::D3D11> {
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) { D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
printf("%s\n", text.data()); printf("%s\n", text.data());
Log.report(logvisor::Fatal, fmt("error compiling shader: %s"), errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
return {}; return {};
} }
std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize()); std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize());

View File

@ -219,7 +219,7 @@ const ProjectPath& Project::getProjectCookedPath(const DataSpecEntry& spec) cons
for (const ProjectDataSpec& sp : m_compiledSpecs) for (const ProjectDataSpec& sp : m_compiledSpecs)
if (&sp.spec == &spec) if (&sp.spec == &spec)
return sp.cookedPath; return sp.cookedPath;
LogModule.report(logvisor::Fatal, fmt("Unable to find spec '{}'"), spec.m_name); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find spec '{}'")), spec.m_name);
return m_cookedRoot; return m_cookedRoot;
} }

View File

@ -747,7 +747,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
LPWSTR messageBuffer = nullptr; LPWSTR messageBuffer = nullptr;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
LogModule.report(logvisor::Error, L"unable to launch process from %s: %s", path, messageBuffer); LogModule.report(logvisor::Error, fmt(L"unable to launch process from {}: {}"), path, messageBuffer);
LocalFree(messageBuffer); LocalFree(messageBuffer);
CloseHandle(nulHandle); CloseHandle(nulHandle);
@ -773,7 +773,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
if (err == ERROR_BROKEN_PIPE) if (err == ERROR_BROKEN_PIPE)
break; // pipe done - normal exit path. break; // pipe done - normal exit path.
else else
LogModule.report(logvisor::Error, fmt("Error with ReadFile: %08X"), err); // Something bad happened. LogModule.report(logvisor::Error, fmt("Error with ReadFile: {:08X}"), err); // Something bad happened.
} }
// Display the character read on the screen. // Display the character read on the screen.

View File

@ -85,7 +85,7 @@ int main(int argc, const hecl::SystemChar** argv)
else else
c.addDefine(defineU8, ""); c.addDefine(defineU8, "");
} else { } else {
Log.report(logvisor::Error, fmt("Unrecognized flag option '{:c}'"), argv[i][1]); Log.report(logvisor::Error, fmt(_SYS_STR("Unrecognized flag option '{:c}'")), argv[i][1]);
return 1; return 1;
} }
} else { } else {