diff --git a/scripts/ci-build-python-lib.sh b/scripts/ci-build-python-lib.sh index 71a5a4fe..552000d1 100755 --- a/scripts/ci-build-python-lib.sh +++ b/scripts/ci-build-python-lib.sh @@ -1,13 +1,14 @@ +#!/bin/bash + # # Build Python 3.10.6 and install it to ci/dist/python so that we don't need separated Python installation(which is sometimes difficult to setup on C.I. environment) # # This build is minimal and disables many features, including ZLIB and OpenSSL support, assuming TinyUSDZ python module does not require such python modules(ZLIB, SSL, MD5, SHA256, ...) # git clone https://github.com/lighttransport/python-cmake-buildsystem ci/python-cmake-buildsystem - -# It seems `python` binary will be built by symlinking libpython.so when `BUILD_LIBPYTHON_SHARED=On`(default on Unix), -# which need to set a path to .so in LD_LIBRARY_PATH to run `python`. -# For convienience, we build Python twice, SHARED on and off to generate libpython.so and monolithic, statically-liked `python` binary. +curdir=`pwd` +cd ci/python-cmake-buildsystem && git pull origin master +cd ${curdir} function cmake_configure_and_build () { # $1 = arg to BUILD_LIBPYTHON_SHARED @@ -33,6 +34,6 @@ function cmake_configure_and_build () { cmake --install `pwd`/ci/build_python } -# On, then off so that monolitic `bin/python` is installed to the `ci/dist/python`. cmake_configure_and_build ON -cmake_configure_and_build OFF + +#cmake_configure_and_build OFF diff --git a/src/usdc-writer.cc b/src/usdc-writer.cc index 03a3f816..6c055dff 100644 --- a/src/usdc-writer.cc +++ b/src/usdc-writer.cc @@ -7,9 +7,13 @@ #if !defined(TINYUSDZ_DISABLE_MODULE_USDC_WRITER) #if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(__clang__) +// No need to define NOMINMAX for llvm-mingw +#else #ifndef NOMINMAX #define NOMINMAX #endif +#endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -104,6 +108,7 @@ std::wstring UTF8ToWchar(const std::string &str) { return wstr; } +#if 0 std::string WcharToUTF8(const std::wstring &wstr) { int str_size = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), int(wstr.size()), nullptr, 0, nullptr, nullptr); @@ -113,6 +118,7 @@ std::string WcharToUTF8(const std::wstring &wstr) { return str; } #endif +#endif struct Section { Section() { memset(this, 0, sizeof(*this)); } @@ -530,7 +536,7 @@ bool SaveAsUSDCToFile(const std::string &filename, const HighLevelScene &scene, } #ifdef _WIN32 -#if defined(_MSC_VER) || defined(__GLIBCXX__) +#if defined(_MSC_VER) || defined(__GLIBCXX__) || defined(__clang__) FILE *fp = nullptr; errno_t fperr = _wfopen_s(&fp, UTF8ToWchar(filename).c_str(), L"wb"); if (fperr != 0) { @@ -542,7 +548,7 @@ bool SaveAsUSDCToFile(const std::string &filename, const HighLevelScene &scene, } #else FILE *fp = nullptr; - errno_t fperr = fopen_s(&fp, abs_filename.c_str(), "wb"); + errno_t fperr = fopen_s(&fp, filename.c_str(), "wb"); if (fperr != 0) { if (err) { (*err) += "Failed to open file `" + filename + "` to write.\n";