Commit 920fcb3c authored by Jack Andersen's avatar Jack Andersen

Windows build fixes

parent 056c2f33
......@@ -38,7 +38,7 @@ public:
}
}
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;
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue;
......
......@@ -62,7 +62,7 @@ public:
newProjRoot.makeDir();
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
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);
m_useProj = m_fallbackProj.get();
} else
......
......@@ -82,7 +82,7 @@ public:
}
}
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;
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
continue;
......
Subproject commit 0ada695c7a9a774a233211fe73e86b0779c3073a
Subproject commit ffbd1a0bcda633d324eb82cd55fa14dcb2f33401
Subproject commit ae5d7e51316d149e1f52ff715a7e72a5c6906db5
Subproject commit af50bc0bc21855dbe2b49cb5b40fdde1f4a925f9
......@@ -85,5 +85,7 @@ struct hash<hecl::FourCC> {
};
} // namespace std
FMT_CUSTOM_FORMATTER(hecl::FourCC, fmt("{:.4s}"), obj.getChars())
FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, fmt("{:.4s}"), obj.getChars())
FMT_CUSTOM_FORMATTER(hecl::FourCC, "{:c}{:c}{:c}{:c}",
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])
......@@ -577,7 +577,7 @@ public:
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();
}
......@@ -1269,5 +1269,5 @@ struct hash<hecl::Hash> {
};
} // namespace std
FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, fmt("{}"), obj.str())
FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, fmt("{}"), obj.sys_str())
\ No newline at end of file
FMT_CUSTOM_FORMATTER(hecl::SystemUTF8Conv, "{}", obj.str())
FMT_CUSTOM_FORMATTER(hecl::SystemStringConv, "{}", obj.sys_str())
......@@ -284,7 +284,7 @@ Connection::Connection(int verbosityLevel) {
/* User-specified blender path */
#if _WIN32
wchar_t BLENDER_BIN_BUF[2048];
std::wstring blenderBinBuf;
const wchar_t* blenderBin = _wgetenv(L"BLENDER_BIN");
#else
const char* blenderBin = getenv("BLENDER_BIN");
......@@ -307,18 +307,16 @@ Connection::Connection(int verbosityLevel) {
/* No steam; try default */
wchar_t progFiles[256];
if (!GetEnvironmentVariableW(L"ProgramFiles", progFiles, 256))
BlenderLog.report(logvisor::Fatal, L"unable to determine 'Program Files' path");
_snwprintf(BLENDER_BIN_BUF, 2048, L"%s\\Blender Foundation\\Blender\\blender.exe", progFiles);
blenderBin = BLENDER_BIN_BUF;
BlenderLog.report(logvisor::Fatal, fmt(L"unable to determine 'Program Files' path"));
blenderBinBuf = fmt::format(fmt(L"{}\\Blender Foundation\\Blender\\blender.exe"), progFiles);
blenderBin = blenderBinBuf.c_str();
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];
_snwprintf(cmdLine, 2048, L" --background -P \"%s\" -- %" PRIuPTR " %" PRIuPTR " %d \"%s\"",
blenderShellPath.c_str(), uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel,
blenderAddonPath.c_str());
std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""),
blenderShellPath, uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath);
STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
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;
}
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;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 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]);
......@@ -359,7 +358,7 @@ Connection::Connection(int verbosityLevel) {
if (err == ERROR_BROKEN_PIPE)
break; // pipe done - normal exit path.
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.
......@@ -461,11 +460,15 @@ Connection::Connection(int verbosityLevel) {
BlenderLog.report(logvisor::Fatal, fmt("Unable to launch blender: {}"), lineBuf + 9);
} else if (!strncmp(lineBuf, "NOBLENDER", 9)) {
_closePipe();
#if _WIN32
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), blenderBin);
#else
if (blenderBin)
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}' or '{}'")), blenderBin,
DEFAULT_BLENDER_BIN);
else
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN);
#endif
} else if (!strcmp(lineBuf, "NOT280")) {
_closePipe();
BlenderLog.report(logvisor::Fatal, fmt(_SYS_STR("Installed blender version must be >= 2.80")));
......
......@@ -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)
add_library(hecl-compilers Compilers.cpp WideStringConvert.cpp)
target_include_directories(hecl-compilers PUBLIC ../include)
target_link_libraries(hecl-compilers PUBLIC boo athena-core logvisor)
get_target_property(BOO_INCLUDES boo INTERFACE_INCLUDE_DIRECTORIES)
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)
add_sanitizers(hecl-full)
......
......@@ -89,7 +89,8 @@ ClientProcess::Worker::Worker(ClientProcess& proc, int idx) : m_proc(proc), m_id
void ClientProcess::Worker::proc() {
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);
while (m_proc.m_running) {
......
......@@ -100,7 +100,7 @@ struct ShaderCompiler<PlatformType::D3D11> {
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
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 {};
}
std::pair<StageBinaryData, size_t> ret(MakeStageBinaryData(blobOut->GetBufferSize()), blobOut->GetBufferSize());
......
......@@ -219,7 +219,7 @@ const ProjectPath& Project::getProjectCookedPath(const DataSpecEntry& spec) cons
for (const ProjectDataSpec& sp : m_compiledSpecs)
if (&sp.spec == &spec)
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;
}
......
......@@ -747,7 +747,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
LPWSTR messageBuffer = nullptr;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 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);
CloseHandle(nulHandle);
......@@ -773,7 +773,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
if (err == ERROR_BROKEN_PIPE)
break; // pipe done - normal exit path.
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.
......
......@@ -85,7 +85,7 @@ int main(int argc, const hecl::SystemChar** argv)
else
c.addDefine(defineU8, "");
} 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;
}
} else {
......
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