fix MSVC warnings and Win32 build

- CMakeLists.txt: Skip libatomic linking on MSVC (atomics built into runtime)
- crate-reader.cc: Use std::transform with explicit cast to fix C4244 warning
- pprinter.cc: Remove duplicate to_string(DomeLight::TextureFormat) to fix LNK4006

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Syoyo Fujita
2026-01-08 04:47:00 +09:00
parent 3c1b1735b7
commit 896303432e
3 changed files with 6 additions and 26 deletions

View File

@@ -1381,7 +1381,8 @@ foreach(TINYUSDZ_LIB_TARGET ${TINYUSDZ_LIBS})
# On 32-bit systems, 64-bit atomic operations require libatomic # On 32-bit systems, 64-bit atomic operations require libatomic
# (Skip for emscripten as libatomic doesn't exist in wasm environment) # (Skip for emscripten as libatomic doesn't exist in wasm environment)
if (CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT EMSCRIPTEN) # (Skip for MSVC as atomics are built into the runtime)
if (CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT EMSCRIPTEN AND NOT MSVC)
target_link_libraries(${TINYUSDZ_LIB_TARGET} atomic) target_link_libraries(${TINYUSDZ_LIB_TARGET} atomic)
endif() endif()

View File

@@ -1092,7 +1092,8 @@ bool CrateReader::ReadDoubleArrayTyped(bool is_compressed, TypedArray<double> *d
_err += "Failed to read compressed ints in ReadDoubleArrayTyped.\n"; _err += "Failed to read compressed ints in ReadDoubleArrayTyped.\n";
return false; return false;
} }
std::copy(ints.begin(), ints.end(), (*d)->data()); std::transform(ints.begin(), ints.end(), (*d)->data(),
[](int64_t v) { return static_cast<double>(v); });
} else if (code == 't') { } else if (code == 't') {
uint32_t lutSize; uint32_t lutSize;
if (!_sr->read4(&lutSize)) { if (!_sr->read4(&lutSize)) {

View File

@@ -13,6 +13,7 @@
#include "layer.hh" #include "layer.hh"
#include "str-util.hh" #include "str-util.hh"
#include "tiny-format.hh" #include "tiny-format.hh"
#include "usdLux.hh"
#include "usdShade.hh" #include "usdShade.hh"
#include "usdMtlx.hh" #include "usdMtlx.hh"
#include "value-pprint.hh" #include "value-pprint.hh"
@@ -4649,30 +4650,7 @@ std::string to_string(const XformOp::OpType &op) {
//std::string to_string(const tinyusdz::value::token &v) { return v.str(); } //std::string to_string(const tinyusdz::value::token &v) { return v.str(); }
std::string to_string(const DomeLight::TextureFormat &texformat) { // to_string(DomeLight::TextureFormat) is defined in usdLux.cc
std::string s = "[InvalidTextureFormat]";
switch (texformat) {
case DomeLight::TextureFormat::Automatic: {
s = "automatic";
break;
}
case DomeLight::TextureFormat::Latlong: {
s = "latlong";
break;
}
case DomeLight::TextureFormat::MirroredBall: {
s = "mirroedBall";
break;
}
case DomeLight::TextureFormat::Angular: {
s = "angular";
break;
}
}
return s;
}
std::string dump_path(const Path &path) { std::string dump_path(const Path &path) {
std::stringstream ss; std::stringstream ss;