From cc8b06ef1c5ba7de10bd09066989765c178245f0 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Mon, 12 Sep 2016 07:46:07 +0100 Subject: [PATCH 01/20] The PxrUsdIn node type in KATANA didn't have the fileInput hint set, meaning that the fileName attribute did not manifest itself as a file. --- third_party/katana/python/nodetypes/PxrUsdIn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/katana/python/nodetypes/PxrUsdIn.py b/third_party/katana/python/nodetypes/PxrUsdIn.py index 490534e849..906b86b51a 100644 --- a/third_party/katana/python/nodetypes/PxrUsdIn.py +++ b/third_party/katana/python/nodetypes/PxrUsdIn.py @@ -38,6 +38,7 @@ def getScenegraphLocation(self, frameTime): gb.set('fileName', '') nb.setHintsForParameter('fileName', { + 'widget' : 'fileInput', 'help' : 'The USD file to read.', }) From a7dd23102ce6d028931f0536338f85ff6e8a5a54 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 14 Sep 2016 11:21:57 +0100 Subject: [PATCH 02/20] Initial implementation of symbolic link resolution. --- pxr/base/lib/arch/fileSystem.cpp | 77 ++++++++++++++++++++++++++++++++ pxr/base/lib/arch/fileSystem.h | 7 +++ pxr/base/lib/tf/fileUtils.cpp | 7 ++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/pxr/base/lib/arch/fileSystem.cpp b/pxr/base/lib/arch/fileSystem.cpp index b1ba733a1d..44d08a7f9f 100644 --- a/pxr/base/lib/arch/fileSystem.cpp +++ b/pxr/base/lib/arch/fileSystem.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #else #include #include @@ -694,4 +695,80 @@ int ArchFileAccess(const char* path, int mode) } return result ? 0 : -1; } + +// https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012.aspx + +#define MAX_REPARSE_DATA_SIZE (16 * 1024) + +typedef struct _REPARSE_DATA_BUFFER { + ULONG ReparseTag; + USHORT ReparseDataLength; + USHORT Reserved; + union { + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + ULONG Flags; + WCHAR PathBuffer[1]; + } SymbolicLinkReparseBuffer; + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + WCHAR PathBuffer[1]; + } MountPointReparseBuffer; + struct { + UCHAR DataBuffer[1]; + } GenericReparseBuffer; + }; +} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; + +std::string ArchResolveSymlink(const char* path) +{ + HANDLE handle = ::CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | + FILE_FLAG_BACKUP_SEMANTICS, NULL); + + if (handle == INVALID_HANDLE_VALUE) + return std::string(path); + + std::unique_ptr buffer(new + unsigned char[MAX_REPARSE_DATA_SIZE]); + REPARSE_DATA_BUFFER* reparse = (REPARSE_DATA_BUFFER*)buffer.get(); + + if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, reparse, + MAX_REPARSE_DATA_SIZE, NULL, NULL)) + { + CloseHandle(handle); + return std::string(path); + } + CloseHandle(handle); + + if (IsReparseTagMicrosoft(reparse->ReparseTag)) + { + if (reparse->ReparseTag == IO_REPARSE_TAG_SYMLINK) + { + size_t length = reparse->SymbolicLinkReparseBuffer.PrintNameLength + / sizeof(WCHAR); + std::unique_ptr reparsePath(new WCHAR[length + 1]); + wcsncpy_s(reparsePath.get(), length + 1, + &reparse->SymbolicLinkReparseBuffer.PathBuffer[ + reparse->SymbolicLinkReparseBuffer.PrintNameOffset / sizeof(WCHAR) + ], length); + + reparsePath.get()[length] = 0; + + // Convert wide-char to narrow char + std::wstring ws(reparsePath.get()); + string str(ws.begin(), ws.end()); + + return str; + } + } + + return std::string(path); +} #endif diff --git a/pxr/base/lib/arch/fileSystem.h b/pxr/base/lib/arch/fileSystem.h index ab81b3b3ab..6960d12ded 100644 --- a/pxr/base/lib/arch/fileSystem.h +++ b/pxr/base/lib/arch/fileSystem.h @@ -330,6 +330,13 @@ int64_t ArchPRead(FILE *file, void *buffer, size_t count, int64_t offset); ARCH_API int64_t ArchPWrite(FILE *file, void const *bytes, size_t count, int64_t offset); +#if defined(ARCH_OS_WINDOWS) +/// Attempts to resolve a symbolic link. \p path can be a file or directory. +/// Returns the resolved path if successful or the original path on error. +ARCH_API +std::string ArchResolveSymlink(const char* path); +#endif + ///@} #endif // ARCH_FILESYSTEM_H diff --git a/pxr/base/lib/tf/fileUtils.cpp b/pxr/base/lib/tf/fileUtils.cpp index 18ee7eed1c..ad036594e7 100644 --- a/pxr/base/lib/tf/fileUtils.cpp +++ b/pxr/base/lib/tf/fileUtils.cpp @@ -131,7 +131,12 @@ TfIsFile(string const& path, bool resolveSymlinks) bool TfIsLink(string const& path) { -#if !defined(ARCH_OS_WINDOWS) +#if defined(ARCH_OS_WINDOWS) + DWORD attribs = GetFileAttributes(path.c_str()); + + return (attribs != INVALID_FILE_ATTRIBUTES && + (attribs & FILE_ATTRIBUTE_REPARSE_POINT)); +#else struct stat st; if (Tf_Stat(path, /* resolveSymlinks */ false, &st)) { return S_ISLNK(st.st_mode); From 921e4ae4b298cb2e62ad40dad4b9a46c7b056877 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 14 Sep 2016 11:22:54 +0100 Subject: [PATCH 03/20] Compile usdAbc plugin. --- cmake/defaults/Options.cmake | 3 +- cmake/macros/Public.cmake | 4 ++ pxr/usd/lib/sdf/abstractData.h | 5 +- pxr/usd/plugin/usdAbc/CMakeLists.txt | 4 ++ pxr/usd/plugin/usdAbc/alembicFileFormat.h | 8 ++-- pxr/usd/plugin/usdAbc/alembicReader.cpp | 12 ++--- pxr/usd/plugin/usdAbc/alembicUtil.cpp | 24 +++++----- pxr/usd/plugin/usdAbc/alembicUtil.h | 40 ++++++++++------ pxr/usd/plugin/usdAbc/alembicWriter.cpp | 42 ++++++++-------- pxr/usd/plugin/usdAbc/api.h | 45 ++++++++++++++++++ .../plugin/vmp_usd/.vscode/.BROWSE.VC.DB | Bin 0 -> 4096 bytes 11 files changed, 127 insertions(+), 60 deletions(-) create mode 100644 pxr/usd/plugin/usdAbc/api.h create mode 100644 third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB diff --git a/cmake/defaults/Options.cmake b/cmake/defaults/Options.cmake index eeeaca9f16..8387ae2d03 100644 --- a/cmake/defaults/Options.cmake +++ b/cmake/defaults/Options.cmake @@ -27,8 +27,9 @@ option(PXR_BUILD_IMAGING "Build imaging components" ON) option(PXR_BUILD_USD_IMAGING "Build USD imaging components" ON) option(PXR_BUILD_KATANA_PLUGIN "Build usd katana plugin" ON) option(PXR_BUILD_MAYA_PLUGIN "Build usd maya plugin" ON) -option(PXR_BUILD_ALEMBIC_PLUGIN "Build the Alembic plugin for USD" OFF) +option(PXR_BUILD_ALEMBIC_PLUGIN "Build the Alembic plugin for USD" ON) option(PXR_MAYA_TBB_BUG_WORKAROUND "Turn on linker flag (-Wl,-Bsymbolic) to work around a Maya TBB bug" OFF) +option(PXR_HYBRID_BUILD_MODE "Build USD in release with symbols and optimisations disabled" ON) set(PXR_INSTALL_LOCATION "" CACHE diff --git a/cmake/macros/Public.cmake b/cmake/macros/Public.cmake index ca96124fcc..003c0cc764 100644 --- a/cmake/macros/Public.cmake +++ b/cmake/macros/Public.cmake @@ -626,11 +626,15 @@ function(pxr_plugin PLUGIN_NAME) PREFIX ${PXR_PREFIX} ) + string(TOUPPER ${PLUGIN_NAME} ucLibName) + set_target_properties(${PLUGIN_NAME} PROPERTIES PUBLIC_HEADER "${sl_PUBLIC_HEADERS};${${PLUGIN_NAME}_PUBLIC_HEADERS}" INTERFACE_INCLUDE_DIRECTORIES "" + DEFINE_SYMBOL + "${ucLibName}_EXPORTS" ) # Install and include headers from the build directory. diff --git a/pxr/usd/lib/sdf/abstractData.h b/pxr/usd/lib/sdf/abstractData.h index ef52577f7c..a29a7b1ed9 100644 --- a/pxr/usd/lib/sdf/abstractData.h +++ b/pxr/usd/lib/sdf/abstractData.h @@ -86,10 +86,10 @@ class SdfAbstractDataSpecId /// Returns string representation of this key. Equivalent to /// GetFullSpecPath().GetString(). - SDF_API std::string GetString() const; + SDF_API std::string GetString() const; /// Returns true if this object identifies a property spec, false otherwise. - bool IsProperty() const; + SDF_API bool IsProperty() const; /// Returns the full path to the spec identified by this object. const SdfPath& GetFullSpecPath() const @@ -547,6 +547,7 @@ class SdfAbstractDataConstTypedValue class SdfAbstractDataSpecVisitor { public: + SDF_API virtual ~SdfAbstractDataSpecVisitor(); /// \c SdfAbstractData::VisitSpecs will call this function for every entry diff --git a/pxr/usd/plugin/usdAbc/CMakeLists.txt b/pxr/usd/plugin/usdAbc/CMakeLists.txt index 90ad70bd43..a8ba94cb2d 100644 --- a/pxr/usd/plugin/usdAbc/CMakeLists.txt +++ b/pxr/usd/plugin/usdAbc/CMakeLists.txt @@ -16,6 +16,7 @@ pxr_plugin(usdAbc ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${OPENEXR_Iex_LIBRARY} + ${ZLIB_LIBRARY_RELEASE} INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR} @@ -31,6 +32,9 @@ pxr_plugin(usdAbc alembicUtil alembicWriter + PUBLIC_HEADERS + api.h + CPPFILES moduleDeps.cpp diff --git a/pxr/usd/plugin/usdAbc/alembicFileFormat.h b/pxr/usd/plugin/usdAbc/alembicFileFormat.h index 7478a20684..69401276f9 100644 --- a/pxr/usd/plugin/usdAbc/alembicFileFormat.h +++ b/pxr/usd/plugin/usdAbc/alembicFileFormat.h @@ -23,7 +23,8 @@ // #ifndef USDABC_ALEMBIC_FILE_FORMAT_H #define USDABC_ALEMBIC_FILE_FORMAT_H - + +#include "pxr/usd/usdAbc/api.h" #include "pxr/usd/sdf/fileFormat.h" #include "pxr/base/tf/staticTokens.h" #include @@ -34,7 +35,8 @@ ((Version, "1.0")) \ ((Target, "usd")) -TF_DECLARE_PUBLIC_TOKENS(UsdAbcAlembicFileFormatTokens, USDABC_ALEMBIC_FILE_FORMAT_TOKENS); +TF_DECLARE_PUBLIC_TOKENS(UsdAbcAlembicFileFormatTokens, USDABC_API, + USDABC_ALEMBIC_FILE_FORMAT_TOKENS); TF_DECLARE_WEAK_AND_REF_PTRS(UsdAbcAlembicFileFormat); TF_DECLARE_WEAK_AND_REF_PTRS(SdfLayerBase); @@ -52,7 +54,7 @@ class UsdAbcAlembicFileFormat : public SdfFileFormat { virtual bool WriteToFile(const SdfLayerBase* layerBase, const std::string& filePath, const std::string& comment = std::string(), - const FileFormatArguments& args = + const FileFormatArguments& args = FileFormatArguments()) const; virtual bool ReadFromString(const SdfLayerBasePtr& layerBase, const std::string& str) const; diff --git a/pxr/usd/plugin/usdAbc/alembicReader.cpp b/pxr/usd/plugin/usdAbc/alembicReader.cpp index 56ce1d0010..dc1d112fe5 100644 --- a/pxr/usd/plugin/usdAbc/alembicReader.cpp +++ b/pxr/usd/plugin/usdAbc/alembicReader.cpp @@ -855,7 +855,7 @@ _ReaderContext::Open(const std::string& filePath, std::string* errorLog) _Lock lock(_mutex); // Get info. - uint32_t apiVersion; + abc::uint32_t apiVersion; std::string writer, version, date, comment; GetArchiveInfo(archive, writer, version, apiVersion, date, comment); @@ -2513,7 +2513,7 @@ struct _CopyCameraHorizontalAperture : _CopyCameraBase { const float horizontalAperture = sample.getHorizontalAperture() * - sample.getLensSqueezeRatio() * 10.0; + sample.getLensSqueezeRatio() * 10.0f; return dst.Set(horizontalAperture); } @@ -2535,7 +2535,7 @@ struct _CopyCameraVerticalAperture : _CopyCameraBase { const float verticalAperture = sample.getVerticalAperture() * - sample.getLensSqueezeRatio() * 10.0; + sample.getLensSqueezeRatio() * 10.0f; return dst.Set(verticalAperture); } @@ -2557,7 +2557,7 @@ struct _CopyCameraHorizontalApertureOffset : _CopyCameraBase { const float horizontalApertureOffset = sample.getHorizontalFilmOffset() * - sample.getLensSqueezeRatio() * 10.0; + sample.getLensSqueezeRatio() * 10.0f; return dst.Set(horizontalApertureOffset); } @@ -2579,7 +2579,7 @@ struct _CopyCameraVerticalApertureOffset : _CopyCameraBase { const float verticalApertureOffset = sample.getVerticalFilmOffset() * - sample.getLensSqueezeRatio() * 10.0; + sample.getLensSqueezeRatio() * 10.0f; return dst.Set(verticalApertureOffset); } }; @@ -3189,7 +3189,7 @@ _ReadPoints(_PrimReaderContext* context) context->AddProperty( UsdGeomTokens->ids, SdfValueTypeNames->Int64Array, - _CopyGeneric( + _CopyGeneric( context->ExtractSchema(".pointIds"))); } diff --git a/pxr/usd/plugin/usdAbc/alembicUtil.cpp b/pxr/usd/plugin/usdAbc/alembicUtil.cpp index 95a4cd8c10..49fde981e2 100644 --- a/pxr/usd/plugin/usdAbc/alembicUtil.cpp +++ b/pxr/usd/plugin/usdAbc/alembicUtil.cpp @@ -106,7 +106,7 @@ UsdAbc_AlembicType::operator<(const UsdAbc_AlembicType& rhs) const /// Format an Alembic version number as a string. std::string -UsdAbc_FormatAlembicVersion(int32_t n) +UsdAbc_FormatAlembicVersion(abc::int32_t n) { return TfStringPrintf("%d.%d.%d", n / 10000, (n / 100) % 100, n % 100); } @@ -306,24 +306,24 @@ UsdAbc_AlembicConversions::UsdAbc_AlembicConversions() { // Preferred conversions. data.AddConverter(); - data.AddConverter(); - data.AddConverter(); - data.AddConverter(); - data.AddConverter(); - data.AddConverter(); + data.AddConverter(); + data.AddConverter(); + data.AddConverter(); + data.AddConverter(); + data.AddConverter(); data.AddConverter(); data.AddConverter(); data.AddConverter(); data.AddConverter(); - data.AddConverter(); + data.AddConverter(); data.AddConverter(); data.AddConverter(); data.AddConverter(); - data.AddConverter(); + data.AddConverter(); data.AddConverter(); data.AddConverter(); data.AddConverter(); - data.AddConverter(); + data.AddConverter(); data.AddConverter(); data.AddConverter(); data.AddConverter(); @@ -332,9 +332,9 @@ UsdAbc_AlembicConversions::UsdAbc_AlembicConversions() data.AddConverter(); // Other conversions. - data.AddConverter(); - data.AddConverter(); - data.AddConverter(); + data.AddConverter(); + data.AddConverter(); + data.AddConverter(); data.AddConverter(); data.AddConverter(); diff --git a/pxr/usd/plugin/usdAbc/alembicUtil.h b/pxr/usd/plugin/usdAbc/alembicUtil.h index 5bdb93449a..bdec2674bb 100644 --- a/pxr/usd/plugin/usdAbc/alembicUtil.h +++ b/pxr/usd/plugin/usdAbc/alembicUtil.h @@ -26,6 +26,7 @@ /// \file usdAbc/alembicUtil.h +#include "pxr/usd/usdAbc/api.h" #include "pxr/usd/usdAbc/alembicReader.h" #include "pxr/usd/sdf/abstractData.h" #include "pxr/usd/sdf/schema.h" @@ -33,6 +34,7 @@ #include "pxr/base/vt/array.h" #include "pxr/base/vt/value.h" #include "pxr/base/arch/demangle.h" +#include "pxr/base/arch/defines.h" #include "pxr/base/tf/staticTokens.h" #include #include @@ -52,6 +54,8 @@ #include #include +namespace abc = Alembic::Util::ALEMBIC_VERSION_NS; + class SdfAbstractDataValue; /// Flags for readers and writers. @@ -62,6 +66,7 @@ class SdfAbstractDataValue; (promoteInstances) \ /* end */ TF_DECLARE_PUBLIC_TOKENS(UsdAbc_AlembicContextFlagNames, + USDABC_API, USDABC_ALEMBIC_CONTEXT_FLAG_NAMES); // A namespace so we can bring Alembic namespaces into it. @@ -77,6 +82,7 @@ using namespace ::Alembic::Abc; ((SDF_VALUE_TAG(elem), SDF_VALUE_TRAITS_TYPE(elem)::Name())) \ ((BOOST_PP_CAT(SDF_VALUE_TAG(elem), Array), SDF_VALUE_TRAITS_TYPE(elem)::ShapedName())) TF_DECLARE_PUBLIC_TOKENS(UsdAbc_UsdDataTypes, + USDABC_API, BOOST_PP_SEQ_FOR_EACH(USD_MAKE_USD_TYPE, ~, SDF_VALUE_TYPES) _SDF_VALUE_TYPE_NAME_TOKENS ); @@ -96,7 +102,8 @@ TF_DECLARE_PUBLIC_TOKENS(UsdAbc_UsdDataTypes, (Scope) \ (Xform) \ /* end */ -TF_DECLARE_PUBLIC_TOKENS(UsdAbcPrimTypeNames, USD_ABC_PRIM_TYPE_NAMES); +TF_DECLARE_PUBLIC_TOKENS(UsdAbcPrimTypeNames, USDABC_API, + USD_ABC_PRIM_TYPE_NAMES); // Property names in the UsdGeom schema. #define USD_ABC_GPRIM_NAMES \ @@ -110,14 +117,16 @@ TF_DECLARE_PUBLIC_TOKENS(UsdAbcPrimTypeNames, USD_ABC_PRIM_TYPE_NAMES); USD_ABC_GPRIM_NAMES \ USD_ABC_POINTBASED_NAMES \ /* end */ -TF_DECLARE_PUBLIC_TOKENS(UsdAbcPropertyNames, USD_ABC_PROPERTY_NAMES); +TF_DECLARE_PUBLIC_TOKENS(UsdAbcPropertyNames, USDABC_API, + USD_ABC_PROPERTY_NAMES); #define USD_ABC_CUSTOM_METADATA \ (gprimDataRender) \ (riName) \ (riType) \ /* end */ -TF_DECLARE_PUBLIC_TOKENS(UsdAbcCustomMetadata, USD_ABC_CUSTOM_METADATA); +TF_DECLARE_PUBLIC_TOKENS(UsdAbcCustomMetadata, USDABC_API, + USD_ABC_CUSTOM_METADATA); // // Alembic property value types. @@ -128,7 +137,7 @@ TF_DECLARE_PUBLIC_TOKENS(UsdAbcCustomMetadata, USD_ABC_CUSTOM_METADATA); /// extra bit. It also supports compound types as their schema titles. struct UsdAbc_AlembicType : boost::totally_ordered { PlainOldDataType pod; // POD type in scalar and array. - uint8_t extent; // Extent of POD (e.g. 3 for a 3-tuple). + abc::uint8_t extent; // Extent of POD (e.g. 3 for a 3-tuple). bool_t array; // true for array, false otherwise. // An empty type. @@ -139,7 +148,8 @@ struct UsdAbc_AlembicType : boost::totally_ordered { } // An array or scalar type. - UsdAbc_AlembicType(PlainOldDataType pod_, uint8_t extent_, bool_t array_) : + UsdAbc_AlembicType(PlainOldDataType pod_, abc::uint8_t extent_, + bool_t array_) : pod(pod_), extent(extent_), array(array_) { // Do nothing @@ -337,7 +347,7 @@ class _SampleForAlembic { typedef bool (_SampleForAlembic::*_UnspecifiedBoolType)() const; #endif - typedef std::vector IndexArray; + typedef std::vector IndexArray; typedef boost::shared_ptr IndexArrayPtr; class Error { @@ -640,7 +650,7 @@ struct _ConvertPODToUsdVec { } }; template <> -struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; +struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> @@ -648,7 +658,7 @@ struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> -struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; +struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> @@ -656,7 +666,7 @@ struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> -struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; +struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> struct _ConvertPODToUsd : _ConvertPODToUsdVec{}; template <> @@ -712,7 +722,7 @@ template struct _ConvertPODToUsdArray { void operator()(UsdType* dst, const void* src, size_t size) { - const uint8_t* typedSrc = reinterpret_cast(src); + const abc::uint8_t* typedSrc = reinterpret_cast(src); const size_t step = extent * sizeof(AlembicType); for (size_t i = 0, n = size; i != n; typedSrc += step, ++i) { dst[i] = _ConvertPODToUsd()(typedSrc); @@ -773,7 +783,7 @@ struct _ConvertPODFromUsdVec { } }; template <> -struct _ConvertPODFromUsd : +struct _ConvertPODFromUsd : _ConvertPODFromUsdVec { }; template <> struct _ConvertPODFromUsd : @@ -785,7 +795,7 @@ template <> struct _ConvertPODFromUsd : _ConvertPODFromUsdVec { }; template <> -struct _ConvertPODFromUsd : +struct _ConvertPODFromUsd : _ConvertPODFromUsdVec { }; template <> struct _ConvertPODFromUsd : @@ -797,7 +807,7 @@ template <> struct _ConvertPODFromUsd : _ConvertPODFromUsdVec { }; template <> -struct _ConvertPODFromUsd : +struct _ConvertPODFromUsd : _ConvertPODFromUsdVec { }; template <> struct _ConvertPODFromUsd : @@ -965,7 +975,7 @@ class UsdAbc_AlembicDataConversion { /// converter. SdfValueTypeName FindConverter(const UsdAbc_AlembicType& alembicType) const; - /// Returns a to-Usd converter that is fully specified (exactly matching + /// Returns a to-Usd converter that is fully specified (exactly matching /// alembicType and usdType). const ToUsdConverter& GetToUsdConverter( const UsdAbc_AlembicType& alembicType, @@ -1021,7 +1031,7 @@ struct UsdAbc_AlembicConversions { /// Format an Alembic version number as a string. std::string -UsdAbc_FormatAlembicVersion(int32_t n); +UsdAbc_FormatAlembicVersion(abc::int32_t n); /// Reverse the order of the subsequences in \p values where the subsequence /// lengths are given by \p counts. diff --git a/pxr/usd/plugin/usdAbc/alembicWriter.cpp b/pxr/usd/plugin/usdAbc/alembicWriter.cpp index 8691f2e0cc..d0e11e7f9f 100644 --- a/pxr/usd/plugin/usdAbc/alembicWriter.cpp +++ b/pxr/usd/plugin/usdAbc/alembicWriter.cpp @@ -672,7 +672,7 @@ class _WriterContext { bool IsFlagSet(const TfToken& flagName) const; /// Adds/returns a time sampling. - uint32_t AddTimeSampling(const UsdAbc_TimeSamples&); + abc::uint32_t AddTimeSampling(const UsdAbc_TimeSamples&); private: // Conversion options. @@ -691,7 +691,7 @@ class _WriterContext { // duplicate time samplings. This maps a set of samples to the index // of the time sampling in the archive. Index 0 is reserved by // Alembic to mean uniform starting at 0, cycling at 1. - std::map _timeSamplings; + std::map _timeSamplings; }; _WriterContext::_WriterContext() : @@ -726,7 +726,7 @@ _WriterContext::IsFlagSet(const TfToken& flagName) const return _flags.count(flagName); } -uint32_t +abc::uint32_t _WriterContext::AddTimeSampling(const UsdAbc_TimeSamples& inSamples) { // Handle empty case. @@ -736,12 +736,12 @@ _WriterContext::AddTimeSampling(const UsdAbc_TimeSamples& inSamples) } // Get the cached index. If not zero then we already have this one. - std::map::const_iterator tsi = + std::map::const_iterator tsi = _timeSamplings.find(inSamples); if (tsi != _timeSamplings.end()) { return tsi->second; } - uint32_t& index = _timeSamplings[inSamples]; + abc::uint32_t& index = _timeSamplings[inSamples]; // Scale and offset samples. UsdAbc_TimeSamples samples; @@ -854,7 +854,7 @@ class _PrimWriterContext { bool IsFlagSet(const TfToken& flagName) const; /// Adds/returns a time sampling. - uint32_t AddTimeSampling(const UsdAbc_TimeSamples&); + abc::uint32_t AddTimeSampling(const UsdAbc_TimeSamples&); /// Returns the parent object. const Parent& GetParent() const; @@ -1001,7 +1001,7 @@ _PrimWriterContext::IsFlagSet(const TfToken& flagName) const return _context.IsFlagSet(flagName); } -uint32_t +abc::uint32_t _PrimWriterContext::AddTimeSampling(const UsdAbc_TimeSamples& samples) { return _context.AddTimeSampling(samples); @@ -1372,7 +1372,7 @@ _MakeIndexed(_SampleForAlembic* values) { // A map of values to an index. typedef _MakeIndexedValue Value; - typedef std::map IndexMap; + typedef std::map IndexMap; typedef std::pair IndexMapResult; typedef _SampleForAlembic::IndexArray IndexArray; typedef IndexArray::value_type Index; @@ -1400,7 +1400,7 @@ _MakeIndexed(_SampleForAlembic* values) // If there are enough duplicates use indexing otherwise don't. if (n * sizeof(POD[extent]) <= - unique.size() * sizeof(POD[extent]) + n * sizeof(uint32_t)) { + unique.size() * sizeof(POD[extent]) + n * sizeof(abc::uint32_t)) { return; } @@ -1710,10 +1710,10 @@ _CopyVisibility(const VtValue& src) { const TfToken& value = src.UncheckedGet(); if (value.IsEmpty() or value == UsdGeomTokens->inherited) { - return _SampleForAlembic(int8_t(kVisibilityDeferred)); + return _SampleForAlembic(abc::int8_t(kVisibilityDeferred)); } if (value == UsdGeomTokens->invisible) { - return _SampleForAlembic(int8_t(kVisibilityHidden)); + return _SampleForAlembic(abc::int8_t(kVisibilityHidden)); } return _ErrorSampleForAlembic(TfStringPrintf( "Unsupported invisibility '%s'", @@ -1745,13 +1745,13 @@ _CopyInterpolateBoundary(const VtValue& src) { const TfToken& value = src.UncheckedGet(); if (value.IsEmpty() or value == UsdGeomTokens->none) { - return _SampleForAlembic(int32_t(0)); + return _SampleForAlembic(abc::int32_t(0)); } if (value == UsdGeomTokens->edgeAndCorner) { - return _SampleForAlembic(int32_t(1)); + return _SampleForAlembic(abc::int32_t(1)); } if (value == UsdGeomTokens->edgeOnly) { - return _SampleForAlembic(int32_t(2)); + return _SampleForAlembic(abc::int32_t(2)); } return _ErrorSampleForAlembic(TfStringPrintf( "Unsupported interpolateBoundary '%s'", @@ -1764,16 +1764,16 @@ _CopyFaceVaryingInterpolateBoundary(const VtValue& src) { const TfToken& value = src.UncheckedGet(); if (value.IsEmpty() or value == UsdGeomTokens->all) { - return _SampleForAlembic(int32_t(0)); + return _SampleForAlembic(abc::int32_t(0)); } if (value == UsdGeomTokens->cornersPlus1) { - return _SampleForAlembic(int32_t(1)); + return _SampleForAlembic(abc::int32_t(1)); } if (value == UsdGeomTokens->none) { - return _SampleForAlembic(int32_t(2)); + return _SampleForAlembic(abc::int32_t(2)); } if (value == UsdGeomTokens->boundaries) { - return _SampleForAlembic(int32_t(3)); + return _SampleForAlembic(abc::int32_t(3)); } return _ErrorSampleForAlembic(TfStringPrintf( "Unsupported faceVaryingLinearInterpolation '%s'", @@ -1869,7 +1869,7 @@ _SampleForAlembic _CopyOrder(const VtValue& src) { const VtIntArray& value = src.UncheckedGet(); - return _SampleForAlembic(std::vector(value.begin(), value.end())); + return _SampleForAlembic(std::vector(value.begin(), value.end())); } static @@ -1877,7 +1877,7 @@ _SampleForAlembic _CopyPointIds(const VtValue& src) { const VtInt64Array& value = src.UncheckedGet(); - return _SampleForAlembic(std::vector(value.begin(), value.end())); + return _SampleForAlembic(std::vector(value.begin(), value.end())); } @@ -3171,7 +3171,7 @@ _WritePoints(_PrimWriterContext* context) // be reused for all the other samples. We also use a valid // but empty array because we don't actually have any data. if (first and not sample.getIds()) { - static const uint64_t data = 0; + static const abc::uint64_t data = 0; first = false; sample.setIds(UInt64ArraySample(&data, 0)); } diff --git a/pxr/usd/plugin/usdAbc/api.h b/pxr/usd/plugin/usdAbc/api.h new file mode 100644 index 0000000000..d8cb73b771 --- /dev/null +++ b/pxr/usd/plugin/usdAbc/api.h @@ -0,0 +1,45 @@ +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef USDABC_API_H +#define USDABC_API_H + +#include "pxr/base/arch/export.h" + +#if defined(USDABC_STATIC) +# define USDABC_API +# define USDABC_LOCAL +#else +# if defined(USDABC_EXPORTS) +# define USDABC_API ARCH_EXPORT +# define USDABC_API_TEMPLATE_CLASS(...) +# define USDABC_API_TEMPLATE_STRUCT(...) +# else +# define USDABC_API ARCH_IMPORT +# define USDABC_API_TEMPLATE_CLASS(...) extern template class USDABC_API __VA_ARGS__ +# define USDABC_API_TEMPLATE_STRUCT(...) extern template struct USDABC_API __VA_ARGS__ +# endif +# define USDABC_LOCAL ARCH_HIDDEN +#endif + +#endif diff --git a/third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB b/third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB new file mode 100644 index 0000000000000000000000000000000000000000..e46997bb00e2fb3053e37b9b2e5e0e69c56a82b6 GIT binary patch literal 4096 zcmWFz^vNtqRY=P(%1ta$FlG>7U}9o$P*7lCU|@t|AVoG{WYB%a%?r{lK(-m98b?E5 nGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!nC=3ArZHNZ} literal 0 HcmV?d00001 From f4944bbbdfacc864bc5951cc5432a2f663ea0b16 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 14 Sep 2016 11:45:46 +0100 Subject: [PATCH 04/20] Cleanup unncessary files. --- .../katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB | Bin 4096 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB diff --git a/third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB b/third_party/katana/plugin/vmp_usd/.vscode/.BROWSE.VC.DB deleted file mode 100644 index e46997bb00e2fb3053e37b9b2e5e0e69c56a82b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmWFz^vNtqRY=P(%1ta$FlG>7U}9o$P*7lCU|@t|AVoG{WYB%a%?r{lK(-m98b?E5 nGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!nC=3ArZHNZ} From 15b76bce18a882afe5c1049c84956f254563f455 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Thu, 15 Sep 2016 10:10:56 +0100 Subject: [PATCH 05/20] Fix crash in incorrect use of boost::regex. --- third_party/katana/lib/usdKatana/cache.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/third_party/katana/lib/usdKatana/cache.cpp b/third_party/katana/lib/usdKatana/cache.cpp index f27c19c6af..62e6621202 100644 --- a/third_party/katana/lib/usdKatana/cache.cpp +++ b/third_party/katana/lib/usdKatana/cache.cpp @@ -110,7 +110,7 @@ UsdKatanaCache::_SetMutedLayers( bool regexIsEmpty = layerRegex == "" || layerRegex == "^$"; // use a better regex library? - boost::regex regex; + boost::regex regex(layerRegex.c_str()); TF_FOR_ALL(stageLayer, stageLayers) { @@ -127,7 +127,6 @@ UsdKatanaCache::_SetMutedLayers( { if (layer && boost::regex_match( layerIdentifier.c_str(), - layerRegex.c_str(), regex)) { match = true; From 3a800b9481a9aa0eccf5cd837bcbdd17fba7e17c Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Thu, 15 Sep 2016 10:11:22 +0100 Subject: [PATCH 06/20] usdAbc now runs on Windows. --- pxr/usd/plugin/usdAbc/CMakeLists.txt | 9 +++++++-- pxr/usd/plugin/usdAbc/DllMain.cpp | 26 ++++++++++++++++++++++++++ pxr/usd/plugin/usdAbc/alembicTest.h | 4 ++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 pxr/usd/plugin/usdAbc/DllMain.cpp diff --git a/pxr/usd/plugin/usdAbc/CMakeLists.txt b/pxr/usd/plugin/usdAbc/CMakeLists.txt index a8ba94cb2d..8b7836d598 100644 --- a/pxr/usd/plugin/usdAbc/CMakeLists.txt +++ b/pxr/usd/plugin/usdAbc/CMakeLists.txt @@ -6,6 +6,10 @@ if(NOT ALEMBIC_FOUND) return() endif() +if(WIN32) + set(MODULE_ENTRYPOINT_CPP DllMain.cpp) +endif() + pxr_plugin(usdAbc LIBRARIES tf @@ -16,7 +20,7 @@ pxr_plugin(usdAbc ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${OPENEXR_Iex_LIBRARY} - ${ZLIB_LIBRARY_RELEASE} + ${ZLIB_LIBRARY_RELEASE} INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR} @@ -34,9 +38,10 @@ pxr_plugin(usdAbc PUBLIC_HEADERS api.h - + CPPFILES moduleDeps.cpp + ${MODULE_ENTRYPOINT_CPP} PYMODULE_CPPFILES module.cpp diff --git a/pxr/usd/plugin/usdAbc/DllMain.cpp b/pxr/usd/plugin/usdAbc/DllMain.cpp new file mode 100644 index 0000000000..ec9cc4d73d --- /dev/null +++ b/pxr/usd/plugin/usdAbc/DllMain.cpp @@ -0,0 +1,26 @@ +// +// Copyright 2016 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#include "pxr/base/arch/DllMain.h" + +ARCH_DLL_MAIN diff --git a/pxr/usd/plugin/usdAbc/alembicTest.h b/pxr/usd/plugin/usdAbc/alembicTest.h index 217f52e720..46415d70e4 100644 --- a/pxr/usd/plugin/usdAbc/alembicTest.h +++ b/pxr/usd/plugin/usdAbc/alembicTest.h @@ -24,12 +24,16 @@ #ifndef USDABC_ALEMBICTEST_H #define USDABC_ALEMBICTEST_H +#include "pxr/usd/usdAbc/api.h" + #include /// Test Alembic conversion. +USDABC_API bool UsdAbc_TestAlembic(const std::string& pathname); /// Read Usd file from \p srcPathname and write as Alembic to \p dstPathname. +USDABC_API bool UsdAbc_WriteAlembic(const std::string& srcPathname, const std::string& dstPathname); From bf9848988588e6c0fa7a713d6540104a09003687 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Thu, 15 Sep 2016 12:48:43 +0100 Subject: [PATCH 07/20] Allow build system to find OPENEXR's IexMath library. --- cmake/modules/FindOpenEXR.cmake | 1 + pxr/usd/plugin/usdAbc/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cmake/modules/FindOpenEXR.cmake b/cmake/modules/FindOpenEXR.cmake index 337c85a69e..a538157d8b 100644 --- a/cmake/modules/FindOpenEXR.cmake +++ b/cmake/modules/FindOpenEXR.cmake @@ -84,6 +84,7 @@ endif() foreach(OPENEXR_LIB Half Iex + IexMath Imath IlmImf IlmThread diff --git a/pxr/usd/plugin/usdAbc/CMakeLists.txt b/pxr/usd/plugin/usdAbc/CMakeLists.txt index 8b7836d598..92862cf9b5 100644 --- a/pxr/usd/plugin/usdAbc/CMakeLists.txt +++ b/pxr/usd/plugin/usdAbc/CMakeLists.txt @@ -20,6 +20,8 @@ pxr_plugin(usdAbc ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${OPENEXR_Iex_LIBRARY} + ${OPENEXR_IexMath_LIBRARY} + ${OPENEXR_Imath_LIBRARY} ${ZLIB_LIBRARY_RELEASE} INCLUDE_DIRS From d45c9da2456c5cf6f1630bb64ab1f4eb2be3231f Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Fri, 16 Sep 2016 09:19:33 +0100 Subject: [PATCH 08/20] Fix typo in BUILDING instructions. --- BUILDING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 6fade1852a..2b242f7505 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -40,13 +40,13 @@ These plugins are not built by default and must be enabled via the instructions ##### Alembic Plugin -Enable the [Alembic](https://https://github.com/alembic/alembic) plugin in the build +Enable the [Alembic](https://github.com/alembic/alembic) plugin in the build by specifying the cmake flag ```PXR_BUILD_ALEMBIC_PLUGIN=TRUE``` when invoking cmake. This plugin is compatible with Alembic 1.5.2. The additional dependencies that must be supplied when invoking cmake are: | Dependency Name | Description | Version | | ------------------ |----------------------------------------------------------------------- | ------- | -| ALEMBIC_LOCATION | The location of [Alembic](https://https://github.com/alembic/alembic) | 1.5.2 | +| ALEMBIC_LOCATION | The location of [Alembic](https://github.com/alembic/alembic) | 1.5.2 | | HDF5_LOCATION | The location of [HDF5](https://www.hdfgroup.org/HDF5/) | 1.8.11 | For further information see the documentation on the Alembic plugin [here](http://openusd.org/docs/Alembic-USD-Plugin.html). From c6ecf0b9278d47b2170d7c5ce06e43640a7bf8f4 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Fri, 16 Sep 2016 09:20:02 +0100 Subject: [PATCH 09/20] Allow Double Conversion location to be specified to CMake. --- cmake/modules/FindDoubleConversion.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/modules/FindDoubleConversion.cmake b/cmake/modules/FindDoubleConversion.cmake index ed8a806164..c10f40ee24 100644 --- a/cmake/modules/FindDoubleConversion.cmake +++ b/cmake/modules/FindDoubleConversion.cmake @@ -26,10 +26,12 @@ set(LIBRARY_PATHS /usr/local/lib /lib /lib64 + ${DOUBLE_CONVERSION_DIR}/lib ) find_path(DOUBLE_CONVERSION_INCLUDE_DIR double-conversion/double-conversion.h + PATHS ${DOUBLE_CONVERSION_DIR}/include ) find_library(DOUBLE_CONVERSION_LIBRARY From 6b4bf84bc64b03722a63fbd4acd53811a9081776 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Fri, 16 Sep 2016 09:20:21 +0100 Subject: [PATCH 10/20] Explicitly add the OpenGL headers to Glf. --- pxr/imaging/lib/glf/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pxr/imaging/lib/glf/CMakeLists.txt b/pxr/imaging/lib/glf/CMakeLists.txt index 51d5a59129..5a818b9a4a 100644 --- a/pxr/imaging/lib/glf/CMakeLists.txt +++ b/pxr/imaging/lib/glf/CMakeLists.txt @@ -38,6 +38,7 @@ pxr_shared_library(glf ${OIIO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GLEW_INCLUDE_DIR} + ${OPENGL_INCLUDE_DIR} ${PTEX_INCLUDE_DIR} PUBLIC_CLASSES From dfa906c5b269c0bb03b02feb387acbc6dbfb6e21 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Mon, 19 Sep 2016 09:40:05 +0100 Subject: [PATCH 11/20] Allow Maya to be compiled without having Maya installed. Still need the SDK though. --- cmake/modules/FindMaya.cmake | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/cmake/modules/FindMaya.cmake b/cmake/modules/FindMaya.cmake index 66d289f2e1..23a781ff2a 100644 --- a/cmake/modules/FindMaya.cmake +++ b/cmake/modules/FindMaya.cmake @@ -223,11 +223,21 @@ endif() # all listed variables are TRUE include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Maya - REQUIRED_VARS - MAYA_EXECUTABLE - MAYA_INCLUDE_DIRS - MAYA_LIBRARIES - VERSION_VAR - MAYA_API_VERSION -) +if (${PXR_MAYA_API_ONLY} AND NOT ${PXR_MAYA_API_ONLY}) + find_package_handle_standard_args(Maya + REQUIRED_VARS + MAYA_EXECUTABLE + MAYA_INCLUDE_DIRS + MAYA_LIBRARIES + VERSION_VAR + MAYA_API_VERSION + ) +else() + find_package_handle_standard_args(Maya + REQUIRED_VARS + MAYA_INCLUDE_DIRS + MAYA_LIBRARIES + VERSION_VAR + MAYA_API_VERSION + ) +endif() From 7c587b59802762359de7fad4aae5c2361c9bfef1 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Mon, 19 Sep 2016 16:00:11 +0100 Subject: [PATCH 12/20] Scope the flipping of backward to forward slash in to Ar_DefaultResolver::Ar_DefaultResolver() only. This means either slash type can be passed and relative paths will be fixed up correctly. --- .../tutorial_scripts/add_shadingVariants.py | 1 - pxr/base/lib/arch/vsnprintf.cpp | 3 +-- pxr/base/lib/plug/initConfig.cpp | 6 +++--- pxr/base/lib/tf/pathUtils.cpp | 10 +--------- pxr/base/lib/tf/pathUtils.h | 5 ----- pxr/base/lib/tf/stringUtils.cpp | 2 +- pxr/usd/lib/ar/defaultResolver.cpp | 17 ++++++++++++----- pxr/usd/lib/sdf/payload.h | 2 +- pxr/usd/lib/sdf/reference.cpp | 2 +- pxr/usd/lib/sdf/reference.h | 2 +- pxr/usd/lib/usd/stage.cpp | 4 ++-- third_party/katana/lib/usdKatana/cache.cpp | 6 +++--- third_party/maya/lib/usdMaya/query.cpp | 2 +- 13 files changed, 27 insertions(+), 35 deletions(-) diff --git a/extras/usd/tutorials/endToEnd/tutorial_scripts/add_shadingVariants.py b/extras/usd/tutorials/endToEnd/tutorial_scripts/add_shadingVariants.py index 9e8ef708d7..c06ce5f82c 100644 --- a/extras/usd/tutorials/endToEnd/tutorial_scripts/add_shadingVariants.py +++ b/extras/usd/tutorials/endToEnd/tutorial_scripts/add_shadingVariants.py @@ -93,7 +93,6 @@ def _AddShadingToBall(stage): with shadingVariant.GetVariantEditContext(): whichBall = variantName.split('_')[-1] texPath = os.path.join(texDir, 'ball%s.tex' % whichBall) - texPath = texPath.replace('\\', '/') # in the current variant, modify the color _SetParameters(ballTextureNode, [ ('filename', Sdf.ValueTypeNames.String, texPath), diff --git a/pxr/base/lib/arch/vsnprintf.cpp b/pxr/base/lib/arch/vsnprintf.cpp index 50d0714900..b6b9949a6a 100644 --- a/pxr/base/lib/arch/vsnprintf.cpp +++ b/pxr/base/lib/arch/vsnprintf.cpp @@ -53,8 +53,7 @@ int ArchVsnprintf(char *str, size_t size, const char *format, va_list ap) return n; #elif defined(ARCH_OS_WINDOWS) - int n = _vscprintf(format, ap) // _vscprintf doesn't count - + 1; // terminating '\0' + int n = _vscprintf(format, ap); if (n < size) return vsnprintf_s(str, size /*size of buffer */, n, format, ap); else diff --git a/pxr/base/lib/plug/initConfig.cpp b/pxr/base/lib/plug/initConfig.cpp index ba32e176c2..24a573dfc0 100644 --- a/pxr/base/lib/plug/initConfig.cpp +++ b/pxr/base/lib/plug/initConfig.cpp @@ -53,9 +53,9 @@ ARCH_CONSTRUCTOR_DEFINE(102, Plug_InitConfig) _AppendPathList(&result, TfGetenv(pathEnvVarName)); // Fallback locations. - _AppendPathList(&result, TfPathCanonicalize(userLocation)); - _AppendPathList(&result, TfPathCanonicalize(buildLocation)); - _AppendPathList(&result, TfPathCanonicalize(installLocation)); + _AppendPathList(&result, userLocation); + _AppendPathList(&result, buildLocation); + _AppendPathList(&result, installLocation); Plug_SetPaths(result); } diff --git a/pxr/base/lib/tf/pathUtils.cpp b/pxr/base/lib/tf/pathUtils.cpp index 74d72dacd0..ed687de97a 100644 --- a/pxr/base/lib/tf/pathUtils.cpp +++ b/pxr/base/lib/tf/pathUtils.cpp @@ -333,21 +333,13 @@ TfNormPath(string const &inPath) return path; } -string -TfPathCanonicalize(std::string const& path) -{ - std::string str = path; - std::replace(str.begin(), str.end(), '\\', '/'); - return string(str); -} - string TfAbsPath(string const& path) { #if defined(ARCH_OS_WINDOWS) char buffer[ARCH_PATH_MAX]; if (GetFullPathName(path.c_str(), ARCH_PATH_MAX, buffer, nullptr)){ - return TfPathCanonicalize(buffer); + return buffer; } else { printf("TfAbsPath failed on %s with error code %d\n", path.c_str(), GetLastError()); diff --git a/pxr/base/lib/tf/pathUtils.h b/pxr/base/lib/tf/pathUtils.h index c08189abb9..3e49ec7f4f 100644 --- a/pxr/base/lib/tf/pathUtils.h +++ b/pxr/base/lib/tf/pathUtils.h @@ -69,11 +69,6 @@ std::string TfRealPath(std::string const& path, TF_API std::string TfNormPath(std::string const& path); -/// Simplifies a path by ensuring all slashes in a path are correct for the -/// platform. -TF_API -std::string TfPathCanonicalize(std::string const& path); - /// Return the index delimiting the longest accessible prefix of \a path. /// /// The returned value is safe to use to split the string via it's generalized diff --git a/pxr/base/lib/tf/stringUtils.cpp b/pxr/base/lib/tf/stringUtils.cpp index 79fa560b0c..0d975eddb6 100644 --- a/pxr/base/lib/tf/stringUtils.cpp +++ b/pxr/base/lib/tf/stringUtils.cpp @@ -325,7 +325,7 @@ TfGetBaseName(const string& fileName) string TfGetPathName(const string& fileName) { - size_t i = fileName.rfind("/"); + size_t i = fileName.find_last_of("\\/"); if (i == string::npos) // no / in name return ""; else diff --git a/pxr/usd/lib/ar/defaultResolver.cpp b/pxr/usd/lib/ar/defaultResolver.cpp index 66f45e338a..72884c8c6e 100644 --- a/pxr/usd/lib/ar/defaultResolver.cpp +++ b/pxr/usd/lib/ar/defaultResolver.cpp @@ -64,7 +64,7 @@ struct Ar_DefaultResolver::_Cache Ar_DefaultResolver::Ar_DefaultResolver() { - _searchPath.push_back(TfPathCanonicalize(ArchGetCwd())); + _searchPath.push_back(ArchGetCwd()); const std::string envPath = TfGetenv("PXR_AR_DEFAULT_SEARCH_PATH"); if (not envPath.empty()) { @@ -109,12 +109,20 @@ Ar_DefaultResolver::AnchorRelativePath( return path; } + // Ensure we are using forward slashes and not back slashes. + std::string forwardPath = anchorPath; + std::replace(forwardPath.begin(), forwardPath.end(), '\\', '/'); + + // DebugBreak(); + // If anchorPath does not end with a '/', we assume it is specifying // a file, strip off the last component, and anchor the path to that // directory. std::string anchoredPath = TfStringCatPaths( - TfStringGetBeforeSuffix(anchorPath, '/'), path); - return TfNormPath(anchoredPath); + TfStringGetBeforeSuffix(forwardPath, '/'), path); + anchoredPath = TfNormPath(anchoredPath); + anchoredPath = TfAbsPath(anchoredPath); + return anchoredPath; } bool @@ -172,8 +180,7 @@ Ar_DefaultResolver::_ResolveNoCache(const std::string& path) if (IsRelativePath(path)) { // First try to resolve relative paths against the current // working directory. - std::string resolvedPath = _Resolve(TfPathCanonicalize(ArchGetCwd()), - path); + std::string resolvedPath = _Resolve(ArchGetCwd(), path); if (not resolvedPath.empty()) { return resolvedPath; } diff --git a/pxr/usd/lib/sdf/payload.h b/pxr/usd/lib/sdf/payload.h index c4ba28afb3..737b9f6b1a 100644 --- a/pxr/usd/lib/sdf/payload.h +++ b/pxr/usd/lib/sdf/payload.h @@ -69,7 +69,7 @@ class SdfPayload : boost::totally_ordered { /// Sets a new asset path for the layer the payload uses. void SetAssetPath(const std::string &assetPath) { - _assetPath = TfPathCanonicalize(assetPath); + _assetPath = assetPath; } /// Returns the scene path of the prim for the payload. diff --git a/pxr/usd/lib/sdf/reference.cpp b/pxr/usd/lib/sdf/reference.cpp index 59ae78387a..911bc0e784 100644 --- a/pxr/usd/lib/sdf/reference.cpp +++ b/pxr/usd/lib/sdf/reference.cpp @@ -52,7 +52,7 @@ SdfReference::SdfReference( _layerOffset(layerOffset), _customData(customData) { - _assetPath = TfPathCanonicalize(assetPath); + _assetPath = assetPath; } void diff --git a/pxr/usd/lib/sdf/reference.h b/pxr/usd/lib/sdf/reference.h index 024b7349f7..4ed77bc7f4 100644 --- a/pxr/usd/lib/sdf/reference.h +++ b/pxr/usd/lib/sdf/reference.h @@ -92,7 +92,7 @@ class SdfReference : boost::totally_ordered { /// This may be set to an empty string to specify an internal reference. /// void SetAssetPath(const std::string &assetPath) { - _assetPath = TfPathCanonicalize(assetPath); + _assetPath = assetPath; } /// Returns the path of the referenced prim. diff --git a/pxr/usd/lib/usd/stage.cpp b/pxr/usd/lib/usd/stage.cpp index 29264d8a69..5e52fab813 100644 --- a/pxr/usd/lib/usd/stage.cpp +++ b/pxr/usd/lib/usd/stage.cpp @@ -555,7 +555,7 @@ UsdStage::_InstantiateStage(const SdfLayerRefPtr &rootLayer, static SdfLayerRefPtr _CreateNewLayer(const std::string &identifier) { - std::string ident = TfPathCanonicalize(identifier); + std::string ident = identifier; TfErrorMark mark; SdfLayerRefPtr rootLayer = SdfLayer::CreateNew(ident); if (not rootLayer) { @@ -679,7 +679,7 @@ _OpenLayer( const std::string &filePath, const ArResolverContext &resolverContext = ArResolverContext()) { - std::string path = TfPathCanonicalize(filePath); + std::string path = filePath; boost::optional binder; if (not resolverContext.IsEmpty()) diff --git a/third_party/katana/lib/usdKatana/cache.cpp b/third_party/katana/lib/usdKatana/cache.cpp index 62e6621202..9291daad6d 100644 --- a/third_party/katana/lib/usdKatana/cache.cpp +++ b/third_party/katana/lib/usdKatana/cache.cpp @@ -204,7 +204,7 @@ UsdKatanaCache::GetStage(std::string const& fileName, bool givenAbsPath = !TfIsRelativePath(fileName); const std::string contextPath = givenAbsPath ? TfGetPathName(fileName) : - TfPathCanonicalize(ArchGetCwd()); + ArchGetCwd(); std::string path = not givenAbsPath ? _ResolvePath(fileName) : fileName; @@ -262,10 +262,10 @@ UsdKatanaCache::GetUncachedStage(std::string const& fileName, std::string const& ignoreLayerRegex, bool forcePopulate) { - bool givenAbsPath = TfStringStartsWith(fileName, "/"); + bool givenAbsPath = !TfIsRelativePath(fileName); const std::string contextPath = givenAbsPath ? TfGetPathName(fileName) : - TfPathCanonicalize(ArchGetCwd()); + ArchGetCwd(); std::string path = not givenAbsPath ? _ResolvePath(fileName) : fileName; diff --git a/third_party/maya/lib/usdMaya/query.cpp b/third_party/maya/lib/usdMaya/query.cpp index d85191e7bc..f31a08d702 100644 --- a/third_party/maya/lib/usdMaya/query.cpp +++ b/third_party/maya/lib/usdMaya/query.cpp @@ -83,7 +83,7 @@ PxrUsdMayaQuery::ResolvePath(const std::string &filePath) ArResolver& resolver = ArGetResolver(); ArResolverContext ctx = - resolver.CreateDefaultContextForDirectory(TfPathCanonicalize(ArchGetCwd())); + resolver.CreateDefaultContextForDirectory(ArchGetCwd()); resolver.RefreshContext(ctx); ArResolverContextBinder boundCtx(ctx); From 819b6cb0b0ae7e0b7a4f9368ad1736ad427ae17b Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Mon, 19 Sep 2016 16:14:11 +0100 Subject: [PATCH 13/20] Fixed recursive issue with Tf_MakeDirsRec() on Windows. --- pxr/base/lib/tf/fileUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/base/lib/tf/fileUtils.cpp b/pxr/base/lib/tf/fileUtils.cpp index ad036594e7..4da0348e48 100644 --- a/pxr/base/lib/tf/fileUtils.cpp +++ b/pxr/base/lib/tf/fileUtils.cpp @@ -221,7 +221,7 @@ TfMakeDir(string const& path, int mode) static bool Tf_MakeDirsRec(string const& path, int mode) { - string head = TfStringTrimRight(TfGetPathName(path), "/"); + string head = TfStringTrimRight(TfGetPathName(path), "\\/"); if (head.empty()) { return TfIsDir(path) ? true : TfMakeDir(path, mode); From 02d68c8ec259039c1d191a1266353e8a1285e04b Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Tue, 20 Sep 2016 09:51:23 +0100 Subject: [PATCH 14/20] Implemented TfReadLink on Windows. --- pxr/base/lib/tf/pathUtils.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pxr/base/lib/tf/pathUtils.cpp b/pxr/base/lib/tf/pathUtils.cpp index ed687de97a..50db4ea7f0 100644 --- a/pxr/base/lib/tf/pathUtils.cpp +++ b/pxr/base/lib/tf/pathUtils.cpp @@ -338,11 +338,14 @@ TfAbsPath(string const& path) { #if defined(ARCH_OS_WINDOWS) char buffer[ARCH_PATH_MAX]; - if (GetFullPathName(path.c_str(), ARCH_PATH_MAX, buffer, nullptr)){ + if (GetFullPathName(path.c_str(), ARCH_PATH_MAX, buffer, nullptr)) + { return buffer; - } else { - printf("TfAbsPath failed on %s with error code %d\n", - path.c_str(), GetLastError()); + } + else + { + printf("TfAbsPath failed on %s because %s\n", + path.c_str(), ArchStrSysError(GetLastError()).c_str()); return path; } #else @@ -391,7 +394,7 @@ string TfReadLink(string const& path) { #if defined(ARCH_OS_WINDOWS) - return path; + return ArchResolveSymlink(path.c_str()); #else if (path.empty()) { return path; From 688f671e14601ad7d6347ed04f3062a09a3a3054 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Tue, 20 Sep 2016 12:00:41 +0100 Subject: [PATCH 15/20] Added ArchExpandEnvironmentVariables() so we can expand environment variables in a string. --- pxr/base/lib/arch/env.cpp | 24 +++++++++++++++++++++++- pxr/base/lib/arch/env.h | 7 +++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pxr/base/lib/arch/env.cpp b/pxr/base/lib/arch/env.cpp index 00344e0e7e..30aab5aab1 100644 --- a/pxr/base/lib/arch/env.cpp +++ b/pxr/base/lib/arch/env.cpp @@ -24,6 +24,8 @@ #include "pxr/base/arch/env.h" #include "pxr/base/arch/error.h" +#include + std::string ArchGetEnv(const std::string &name) { #if defined(ARCH_OS_WINDOWS) @@ -71,4 +73,24 @@ bool ArchRemoveEnv(const std::string &name) return true; return false; -} \ No newline at end of file +} + +std::string ArchExpandEnvironmentVariables(const std::string& value) +{ + std::string str = value; + std::smatch match; +#if defined(ARCH_OS_WINDOWS) + static std::regex regex("\\%([^\\%]+)\\%"); +#else + static std::regex regex("\\$\\{([^}]+)\\}"); +#endif + + while (std::regex_search(str, match, regex)) + { + const char* env = ArchGetEnv(match[1].str()).c_str(); + const std::string var(!env ? "" : env ); + str.replace(match[0].first, match[0].second, var); + } + + return str; +} diff --git a/pxr/base/lib/arch/env.h b/pxr/base/lib/arch/env.h index de48d7ee65..0488f2c199 100644 --- a/pxr/base/lib/arch/env.h +++ b/pxr/base/lib/arch/env.h @@ -55,4 +55,11 @@ bool ArchSetEnv(const std::string &name, const std::string &value, int overwrite ARCH_API bool ArchRemoveEnv(const std::string &name); +/// +/// Expands environment variables in \c str. +/// \ingroup group_arch_SystemFunctions +/// +ARCH_API +std::string ArchExpandEnvironmentVariables(const std::string& str); + #endif // ARCH_ENV_H From 81b89e98c1dae098f1192a5b488a6819038e7b86 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Tue, 20 Sep 2016 12:01:39 +0100 Subject: [PATCH 16/20] Re-enable and fix-up a whole bunch of tests. --- pxr/base/lib/arch/CMakeLists.txt | 270 +++--- pxr/base/lib/arch/nap.cpp | 34 +- pxr/base/lib/arch/nap.h | 10 + pxr/base/lib/arch/testArchAbi.h | 1 - pxr/base/lib/arch/testenv/testArchAbi.cpp | 2 +- pxr/base/lib/gf/CMakeLists.txt | 254 +++--- pxr/base/lib/js/CMakeLists.txt | 171 ++-- pxr/base/lib/js/testenv/testJsIO.cpp | 4 +- pxr/base/lib/plug/CMakeLists.txt | 183 ++-- pxr/base/lib/tf/CMakeLists.txt | 823 +++++++++--------- pxr/base/lib/tf/testenv/SIGSEGV.cpp | 5 +- .../lib/tf/testenv/registryManagerUnload.cpp | 4 +- .../lib/tf/testenv/testTfPyInterpreter.cpp | 2 +- pxr/base/lib/work/CMakeLists.txt | 91 +- .../lib/work/testenv/testWorkDispatcher.cpp | 6 +- 15 files changed, 955 insertions(+), 905 deletions(-) diff --git a/pxr/base/lib/arch/CMakeLists.txt b/pxr/base/lib/arch/CMakeLists.txt index 44f8095818..133a4ed0e0 100644 --- a/pxr/base/lib/arch/CMakeLists.txt +++ b/pxr/base/lib/arch/CMakeLists.txt @@ -65,139 +65,141 @@ pxr_shared_library(arch library.cpp ) +pxr_build_test_shared_lib(testArchAbiPlugin + CPPFILES + testenv/testArchAbiPlugin.cpp +) +pxr_build_test(testArchAbi + LIBRARIES + arch + CPPFILES + testenv/testArchAbi.cpp +) + if(UNIX) - pxr_build_test_shared_lib(testArchAbiPlugin - CPPFILES - testenv/testArchAbiPlugin.cpp - ) - pxr_build_test(testArchAbi - LIBRARIES - arch - CPPFILES - testenv/testArchAbi.cpp - ) - pxr_build_test(testArchAttributes - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testAttributes.cpp - ) - pxr_build_test(testArchDemangle - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testDemangle.cpp - ) - pxr_build_test(testArchError - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testError.cpp - ) - pxr_build_test(testArchErrno - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testErrno.cpp - ) - pxr_build_test(testArchFileSystem - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testFileSystem.cpp - ) - pxr_build_test(testArchFunction - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testFunction.cpp - ) - pxr_build_test(testArchStackTrace - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testStackTrace.cpp - ) - pxr_build_test(testArchSymbols - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testSymbols.cpp - ) - pxr_build_test(testArchSystemInfo - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testSystemInfo.cpp - ) - pxr_build_test(testArchThreads - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testThreads.cpp - ) - pxr_build_test(testArchTiming - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testTiming.cpp - ) - pxr_build_test(testArchVsnprintf - LIBRARIES - arch - ${CMAKE_DL_LIBS} - CPPFILES - testenv/testVsnprintf.cpp - ) + pxr_build_test(testArchAttributes + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testAttributes.cpp + ) +endif() - pxr_register_test(testArchAbi - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchAbi" - ) - pxr_register_test(testArchAttributes - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchAttributes" - ) - pxr_register_test(testArchDemangle - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchDemangle" - ) - pxr_register_test(testArchError - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchError" - ) - pxr_register_test(testArchErrno - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchErrno" - ) - pxr_register_test(testArchFileSystem - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchFileSystem" - ) - pxr_register_test(testArchFunction - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchFunction" - ) - pxr_register_test(testArchStackTrace - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchStackTrace" - ) - pxr_register_test(testArchSymbols - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchSymbols" - ) - pxr_register_test(testArchSystemInfo - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchSystemInfo" - ) - pxr_register_test(testArchTiming - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchTiming" - ) - pxr_register_test(testArchThreads - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchThreads" - ) - pxr_register_test(testArchVsnprintf - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchVsnprintf" - ) -endif() \ No newline at end of file +pxr_build_test(testArchDemangle + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testDemangle.cpp +) +pxr_build_test(testArchError + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testError.cpp +) +pxr_build_test(testArchErrno + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testErrno.cpp +) +pxr_build_test(testArchFileSystem + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testFileSystem.cpp +) +pxr_build_test(testArchFunction + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testFunction.cpp +) +pxr_build_test(testArchStackTrace + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testStackTrace.cpp +) +pxr_build_test(testArchSymbols + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testSymbols.cpp +) +pxr_build_test(testArchSystemInfo + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testSystemInfo.cpp +) +pxr_build_test(testArchThreads + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testThreads.cpp +) +pxr_build_test(testArchTiming + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testTiming.cpp +) +pxr_build_test(testArchVsnprintf + LIBRARIES + arch + ${CMAKE_DL_LIBS} + CPPFILES + testenv/testVsnprintf.cpp +) + +pxr_register_test(testArchAbi + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchAbi" +) +pxr_register_test(testArchAttributes + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchAttributes" +) +pxr_register_test(testArchDemangle + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchDemangle" +) +pxr_register_test(testArchError + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchError" +) +pxr_register_test(testArchErrno + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchErrno" +) +pxr_register_test(testArchFileSystem + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchFileSystem" +) +pxr_register_test(testArchFunction + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchFunction" +) +pxr_register_test(testArchStackTrace + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchStackTrace" +) +pxr_register_test(testArchSymbols + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchSymbols" +) +pxr_register_test(testArchSystemInfo + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchSystemInfo" +) +pxr_register_test(testArchTiming + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchTiming" +) +pxr_register_test(testArchThreads + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchThreads" +) +pxr_register_test(testArchVsnprintf + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testArchVsnprintf" +) diff --git a/pxr/base/lib/arch/nap.cpp b/pxr/base/lib/arch/nap.cpp index e8923ba9ea..dbd542ded0 100644 --- a/pxr/base/lib/arch/nap.cpp +++ b/pxr/base/lib/arch/nap.cpp @@ -23,10 +23,10 @@ // #include "pxr/base/arch/nap.h" #include "pxr/base/arch/defines.h" +#include #if defined(ARCH_OS_WINDOWS) #include #elif defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) -#include #include #include #else @@ -61,6 +61,38 @@ ArchNap(size_t hundredths) #endif } +void ArchSleep(uint64_t seconds) +{ +#if defined(ARCH_OS_WINDOWS) + Sleep(seconds / 1000); +#else + sleep(seconds); +#endif +} + +int ArchNanoSleep(const struct timespec *req, struct timespec *rem) +{ +#if defined(ARCH_OS_WINDOWS) + HANDLE timer; + if(!(timer = CreateWaitableTimer(NULL, TRUE, NULL))) + return 0; + + LARGE_INTEGER sleepTime; + sleepTime.QuadPart = req->tv_sec * 1000000000 + req->tv_nsec / 100; + if(!SetWaitableTimer(timer, &sleepTime, 0, NULL, NULL, FALSE)) + { + CloseHandle(timer); + return 0; + } + + WaitForSingleObject(timer, INFINITE); + CloseHandle(timer); + return 0; +#else + return nanosleep(usec); +#endif +} + void ArchThreadYield() { diff --git a/pxr/base/lib/arch/nap.h b/pxr/base/lib/arch/nap.h index e1ac7f404e..8d3ddf1d01 100644 --- a/pxr/base/lib/arch/nap.h +++ b/pxr/base/lib/arch/nap.h @@ -45,6 +45,16 @@ /// sginap()). Call \c ArchThreadYield() instead. ARCH_API void ArchNap(size_t nhundredths); +/// Suspends the execution of the current thread until the time-out interval +/// elapses. +ARCH_API +void ArchSleep(uint64_t seconds); + +/// Suspends the execution of the current thread until the time-out interval +/// elapses. +ARCH_API +int ArchNanoSleep(const struct timespec *req, struct timespec *rem); + /// Yield to the operating system thread scheduler. /// /// Returns control to the operating system thread scheduler as a means of diff --git a/pxr/base/lib/arch/testArchAbi.h b/pxr/base/lib/arch/testArchAbi.h index 783445cac8..209aed05c1 100644 --- a/pxr/base/lib/arch/testArchAbi.h +++ b/pxr/base/lib/arch/testArchAbi.h @@ -21,7 +21,6 @@ // KIND, either express or implied. See the Apache License for the specific // language governing permissions and limitations under the Apache License. // -#if defined(_WIN32) #include "pxr/base/arch/defines.h" #if defined(ARCH_OS_WINDOWS) diff --git a/pxr/base/lib/arch/testenv/testArchAbi.cpp b/pxr/base/lib/arch/testenv/testArchAbi.cpp index 9ac0cbf883..aab4aa9af6 100644 --- a/pxr/base/lib/arch/testenv/testArchAbi.cpp +++ b/pxr/base/lib/arch/testenv/testArchAbi.cpp @@ -46,7 +46,7 @@ main(int argc, char** argv) // Load the plugin and get the factory function. std::string error; #ifdef ARCH_OS_WINDOWS - HMODULE plugin = (HMODULE)ArchOpenLibrary(".\\libtestArchAbiPlugin.dll", ARCH_LIBRARY_LAZY); + HMODULE plugin = (HMODULE)ArchLibraryOpen(".\\libtestArchAbiPlugin.dll", ARCH_LIBRARY_LAZY); if (not plugin) { error = ArchStringPrintf("%ld", (long)GetLastError()); } diff --git a/pxr/base/lib/gf/CMakeLists.txt b/pxr/base/lib/gf/CMakeLists.txt index ffd9044d98..cf8027c162 100644 --- a/pxr/base/lib/gf/CMakeLists.txt +++ b/pxr/base/lib/gf/CMakeLists.txt @@ -157,133 +157,131 @@ else() ) endif() -if(UNIX) - pxr_build_test(testGfHardToReach - LIBRARIES - gf - CPPFILES - testenv/testGfHardToReach.cpp - ) +pxr_build_test(testGfHardToReach + LIBRARIES + gf + CPPFILES + testenv/testGfHardToReach.cpp +) - pxr_test_scripts( - testenv/testGfBBox3d.py - testenv/testGfCamera.py - testenv/testGfColorRamp.py - testenv/testGfDecomposeRotation.py - testenv/testGfFrustum.py - testenv/testGfGamma.py - testenv/testGfHomogeneous.py - testenv/testGfInterval.py - testenv/testGfLine.py - testenv/testGfLineSeg.py - testenv/testGfMath.py - testenv/testGfMatrix.py - testenv/testGfMultiInterval.py - testenv/testGfPlane.py - testenv/testGfQuaternion.py - testenv/testGfRange.py - testenv/testGfRay.py - testenv/testGfRect2i.py - testenv/testGfRGB.py - testenv/testGfRotation.py - testenv/testGfSize.py - testenv/testGfTransform.py - testenv/testGfVec.py - ) +pxr_test_scripts( + testenv/testGfBBox3d.py + testenv/testGfCamera.py + testenv/testGfColorRamp.py + testenv/testGfDecomposeRotation.py + testenv/testGfFrustum.py + testenv/testGfGamma.py + testenv/testGfHomogeneous.py + testenv/testGfInterval.py + testenv/testGfLine.py + testenv/testGfLineSeg.py + testenv/testGfMath.py + testenv/testGfMatrix.py + testenv/testGfMultiInterval.py + testenv/testGfPlane.py + testenv/testGfQuaternion.py + testenv/testGfRange.py + testenv/testGfRay.py + testenv/testGfRect2i.py + testenv/testGfRGB.py + testenv/testGfRotation.py + testenv/testGfSize.py + testenv/testGfTransform.py + testenv/testGfVec.py +) - pxr_register_test(testGfBBox3d - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfBBox3d" - ) - pxr_register_test(testGfColorRamp - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfColorRamp" - ) - pxr_register_test(testGfDecomposeRotation - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfDecomposeRotation" - ) - pxr_register_test(testGfFrustum - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfFrustum" - ) - pxr_register_test(testGfGamma - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfGamma" - ) - pxr_register_test(testGfHardToReach - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfHardToReach" - ) - pxr_register_test(testGfHomogeneous - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfHomogeneous" - ) - pxr_register_test(testGfInterval - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfInterval" - ) - pxr_register_test(testGfMultiInterval - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMultiInterval" - ) - pxr_register_test(testGfLine - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfLine" - ) - pxr_register_test(testGfLineSeg - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfLineSeg" - ) - pxr_register_test(testGfMath - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMath" - ) - pxr_register_test(testGfMatrix - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMatrix" - ) - pxr_register_test(testGfPlane - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfPlane" - ) - pxr_register_test(testGfQuaternion - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfQuaternion" - ) - pxr_register_test(testGfRange - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRange" - ) - pxr_register_test(testGfRay - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRay" - ) - pxr_register_test(testGfRect2i - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRect2i" - ) - pxr_register_test(testGfRGB - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRGB" - ) - pxr_register_test(testGfRotation - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRotation" - ) - pxr_register_test(testGfSize - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfSize" - ) - pxr_register_test(testGfTransform - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfTransform" - ) - pxr_register_test(testGfVec - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfVec" - ) - pxr_register_test(testGfCamera - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfCamera" - ) -endif() \ No newline at end of file +pxr_register_test(testGfBBox3d + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfBBox3d" +) +pxr_register_test(testGfColorRamp + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfColorRamp" +) +pxr_register_test(testGfDecomposeRotation + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfDecomposeRotation" +) +pxr_register_test(testGfFrustum + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfFrustum" +) +pxr_register_test(testGfGamma + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfGamma" +) +pxr_register_test(testGfHardToReach + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfHardToReach" +) +pxr_register_test(testGfHomogeneous + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfHomogeneous" +) +pxr_register_test(testGfInterval + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfInterval" +) +pxr_register_test(testGfMultiInterval + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMultiInterval" +) +pxr_register_test(testGfLine + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfLine" +) +pxr_register_test(testGfLineSeg + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfLineSeg" +) +pxr_register_test(testGfMath + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMath" +) +pxr_register_test(testGfMatrix + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfMatrix" +) +pxr_register_test(testGfPlane + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfPlane" +) +pxr_register_test(testGfQuaternion + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfQuaternion" +) +pxr_register_test(testGfRange + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRange" +) +pxr_register_test(testGfRay + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRay" +) +pxr_register_test(testGfRect2i + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRect2i" +) +pxr_register_test(testGfRGB + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRGB" +) +pxr_register_test(testGfRotation + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfRotation" +) +pxr_register_test(testGfSize + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfSize" +) +pxr_register_test(testGfTransform + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfTransform" +) +pxr_register_test(testGfVec + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfVec" +) +pxr_register_test(testGfCamera + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testGfCamera" +) diff --git a/pxr/base/lib/js/CMakeLists.txt b/pxr/base/lib/js/CMakeLists.txt index e6c20a1a2a..432d2d1197 100644 --- a/pxr/base/lib/js/CMakeLists.txt +++ b/pxr/base/lib/js/CMakeLists.txt @@ -16,87 +16,92 @@ pxr_shared_library(js types.h ) -if(UNIX) - pxr_build_test(testJsIO - LIBRARIES - tf - js - CPPFILES - testenv/testJsIO.cpp - ) - pxr_build_test(testJsConverter - LIBRARIES - tf - js - CPPFILES - testenv/testJsConverter.cpp - ) - pxr_build_test(testJsUtils - LIBRARIES - tf - js - CPPFILES - testenv/testJsUtils.cpp - ) - pxr_install_test_dir( - SRC testenv/testJsIO - DEST testJsIO - ) - pxr_install_test_dir( - SRC testenv/testJsIO_Errors - DEST testJsIO_Errors - ) - pxr_install_test_dir( - SRC testenv/testJsConverter - DEST testJsConverter - ) - pxr_register_test(testJsIO_PlugInfo - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsIO plugInfo.json.in plugInfo.json" - TESTENV - testJsIO - DIFF_COMPARE - plugInfo.json - ) - pxr_register_test(testJsIO_Values - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsIO values.json.in values.json" - TESTENV - testJsIO - DIFF_COMPARE - values.json - ) - pxr_register_test(testJsIO_Errors_BadCommaPlacement - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsIO bad-commaPlacement.json -" - TESTENV - testJsIO_Errors - EXPECTED_RETURN_CODE - 2 - STDERR_REDIRECT - testJsIO_Errors-Run1-stderr.txt - DIFF_COMPARE - testJsIO_Errors-Run1-stderr.txt - ) - pxr_register_test(testJsIO_Errors_MismatchedBraces - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsIO bad-mismatchedBraces.json -" - TESTENV - testJsIO_Errors - EXPECTED_RETURN_CODE - 2 - STDERR_REDIRECT - testJsIO_Errors-Run2-stderr.txt - DIFF_COMPARE - testJsIO_Errors-Run2-stderr.txt - ) - pxr_register_test(testJsConverter - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsConverter" - ) - pxr_register_test(testJsUtils - COMMAND - "${CMAKE_INSTALL_PREFIX}/tests/testJsUtils" - ) -endif() \ No newline at end of file +pxr_build_test(testJsIO + LIBRARIES + tf + js + CPPFILES + testenv/testJsIO.cpp +) + +if (UNIX) + pxr_build_test(testJsConverter + LIBRARIES + tf + js + CPPFILES + testenv/testJsConverter.cpp + ) +endif() +pxr_build_test(testJsUtils + LIBRARIES + tf + js + CPPFILES + testenv/testJsUtils.cpp +) +pxr_install_test_dir( + SRC testenv/testJsIO + DEST testJsIO +) +pxr_install_test_dir( + SRC testenv/testJsIO_Errors + DEST testJsIO_Errors +) +pxr_install_test_dir( + SRC testenv/testJsConverter + DEST testJsConverter +) + +pxr_register_test(testJsIO_PlugInfo + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsIO plugInfo.json.in plugInfo.json" + TESTENV + testJsIO + DIFF_COMPARE + plugInfo.json +) +pxr_register_test(testJsIO_Values + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsIO values.json.in values.json" + TESTENV + testJsIO + DIFF_COMPARE + values.json +) +pxr_register_test(testJsIO_Errors_BadCommaPlacement + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsIO bad-commaPlacement.json -" + TESTENV + testJsIO_Errors + EXPECTED_RETURN_CODE + 2 + STDERR_REDIRECT + testJsIO_Errors-Run1-stderr.txt + DIFF_COMPARE + testJsIO_Errors-Run1-stderr.txt +) +pxr_register_test(testJsIO_Errors_MismatchedBraces + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsIO bad-mismatchedBraces.json -" + TESTENV + testJsIO_Errors + EXPECTED_RETURN_CODE + 2 + STDERR_REDIRECT + testJsIO_Errors-Run2-stderr.txt + DIFF_COMPARE + testJsIO_Errors-Run2-stderr.txt +) +if (UNIX) + pxr_register_test(testJsConverter + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsConverter" + ) +endif() + +pxr_register_test(testJsUtils + COMMAND + "${CMAKE_INSTALL_PREFIX}/tests/testJsUtils" +) diff --git a/pxr/base/lib/js/testenv/testJsIO.cpp b/pxr/base/lib/js/testenv/testJsIO.cpp index 4d1e10c636..3505498eb8 100644 --- a/pxr/base/lib/js/testenv/testJsIO.cpp +++ b/pxr/base/lib/js/testenv/testJsIO.cpp @@ -36,7 +36,7 @@ int main(int argc, char const *argv[]) } std::ifstream ifs(argv[1]); - if (not ifs) { + if (!ifs) { fprintf(stderr, "Error: failed to open input file '%s'", argv[1]); return 2; } @@ -54,7 +54,7 @@ int main(int argc, char const *argv[]) JsWriteToStream(value, std::cout); } else { std::ofstream ofs(argv[2]); - if (not ofs) { + if (!ofs) { fprintf(stderr, "Error: failed to open output file '%s'", argv[2]); return 2; } diff --git a/pxr/base/lib/plug/CMakeLists.txt b/pxr/base/lib/plug/CMakeLists.txt index e965fd4376..e31296e3c3 100644 --- a/pxr/base/lib/plug/CMakeLists.txt +++ b/pxr/base/lib/plug/CMakeLists.txt @@ -46,104 +46,103 @@ pxr_shared_library(plug __init__.py ) -if(UNIX) - pxr_test_scripts( - testPlug.py - ) - pxr_build_test_shared_lib(TestPlugDso1 - CREATE_FRAMEWORK - LIBRARIES - tf - CPPFILES - testenv/TestPlugDso1.cpp - ) - pxr_build_test_shared_lib(TestPlugDso2 - LIBRARIES - tf - CPPFILES - testenv/TestPlugDso2.cpp - ) - pxr_build_test_shared_lib(TestPlugDso3 - LIBRARIES - tf - CPPFILES - testenv/TestPlugDso3.cpp - ) - pxr_build_test_shared_lib(TestPlugDsoEmpty - LIBRARIES - tf - CPPFILES - testenv/TestPlugDsoEmpty.cpp - ) - pxr_build_test_shared_lib(TestPlugDsoIncomplete - LIBRARIES - tf - CPPFILES - testenv/TestPlugDsoIncomplete.cpp - ) - pxr_build_test_shared_lib(TestPlugDsoUnloadable - LIBRARIES - tf - CPPFILES - testenv/TestPlugDsoUnloadable.cpp - ) +pxr_test_scripts( + testPlug.py +) + +pxr_build_test_shared_lib(TestPlugDso1 + CREATE_FRAMEWORK + LIBRARIES + tf + CPPFILES + testenv/TestPlugDso1.cpp +) +pxr_build_test_shared_lib(TestPlugDso2 + LIBRARIES + tf + CPPFILES + testenv/TestPlugDso2.cpp +) +pxr_build_test_shared_lib(TestPlugDso3 + LIBRARIES + tf + CPPFILES + testenv/TestPlugDso3.cpp +) +pxr_build_test_shared_lib(TestPlugDsoEmpty + LIBRARIES + tf + CPPFILES + testenv/TestPlugDsoEmpty.cpp +) +pxr_build_test_shared_lib(TestPlugDsoIncomplete + LIBRARIES + tf + CPPFILES + testenv/TestPlugDsoIncomplete.cpp +) +pxr_build_test_shared_lib(TestPlugDsoUnloadable + LIBRARIES + tf + CPPFILES + testenv/TestPlugDsoUnloadable.cpp +) # This library helps test behavior when a plugin is unloadable, # but clang by default will error out when building this due to # the references to undefined symbols. So we need to specify a # link flag to force these symbols to be looked up at runtime. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_target_properties(TestPlugDsoUnloadable - PROPERTIES - LINK_FLAGS "-undefined dynamic_lookup" - ) +set_target_properties(TestPlugDsoUnloadable + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup" +) endif() - pxr_create_test_module(TestPlugModule1 - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModule2 - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModule3 - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleEmpty - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleLoaded - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleLoadedBadBase - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleUnloadable - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleUnloadable2 - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleDepBadBase - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleDepBadDep - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleDepBadDep2 - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleDepBadLoad - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleDepCycle - INSTALL_PREFIX PlugPlugins - ) - pxr_create_test_module(TestPlugModuleIncomplete - INSTALL_PREFIX PlugPlugins - ) +pxr_create_test_module(TestPlugModule1 + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModule2 + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModule3 + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleEmpty + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleLoaded + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleLoadedBadBase + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleUnloadable + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleUnloadable2 + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleDepBadBase + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleDepBadDep + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleDepBadDep2 + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleDepBadLoad + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleDepCycle + INSTALL_PREFIX PlugPlugins +) +pxr_create_test_module(TestPlugModuleIncomplete + INSTALL_PREFIX PlugPlugins +) - pxr_register_test(testPlug - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPlug" - ) -endif() \ No newline at end of file +pxr_register_test(testPlug + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPlug" +) diff --git a/pxr/base/lib/tf/CMakeLists.txt b/pxr/base/lib/tf/CMakeLists.txt index b18cbe286e..4be7d7988a 100644 --- a/pxr/base/lib/tf/CMakeLists.txt +++ b/pxr/base/lib/tf/CMakeLists.txt @@ -202,425 +202,424 @@ pxr_shared_library(tf testenv/testTfScriptModuleLoader_Unknown.py ) -if(UNIX) - pxr_build_test(testTfPyInterpreter - LIBRARIES - tf - CPPFILES - testenv/testTfPyInterpreter.cpp - ) - pxr_build_test(testTfPyLock - LIBRARIES - tf - ${Boost_PYTHON_LIBRARY} - CPPFILES - testenv/testTfPyLock.cpp - ) +pxr_build_test(testTfPyInterpreter + LIBRARIES + tf + CPPFILES + testenv/testTfPyInterpreter.cpp +) - pxr_build_test(testTfSIGFPE - LIBRARIES - tf - CPPFILES - testenv/SIGFPE.cpp - ) +pxr_build_test(testTfPyLock + LIBRARIES + tf + ${Boost_PYTHON_LIBRARY} + CPPFILES + testenv/testTfPyLock.cpp +) - pxr_build_test(testTfSIGSEGV - LIBRARIES - tf - CPPFILES - testenv/SIGSEGV.cpp - ) +pxr_build_test(testTfSIGFPE + LIBRARIES + tf + CPPFILES + testenv/SIGFPE.cpp +) - pxr_build_test_shared_lib(TestTfDl - CPPFILES - testenv/TestTfDl.cpp - ) +pxr_build_test(testTfSIGSEGV + LIBRARIES + tf + CPPFILES + testenv/SIGSEGV.cpp +) - pxr_build_test_shared_lib(TestTfRegistryFunctionPlugin - LIBRARIES - tf - CPPFILES - testenv/TestTfRegistryFunctionPlugin.cpp - ) +pxr_build_test_shared_lib(TestTfDl + CPPFILES + testenv/TestTfDl.cpp +) + +pxr_build_test_shared_lib(TestTfRegistryFunctionPlugin + LIBRARIES + tf + CPPFILES + testenv/TestTfRegistryFunctionPlugin.cpp +) - pxr_build_test(testTfCast - LIBRARIES - tf - CPPFILES - testenv/testTfCast.cpp - ) +pxr_build_test(testTfCast + LIBRARIES + tf + CPPFILES + testenv/testTfCast.cpp +) - pxr_build_test(testTf - LIBRARIES - tf - CPPFILES - testenv/main.cpp - testenv/atomicOfstreamWrapper.cpp - testenv/bitUtils.cpp - testenv/debug.cpp - testenv/denseHashMap.cpp - testenv/diagnosticNotices.cpp - testenv/dl.cpp - testenv/enum.cpp - testenv/error.cpp - testenv/envSetting.cpp - testenv/fileUtils.cpp - testenv/getenv.cpp - testenv/hash.cpp - testenv/iterator.cpp - testenv/mallocTag.cpp - testenv/notice.cpp - testenv/pathUtils.cpp - testenv/patternMatcher.cpp - testenv/pointerAndBits.cpp - testenv/preprocessorUtils.cpp - testenv/probe.cpp - testenv/refPtr.cpp - testenv/registryManager.cpp - testenv/registryManagerUnload.cpp - testenv/scoped.cpp - testenv/scopeDescription.cpp - testenv/setenv.cpp - testenv/stacked.cpp - testenv/staticData.cpp - testenv/stl.cpp - testenv/stopwatch.cpp - testenv/stringUtils.cpp - testenv/staticTokens.cpp - testenv/templateString.cpp - testenv/timeStamp.cpp - testenv/token.cpp - testenv/type.cpp - testenv/typeMultipleInheritance.cpp - testenv/typeInfoMap.cpp - testenv/weakPtr.cpp - ) +pxr_build_test(testTf + LIBRARIES + tf + CPPFILES + testenv/main.cpp + testenv/atomicOfstreamWrapper.cpp + testenv/bitUtils.cpp + testenv/debug.cpp + testenv/denseHashMap.cpp + testenv/diagnosticNotices.cpp + testenv/dl.cpp + testenv/enum.cpp + testenv/error.cpp + testenv/envSetting.cpp + testenv/fileUtils.cpp + testenv/getenv.cpp + testenv/hash.cpp + testenv/iterator.cpp + testenv/mallocTag.cpp + testenv/notice.cpp + testenv/pathUtils.cpp + testenv/patternMatcher.cpp + testenv/pointerAndBits.cpp + testenv/preprocessorUtils.cpp + testenv/probe.cpp + testenv/refPtr.cpp + testenv/registryManager.cpp + testenv/registryManagerUnload.cpp + testenv/scoped.cpp + testenv/scopeDescription.cpp + testenv/setenv.cpp + testenv/stacked.cpp + testenv/staticData.cpp + testenv/stl.cpp + testenv/stopwatch.cpp + testenv/stringUtils.cpp + testenv/staticTokens.cpp + testenv/templateString.cpp + testenv/timeStamp.cpp + testenv/token.cpp + testenv/type.cpp + testenv/typeMultipleInheritance.cpp + testenv/typeInfoMap.cpp + testenv/weakPtr.cpp +) - pxr_test_scripts( - testenv/testTfCrashHandler.py - testenv/testTfFileUtils.py - testenv/testTfPathUtils.py - testenv/testTfPython.py - testenv/testTfPyDateTime.py - testenv/testTfPyNotice.py - testenv/testTfPyDiagnosticNotices.py - testenv/testTfPyOptional.py - testenv/testTfPyScopeDescription.py - testenv/testTfPyStaticTokens.py - testenv/testTfScriptModuleLoader.py - testenv/testTfStringUtils.py - testenv/testTfTemplateString.py - testenv/testTfType.py - testenv/testTf_PyContainerConversions.py - ) +pxr_test_scripts( + testenv/testTfCrashHandler.py + testenv/testTfFileUtils.py + testenv/testTfPathUtils.py + testenv/testTfPython.py + testenv/testTfPyDateTime.py + testenv/testTfPyNotice.py + testenv/testTfPyDiagnosticNotices.py + testenv/testTfPyOptional.py + testenv/testTfPyScopeDescription.py + testenv/testTfPyStaticTokens.py + testenv/testTfScriptModuleLoader.py + testenv/testTfStringUtils.py + testenv/testTfTemplateString.py + testenv/testTfType.py + testenv/testTf_PyContainerConversions.py +) - pxr_install_test_dir( - SRC testenv/baseline/TfDebug - DEST TfDebug/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfDebugTestEnv - DEST TfDebugTestEnv/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfDebugTestEnvList - DEST TfDebugTestEnvList/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfDiagnosticNotice_Fatal - DEST TfDiagnosticNotice_Fatal/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfDiagnosticNotices - DEST TfDiagnosticNotices/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfDiagnosticNotices_python - DEST TfDiagnosticNotices_Python/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfEnum - DEST TfEnum/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfEnvSetting - DEST TfEnvSetting/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/TfNotice - DEST TfNotice/baseline - ) - pxr_install_test_dir( - SRC testenv/baseline/testTfScriptModuleLoader - DEST testTfScriptModuleLoader/baseline - ) +pxr_install_test_dir( + SRC testenv/baseline/TfDebug + DEST TfDebug/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfDebugTestEnv + DEST TfDebugTestEnv/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfDebugTestEnvList + DEST TfDebugTestEnvList/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfDiagnosticNotice_Fatal + DEST TfDiagnosticNotice_Fatal/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfDiagnosticNotices + DEST TfDiagnosticNotices/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfDiagnosticNotices_python + DEST TfDiagnosticNotices_Python/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfEnum + DEST TfEnum/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfEnvSetting + DEST TfEnvSetting/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/TfNotice + DEST TfNotice/baseline +) +pxr_install_test_dir( + SRC testenv/baseline/testTfScriptModuleLoader + DEST testTfScriptModuleLoader/baseline +) - pxr_register_test(TfAtomicOfstreamWrapper - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfAtomicOfstreamWrapper" - ) - pxr_register_test(TfBitUtils - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfBitUtils" - ) - pxr_register_test(TfDl - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDl" - ) - pxr_register_test(TfDebug - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebug" - STDOUT_REDIRECT debug.out - DIFF_COMPARE debug.out - ) - pxr_register_test(TfDebugFatal_1 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_1" - EXPECTED_RETURN_CODE 134 - ) - pxr_register_test(TfDebugFatal_2 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_2" - EXPECTED_RETURN_CODE 134 - ) - pxr_register_test(TfDebugFatal_3 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_3" - EXPECTED_RETURN_CODE 134 - ) - pxr_register_test(TfDebugFatal_4 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_4" - EXPECTED_RETURN_CODE 134 - ) - pxr_register_test(TfDebugTestEnv - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnv" - ENV TF_DEBUG="FOO* FLAM_* FLAM -FOOFLIMFLAM TF_DISCOVERY_D*" - STDOUT_REDIRECT debugTestEnv.out - DIFF_COMPARE debugTestEnv.out - ) - pxr_register_test(TfDebugTestEnvHelp - ENV TF_DEBUG=help - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnvHelp" - ) - pxr_register_test(TfDebugTestEnvList - ENV TF_DEBUG=list - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnvList" - STDOUT_REDIRECT debugTestEnvList.out - DIFF_COMPARE debugTestEnvList.out - ) - pxr_register_test(TfDenseHashMap - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDenseHashMap" - ) - pxr_register_test(TfError - ENV TF_FATAL_VERIFY=0 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfError" - ) - pxr_register_test(TfErrorThreadTransport - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfErrorThreadTransport" - ) - pxr_register_test(TfDiagnosticNotices - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDiagnosticNotices" - DIFF_COMPARE output.txt - ) - pxr_register_test(TfDiagnosticNotice_Fatal - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDiagnosticNotice_Fatal" - EXPECTED_RETURN_CODE 134 - DIFF_COMPARE output_fatal.txt - ) - pxr_register_test(TfDiagnosticNotices_Python - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyDiagnosticNotices" - DIFF_COMPARE pyDiagnosticNoticeOutput.txt - ) - pxr_register_test(TfEnvSetting - ENV - TF_TEST_BOOL_ENV_SETTING=1 - TF_TEST_INT_ENV_SETTING=123 - TF_TEST_STRING_ENV_SETTING=alpha - TF_ENV_SETTING_ALERTS_ENABLED=0 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfEnvSetting" - STDERR_REDIRECT debugTfEnvSettingStderr.txt - DIFF_COMPARE debugTfEnvSettingStderr.txt - ) - pxr_register_test(TfFileUtils - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfFileUtils" - ) - pxr_register_test(TfFileUtils_Python - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfFileUtils" - ) - pxr_register_test(TfStringUtils_Python - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfStringUtils" - ) - pxr_register_test(TfGetenv - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfGetenv" - ) - pxr_register_test(TfHash - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfHash" - ) - pxr_register_test(TfIterator - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfIterator" - ) - pxr_register_test(TfMallocTag - ENV GLIBCXX_FORCE_NEW=1 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfMallocTag" - ) - pxr_register_test(TfRefPtr - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRefPtr" - ) - pxr_register_test(TfEnum - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfEnum" - STDOUT_REDIRECT enum.out - DIFF_COMPARE enum.out - ) - pxr_register_test(TfNotice - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfNotice" - STDOUT_REDIRECT notice.out - DIFF_COMPARE notice.out - ) - pxr_register_test(TfPathUtils - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPathUtils" - ) - pxr_register_test(TfPathUtils_Python - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPathUtils" - ) - pxr_register_test(TfPatternMatcher - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPatternMatcher" - ) - pxr_register_test(TfPointerAndBits - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPointerAndBits" - ) - pxr_register_test(TfPreprocessorUtils - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPreprocessorUtils" - ) - pxr_register_test(TfProbe - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfProbe" - ) - pxr_register_test(TfRegistryManager - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRegistryManager" - ) - pxr_register_test(TfRegistryManagerUnload - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRegistryManagerUnload" - ) - pxr_register_test(TfRegTest - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf" - EXPECTED_RETURN_CODE 2 - ) - pxr_register_test(TfRegTest_TfScoped - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScoped no args expected" - EXPECTED_RETURN_CODE 2 - ) - pxr_register_test(TfRegTest_TfUndefinedTest - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfUndefinedTest" - EXPECTED_RETURN_CODE 3 - ) - pxr_register_test(TfScopeDescription - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScopeDescription" - ) - pxr_register_test(TfScoped - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScoped" - ) - pxr_register_test(TfScopedVar - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScopedVar" - ) - pxr_register_test(TfSetenv - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfSetenv" - ) - pxr_register_test(TfStacked - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStacked" - ) - pxr_register_test(TfStaticData - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStaticData" - ) - pxr_register_test(TfStaticTokens - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStaticTokens" - ) - pxr_register_test(TfStl - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStl" - ) - pxr_register_test(TfStopwatch - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStopwatch" - ) - pxr_register_test(TfStringUtils - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStringUtils" - ) - pxr_register_test(TfTemplateString - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTemplateString" - ) - pxr_register_test(testTfTemplateString - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfTemplateString" - ) - pxr_register_test(TfTimeStamp - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTimeStamp" - ) - pxr_register_test(TfToken - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfToken" - ) - pxr_register_test(TfType - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfType" - ) - pxr_register_test(TfTypeInfoMap - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTypeInfoMap" - ) - pxr_register_test(TfType_MultipleInheritance - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfType_MultipleInheritance" - ) - pxr_register_test(TfWeakPtr - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfWeakPtr" - ) - pxr_register_test(TfWeakPtrConversion - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfWeakPtrConversion" - ) - pxr_register_test(testTfPython - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPython" - ) - pxr_register_test(testTfPyNotice - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyNotice" - ) - pxr_register_test(testTfPyInterpreter - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyInterpreter" - ) - pxr_register_test(testTfPyLock - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyLock" - ) - pxr_register_test(testTfPyScopeDescription - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyScopeDescription" - ) - pxr_register_test(testTfScriptModuleLoader - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfScriptModuleLoader" - STDOUT_REDIRECT scriptModuleLoader.out - DIFF_COMPARE scriptModuleLoader.out - ) - pxr_register_test(testTfType - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfType" - ) - pxr_register_test(testTfSIGSEGV - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCrashHandler ${CMAKE_INSTALL_PREFIX}/tests/testTfSIGSEGV SIGSEGV" - ) - pxr_register_test(testTfSIGFPE - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCrashHandler ${CMAKE_INSTALL_PREFIX}/tests/testTfSIGFPE SIGFPE" - ) - pxr_register_test(testTf_PyContainerConversions - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf_PyContainerConversions" - ) - pxr_register_test(testTf_PyOptional - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyOptional" - ) - pxr_register_test(testTf_PyDateTime - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyDateTime" - ) - pxr_register_test(testTf_PyStaticTokens - PYTHON - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyStaticTokens" - ) - pxr_register_test(testTfCxxCast - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCast" - ) -endif() \ No newline at end of file +pxr_register_test(TfAtomicOfstreamWrapper + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfAtomicOfstreamWrapper" +) +pxr_register_test(TfBitUtils + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfBitUtils" +) +pxr_register_test(TfDl + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDl" +) +pxr_register_test(TfDebug + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebug" + STDOUT_REDIRECT debug.out + DIFF_COMPARE debug.out +) +pxr_register_test(TfDebugFatal_1 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_1" + EXPECTED_RETURN_CODE 134 +) +pxr_register_test(TfDebugFatal_2 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_2" + EXPECTED_RETURN_CODE 134 +) +pxr_register_test(TfDebugFatal_3 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_3" + EXPECTED_RETURN_CODE 134 +) +pxr_register_test(TfDebugFatal_4 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugFatal_4" + EXPECTED_RETURN_CODE 134 +) +pxr_register_test(TfDebugTestEnv + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnv" + ENV TF_DEBUG="FOO* FLAM_* FLAM -FOOFLIMFLAM TF_DISCOVERY_D*" + STDOUT_REDIRECT debugTestEnv.out + DIFF_COMPARE debugTestEnv.out +) +pxr_register_test(TfDebugTestEnvHelp + ENV TF_DEBUG=help + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnvHelp" +) +pxr_register_test(TfDebugTestEnvList + ENV TF_DEBUG=list + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDebugTestEnvList" + STDOUT_REDIRECT debugTestEnvList.out + DIFF_COMPARE debugTestEnvList.out +) +pxr_register_test(TfDenseHashMap + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDenseHashMap" +) +pxr_register_test(TfError + ENV TF_FATAL_VERIFY=0 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfError" +) +pxr_register_test(TfErrorThreadTransport + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfErrorThreadTransport" +) +pxr_register_test(TfDiagnosticNotices + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDiagnosticNotices" + DIFF_COMPARE output.txt +) +pxr_register_test(TfDiagnosticNotice_Fatal + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfDiagnosticNotice_Fatal" + EXPECTED_RETURN_CODE 134 + DIFF_COMPARE output_fatal.txt +) +pxr_register_test(TfDiagnosticNotices_Python + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyDiagnosticNotices" + DIFF_COMPARE pyDiagnosticNoticeOutput.txt +) +pxr_register_test(TfEnvSetting + ENV + TF_TEST_BOOL_ENV_SETTING=1 + TF_TEST_INT_ENV_SETTING=123 + TF_TEST_STRING_ENV_SETTING=alpha + TF_ENV_SETTING_ALERTS_ENABLED=0 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfEnvSetting" + STDERR_REDIRECT debugTfEnvSettingStderr.txt + DIFF_COMPARE debugTfEnvSettingStderr.txt +) +pxr_register_test(TfFileUtils + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfFileUtils" +) +pxr_register_test(TfFileUtils_Python + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfFileUtils" +) +pxr_register_test(TfStringUtils_Python + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfStringUtils" +) +pxr_register_test(TfGetenv + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfGetenv" +) +pxr_register_test(TfHash + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfHash" +) +pxr_register_test(TfIterator + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfIterator" +) +pxr_register_test(TfMallocTag + ENV GLIBCXX_FORCE_NEW=1 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfMallocTag" +) +pxr_register_test(TfRefPtr + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRefPtr" +) +pxr_register_test(TfEnum + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfEnum" + STDOUT_REDIRECT enum.out + DIFF_COMPARE enum.out +) +pxr_register_test(TfNotice + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfNotice" + STDOUT_REDIRECT notice.out + DIFF_COMPARE notice.out +) +pxr_register_test(TfPathUtils + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPathUtils" +) +pxr_register_test(TfPathUtils_Python + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPathUtils" +) +pxr_register_test(TfPatternMatcher + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPatternMatcher" +) +pxr_register_test(TfPointerAndBits + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPointerAndBits" +) +pxr_register_test(TfPreprocessorUtils + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfPreprocessorUtils" +) +pxr_register_test(TfProbe + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfProbe" +) +pxr_register_test(TfRegistryManager + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRegistryManager" +) +pxr_register_test(TfRegistryManagerUnload + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfRegistryManagerUnload" +) +pxr_register_test(TfRegTest + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf" + EXPECTED_RETURN_CODE 2 +) +pxr_register_test(TfRegTest_TfScoped + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScoped no args expected" + EXPECTED_RETURN_CODE 2 +) +pxr_register_test(TfRegTest_TfUndefinedTest + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfUndefinedTest" + EXPECTED_RETURN_CODE 3 +) +pxr_register_test(TfScopeDescription + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScopeDescription" +) +pxr_register_test(TfScoped + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScoped" +) +pxr_register_test(TfScopedVar + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfScopedVar" +) +pxr_register_test(TfSetenv + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfSetenv" +) +pxr_register_test(TfStacked + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStacked" +) +pxr_register_test(TfStaticData + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStaticData" +) +pxr_register_test(TfStaticTokens + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStaticTokens" +) +pxr_register_test(TfStl + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStl" +) +pxr_register_test(TfStopwatch + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStopwatch" +) +pxr_register_test(TfStringUtils + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfStringUtils" +) +pxr_register_test(TfTemplateString + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTemplateString" +) +pxr_register_test(testTfTemplateString + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfTemplateString" +) +pxr_register_test(TfTimeStamp + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTimeStamp" +) +pxr_register_test(TfToken + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfToken" +) +pxr_register_test(TfType + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfType" +) +pxr_register_test(TfTypeInfoMap + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfTypeInfoMap" +) +pxr_register_test(TfType_MultipleInheritance + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfType_MultipleInheritance" +) +pxr_register_test(TfWeakPtr + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfWeakPtr" +) +pxr_register_test(TfWeakPtrConversion + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf TfWeakPtrConversion" +) +pxr_register_test(testTfPython + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPython" +) +pxr_register_test(testTfPyNotice + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyNotice" +) +pxr_register_test(testTfPyInterpreter + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyInterpreter" +) +pxr_register_test(testTfPyLock + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyLock" +) +pxr_register_test(testTfPyScopeDescription + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyScopeDescription" +) +pxr_register_test(testTfScriptModuleLoader + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfScriptModuleLoader" + STDOUT_REDIRECT scriptModuleLoader.out + DIFF_COMPARE scriptModuleLoader.out +) +pxr_register_test(testTfType + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfType" +) +pxr_register_test(testTfSIGSEGV + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCrashHandler ${CMAKE_INSTALL_PREFIX}/tests/testTfSIGSEGV SIGSEGV" +) +pxr_register_test(testTfSIGFPE + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCrashHandler ${CMAKE_INSTALL_PREFIX}/tests/testTfSIGFPE SIGFPE" +) +pxr_register_test(testTf_PyContainerConversions + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTf_PyContainerConversions" +) +pxr_register_test(testTf_PyOptional + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyOptional" +) +pxr_register_test(testTf_PyDateTime + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyDateTime" +) +pxr_register_test(testTf_PyStaticTokens + PYTHON + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfPyStaticTokens" +) +pxr_register_test(testTfCxxCast + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testTfCast" +) diff --git a/pxr/base/lib/tf/testenv/SIGSEGV.cpp b/pxr/base/lib/tf/testenv/SIGSEGV.cpp index 587ddeaf4b..2e6d821bf8 100644 --- a/pxr/base/lib/tf/testenv/SIGSEGV.cpp +++ b/pxr/base/lib/tf/testenv/SIGSEGV.cpp @@ -22,6 +22,7 @@ // language governing permissions and limitations under the Apache License. // #include "pxr/base/tf/errorMark.h" +#include "pxr/base/arch/nap.h" #include "pxr/base/arch/stackTrace.h" #include @@ -38,7 +39,7 @@ _ThreadTask() { TfErrorMark m; TF_RUNTIME_ERROR("Pending secondary thread error for crash report!"); - sleep(600); // 10 minutes. + ArchSleep(600); // 10 minutes. } int @@ -52,7 +53,7 @@ main(int argc, char **argv) std::thread t(_ThreadTask); - sleep(1); + ArchSleep(1); int* bunk(0); std::cout << *bunk << '\n'; diff --git a/pxr/base/lib/tf/testenv/registryManagerUnload.cpp b/pxr/base/lib/tf/testenv/registryManagerUnload.cpp index af829b1dd5..8e599d4c2c 100644 --- a/pxr/base/lib/tf/testenv/registryManagerUnload.cpp +++ b/pxr/base/lib/tf/testenv/registryManagerUnload.cpp @@ -28,6 +28,8 @@ #include "pxr/base/tf/registryManager.h" #include "pxr/base/tf/stringUtils.h" #include "pxr/base/arch/symbols.h" +#include "pxr/base/arch/fileSystem.h" +#include "pxr/base/arch/library.h" // Registry function tag type class Tf_TestRegistryFunctionPlugin {}; @@ -36,7 +38,7 @@ static void _LoadAndUnloadSharedLibrary(const std::string & libraryPath) { std::string dlErrorMsg; - void * handle = TfDlopen(libraryPath.c_str(), RTLD_NOW, &dlErrorMsg); + void * handle = TfDlopen(libraryPath.c_str(), ARCH_LIBRARY_NOW, &dlErrorMsg); TF_AXIOM(handle); TF_AXIOM(dlErrorMsg.empty()); TF_AXIOM(not TfDlclose(handle)); diff --git a/pxr/base/lib/tf/testenv/testTfPyInterpreter.cpp b/pxr/base/lib/tf/testenv/testTfPyInterpreter.cpp index c5ec843d8b..0c0bd1da89 100644 --- a/pxr/base/lib/tf/testenv/testTfPyInterpreter.cpp +++ b/pxr/base/lib/tf/testenv/testTfPyInterpreter.cpp @@ -73,7 +73,7 @@ testInterpreter(bool verbose) } modPath = TfPyGetModulePath("badmodule"); - if (not modPath.empty()) { + if (!modPath.empty()) { printf("ERROR: TfPyGetModulePath, bad module name returned result '%s'.\n", modPath.c_str()); numErrors++; } else if (verbose) { diff --git a/pxr/base/lib/work/CMakeLists.txt b/pxr/base/lib/work/CMakeLists.txt index 5ac5632a2b..fdab58d510 100644 --- a/pxr/base/lib/work/CMakeLists.txt +++ b/pxr/base/lib/work/CMakeLists.txt @@ -34,47 +34,50 @@ pxr_shared_library(work __init__.py ) -if(UNIX) - pxr_build_test(testWorkDispatcher - LIBRARIES - work - CPPFILES - testenv/testWorkDispatcher.cpp - ) - pxr_build_test(testWorkLoops - LIBRARIES - work - CPPFILES - testenv/testWorkLoops.cpp - ) - pxr_build_test(testWorkThreadLimits - LIBRARIES - work - CPPFILES - testenv/testWorkThreadLimits.cpp - ) - pxr_register_test(testWorkDispatcher - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkDispatcher" - ) - pxr_register_test(testWorkLoops - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkLoops" - ) - pxr_register_test(testWorkThreadLimitsDefault - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" - ) - pxr_register_test(testWorkThreadLimits1 - ENV PXR_WORK_THREAD_LIMIT=1 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" - ) - pxr_register_test(testWorkThreadLimits3 - ENV PXR_WORK_THREAD_LIMIT=3 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" - ) - pxr_register_test(testWorkThreadLimitsRawTBBMax - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits --rawtbb" - ) - pxr_register_test(testWorkThreadLimitsRawTBB2 - ENV PXR_WORK_THREAD_LIMIT=2 - COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits --rawtbb" - ) -endif() \ No newline at end of file + +pxr_build_test(testWorkDispatcher + LIBRARIES + work + CPPFILES + testenv/testWorkDispatcher.cpp +) +pxr_build_test(testWorkLoops + LIBRARIES + work + CPPFILES + testenv/testWorkLoops.cpp +) + +if (${CMAKE_HAVE_PTHREAD_H}) + pxr_build_test(testWorkThreadLimits + LIBRARIES + work + CPPFILES + testenv/testWorkThreadLimits.cpp + ) +endif() + +pxr_register_test(testWorkDispatcher + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkDispatcher" +) +pxr_register_test(testWorkLoops + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkLoops" +) +pxr_register_test(testWorkThreadLimitsDefault + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" +) +pxr_register_test(testWorkThreadLimits1 + ENV PXR_WORK_THREAD_LIMIT=1 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" +) +pxr_register_test(testWorkThreadLimits3 + ENV PXR_WORK_THREAD_LIMIT=3 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits" +) +pxr_register_test(testWorkThreadLimitsRawTBBMax + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits --rawtbb" +) +pxr_register_test(testWorkThreadLimitsRawTBB2 + ENV PXR_WORK_THREAD_LIMIT=2 + COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testWorkThreadLimits --rawtbb" +) \ No newline at end of file diff --git a/pxr/base/lib/work/testenv/testWorkDispatcher.cpp b/pxr/base/lib/work/testenv/testWorkDispatcher.cpp index 3f9aff66d7..62e7a27721 100644 --- a/pxr/base/lib/work/testenv/testWorkDispatcher.cpp +++ b/pxr/base/lib/work/testenv/testWorkDispatcher.cpp @@ -27,7 +27,7 @@ #include "pxr/base/tf/iterator.h" #include "pxr/base/tf/poolAllocator.h" #include "pxr/base/tf/stopwatch.h" - +#include "pxr/base/arch/nap.h" #include #include @@ -381,7 +381,7 @@ static bool _DelayedGraphTask(Graph *graph) { std::cout << "\tSleeping..." << std::endl; - sleep(2); + ArchSleep(2); return _TestDispatcher(graph); } @@ -401,7 +401,7 @@ _TestDispatcherCancellation(Graph *graph) DispatcherType parentDispatcher; parentDispatcher.Run(&_DelayedGraphTask, graph); - sleep(1); + ArchSleep(1); std::cout << "\tCancelling..." << std::endl; parentDispatcher.Cancel(); parentDispatcher.Wait(); From 0392753ab463a100338c24f34cd3d03203b8ba3f Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Tue, 20 Sep 2016 12:57:01 +0100 Subject: [PATCH 17/20] Disable a few more tests for the time being. --- pxr/base/lib/plug/CMakeLists.txt | 16 ++++-- pxr/base/lib/tf/CMakeLists.txt | 92 +++++++++++++++--------------- pxr/usd/lib/ar/defaultResolver.cpp | 2 - 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/pxr/base/lib/plug/CMakeLists.txt b/pxr/base/lib/plug/CMakeLists.txt index e31296e3c3..6067316b16 100644 --- a/pxr/base/lib/plug/CMakeLists.txt +++ b/pxr/base/lib/plug/CMakeLists.txt @@ -82,12 +82,16 @@ pxr_build_test_shared_lib(TestPlugDsoIncomplete CPPFILES testenv/TestPlugDsoIncomplete.cpp ) -pxr_build_test_shared_lib(TestPlugDsoUnloadable - LIBRARIES - tf - CPPFILES - testenv/TestPlugDsoUnloadable.cpp -) + +if (UNIX) + pxr_build_test_shared_lib(TestPlugDsoUnloadable + LIBRARIES + tf + CPPFILES + testenv/TestPlugDsoUnloadable.cpp + ) +endif() + # This library helps test behavior when a plugin is unloadable, # but clang by default will error out when building this due to # the references to undefined symbols. So we need to specify a diff --git a/pxr/base/lib/tf/CMakeLists.txt b/pxr/base/lib/tf/CMakeLists.txt index 4be7d7988a..a849decb78 100644 --- a/pxr/base/lib/tf/CMakeLists.txt +++ b/pxr/base/lib/tf/CMakeLists.txt @@ -251,51 +251,53 @@ pxr_build_test(testTfCast testenv/testTfCast.cpp ) -pxr_build_test(testTf - LIBRARIES - tf - CPPFILES - testenv/main.cpp - testenv/atomicOfstreamWrapper.cpp - testenv/bitUtils.cpp - testenv/debug.cpp - testenv/denseHashMap.cpp - testenv/diagnosticNotices.cpp - testenv/dl.cpp - testenv/enum.cpp - testenv/error.cpp - testenv/envSetting.cpp - testenv/fileUtils.cpp - testenv/getenv.cpp - testenv/hash.cpp - testenv/iterator.cpp - testenv/mallocTag.cpp - testenv/notice.cpp - testenv/pathUtils.cpp - testenv/patternMatcher.cpp - testenv/pointerAndBits.cpp - testenv/preprocessorUtils.cpp - testenv/probe.cpp - testenv/refPtr.cpp - testenv/registryManager.cpp - testenv/registryManagerUnload.cpp - testenv/scoped.cpp - testenv/scopeDescription.cpp - testenv/setenv.cpp - testenv/stacked.cpp - testenv/staticData.cpp - testenv/stl.cpp - testenv/stopwatch.cpp - testenv/stringUtils.cpp - testenv/staticTokens.cpp - testenv/templateString.cpp - testenv/timeStamp.cpp - testenv/token.cpp - testenv/type.cpp - testenv/typeMultipleInheritance.cpp - testenv/typeInfoMap.cpp - testenv/weakPtr.cpp -) +if (UNIX) + pxr_build_test(testTf + LIBRARIES + tf + CPPFILES + testenv/main.cpp + testenv/atomicOfstreamWrapper.cpp + testenv/bitUtils.cpp + testenv/debug.cpp + testenv/denseHashMap.cpp + testenv/diagnosticNotices.cpp + testenv/dl.cpp + testenv/enum.cpp + testenv/error.cpp + testenv/envSetting.cpp + testenv/fileUtils.cpp + testenv/getenv.cpp + testenv/hash.cpp + testenv/iterator.cpp + testenv/mallocTag.cpp + testenv/notice.cpp + testenv/pathUtils.cpp + testenv/patternMatcher.cpp + testenv/pointerAndBits.cpp + testenv/preprocessorUtils.cpp + testenv/probe.cpp + testenv/refPtr.cpp + testenv/registryManager.cpp + testenv/registryManagerUnload.cpp + testenv/scoped.cpp + testenv/scopeDescription.cpp + testenv/setenv.cpp + testenv/stacked.cpp + testenv/staticData.cpp + testenv/stl.cpp + testenv/stopwatch.cpp + testenv/stringUtils.cpp + testenv/staticTokens.cpp + testenv/templateString.cpp + testenv/timeStamp.cpp + testenv/token.cpp + testenv/type.cpp + testenv/typeMultipleInheritance.cpp + testenv/typeInfoMap.cpp + testenv/weakPtr.cpp + ) +endif() pxr_test_scripts( testenv/testTfCrashHandler.py diff --git a/pxr/usd/lib/ar/defaultResolver.cpp b/pxr/usd/lib/ar/defaultResolver.cpp index 72884c8c6e..0c21a7c900 100644 --- a/pxr/usd/lib/ar/defaultResolver.cpp +++ b/pxr/usd/lib/ar/defaultResolver.cpp @@ -113,8 +113,6 @@ Ar_DefaultResolver::AnchorRelativePath( std::string forwardPath = anchorPath; std::replace(forwardPath.begin(), forwardPath.end(), '\\', '/'); - // DebugBreak(); - // If anchorPath does not end with a '/', we assume it is specifying // a file, strip off the last component, and anchor the path to that // directory. From 95c7e43cec58653141867713162be2c73bfdfcd3 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 21 Sep 2016 17:18:39 +0100 Subject: [PATCH 18/20] Adding dllexport to some functions missed by the tests. --- pxr/base/lib/tf/debug.h | 3 +++ pxr/base/lib/tf/diagnosticMgr.h | 1 + pxr/base/lib/tf/dl.h | 2 ++ pxr/base/lib/tf/enum.h | 1 + pxr/base/lib/tf/fileUtils.h | 4 ++++ pxr/base/lib/tf/getenv.h | 2 ++ pxr/base/lib/tf/notice.h | 3 +++ pxr/base/lib/tf/noticeRegistry.h | 3 ++- pxr/base/lib/tf/pyUtils.h | 8 ++++++++ pxr/base/lib/tf/regTest.h | 5 +++++ pxr/base/lib/tf/setenv.h | 3 +++ pxr/base/lib/tf/token.h | 2 +- pxr/base/lib/vt/dictionary.h | 4 ++-- pxr/usd/lib/sdf/fileFormat.h | 4 ++++ pxr/usd/lib/usd/usdFileFormat.h | 7 +++++++ 15 files changed, 48 insertions(+), 4 deletions(-) diff --git a/pxr/base/lib/tf/debug.h b/pxr/base/lib/tf/debug.h index d9749bc11e..f6516ccedc 100644 --- a/pxr/base/lib/tf/debug.h +++ b/pxr/base/lib/tf/debug.h @@ -385,8 +385,11 @@ class TfDebug { TF_API static void _ComplainAboutInvalidSymbol(const char*); + TF_API static void _SetNodes(_Node* ptr, size_t nNodes, bool state); + TF_API static void _SetParentChild(_Node* parent, _Node* child); + TF_API static void _ScopedOutput(bool start, const char* str); }; diff --git a/pxr/base/lib/tf/diagnosticMgr.h b/pxr/base/lib/tf/diagnosticMgr.h index 11c05f3168..1de74827ff 100644 --- a/pxr/base/lib/tf/diagnosticMgr.h +++ b/pxr/base/lib/tf/diagnosticMgr.h @@ -156,6 +156,7 @@ class TfDiagnosticMgr: public TfWeakBase { /// Remove error specified by iterator \p i. /// \deprecated Use TfErrorMark insetad. + TF_API ErrorIterator EraseError(ErrorIterator i); /// Remove all the errors in [first, last) from this thread's error diff --git a/pxr/base/lib/tf/dl.h b/pxr/base/lib/tf/dl.h index 1a1897b6ec..965a4cc427 100644 --- a/pxr/base/lib/tf/dl.h +++ b/pxr/base/lib/tf/dl.h @@ -62,8 +62,10 @@ TF_API int TfDlclose(void* handle); /// \private +TF_API bool Tf_DlOpenIsActive(); /// \private +TF_API bool Tf_DlCloseIsActive(); ///@} diff --git a/pxr/base/lib/tf/enum.h b/pxr/base/lib/tf/enum.h index d55a35fe31..b2afb1b9e2 100644 --- a/pxr/base/lib/tf/enum.h +++ b/pxr/base/lib/tf/enum.h @@ -391,6 +391,7 @@ class TfEnum : boost::totally_ordered { } + TF_API void _FatalGetValueError(std::type_info const& typeInfo) const; const std::type_info* _typeInfo; diff --git a/pxr/base/lib/tf/fileUtils.h b/pxr/base/lib/tf/fileUtils.h index 81fc97873e..4becd437a3 100644 --- a/pxr/base/lib/tf/fileUtils.h +++ b/pxr/base/lib/tf/fileUtils.h @@ -75,6 +75,7 @@ TF_API bool TfIsDirEmpty(std::string const& path); /// Creates a symbolic link from \p src to \p dst. +TF_API bool TfSymlink(std::string const& src, std::string const& dst); /// Deletes a file at path. @@ -127,6 +128,7 @@ typedef boost::function::GetInstance(); } @@ -247,6 +248,6 @@ class Tf_NoticeRegistry : boost::noncopyable { tbb::enumerable_thread_specific _perThreadBlockCount; }; -TF_API_TEMPLATE_CLASS(TfSingleton); +TF_API_TEMPLATE_CLASS(TfSingleton); #endif diff --git a/pxr/base/lib/tf/pyUtils.h b/pxr/base/lib/tf/pyUtils.h index 61c59c3f57..fac81dd5ae 100644 --- a/pxr/base/lib/tf/pyUtils.h +++ b/pxr/base/lib/tf/pyUtils.h @@ -153,6 +153,7 @@ std::string TfPyRepr(const std::vector &v) { /// Evaluate python expression \a expr with all the known script modules /// imported under their standard names. Additional globals may be provided in /// the \p extraGlobals dictionary. +TF_API boost::python::object TfPyEvaluate( std::string const &expr, @@ -213,6 +214,7 @@ TfPyWrapOnce(boost::function const &wrapFunc) /// infrastructure code to load python wrapper modules corresponding to C++ /// shared libraries when they are needed. It should generally not need to be /// called from normal user code. +TF_API void Tf_PyLoadScriptModule(std::string const &name); /// Creates a python dictionary from a std::map. @@ -244,15 +246,18 @@ boost::python::tuple TfPyCopySequenceToTuple(Seq const &seq) { /// /// The vector contains the same strings that python's traceback.format_stack() /// returns. +TF_API std::vector TfPyGetTraceback(); /// Populates the vector passed in with pointers to strings containing the /// python interpreter stack frames. /// Note that TfPyGetStackFrames allocates these strings on the heap and its /// the caller's responsibility to free them. +TF_API void TfPyGetStackFrames(std::vector *frames); /// Print the current python traceback to stdout. +TF_API void TfPyDumpTraceback(); /// Set an environment variable in \c os.environ. @@ -276,6 +281,7 @@ void TfPyDumpTraceback(); /// os.environ to be poputated. All modifications to the environment after \c /// os has been imported must be made with this function or \c TfSetenv if it /// important that they appear in \c os.environ. +TF_API bool TfPySetenv(const std::string & name, const std::string & value); /// Remove an environment variable from \c os.environ. @@ -300,6 +306,7 @@ bool TfPySetenv(const std::string & name, const std::string & value); /// os.environ to be poputated. All modifications to the environment after \c /// os has been imported must be made with this function or \c TfUnsetenv if /// it important that they appear in \c os.environ. +TF_API bool TfPyUnsetenv(const std::string & name); // Private helper method to TfPyEvaluateAndExtract. @@ -340,6 +347,7 @@ bool TfPyEvaluateAndExtract(const std::string & expr, T * t) /// Print a standard traceback to sys.stderr and clear the error indicator. /// If the error is a KeyboardInterrupt then this does nothing. Call this /// function only when the error indicator is set. +TF_API void TfPyPrintError(); #endif // TF_PYUTILS_H diff --git a/pxr/base/lib/tf/regTest.h b/pxr/base/lib/tf/regTest.h index ac2da70dd7..c99374d6f1 100644 --- a/pxr/base/lib/tf/regTest.h +++ b/pxr/base/lib/tf/regTest.h @@ -28,6 +28,7 @@ /// \ingroup group_tf_Internal /// Support for simple regression tests. +#include "pxr/base/tf/api.h" #include "pxr/base/tf/singleton.h" #include "pxr/base/tf/hash.h" #include "pxr/base/tf/hashmap.h" @@ -102,6 +103,7 @@ class TfRegTest { return GetInstance()._Main(argc, argv); } + TF_API static TfRegTest& GetInstance(); /// Type of a function with no arguments. @@ -114,11 +116,14 @@ class TfRegTest { /// and \c argv+1. typedef bool (*RegFuncWithArgs)(int argc, char *argv[]); + TF_API bool Register(const char* name, RegFunc); + TF_API bool Register(const char* name, RegFuncWithArgs); private: friend class TfSingleton; + TF_API int _Main(int argc, char *argv[]); void _PrintTestNames(); diff --git a/pxr/base/lib/tf/setenv.h b/pxr/base/lib/tf/setenv.h index 91c07c4a36..6b97c54804 100644 --- a/pxr/base/lib/tf/setenv.h +++ b/pxr/base/lib/tf/setenv.h @@ -28,6 +28,7 @@ /// \ingroup group_tf_SystemsExt /// Functions for setting and unsetting environment variables +#include "pxr/base/tf/api.h" #include /// Set an environment variable. @@ -42,6 +43,7 @@ /// Otherwise, the return value is true. /// /// \ingroup group_tf_SystemsExt +TF_API bool TfSetenv(const std::string& envName, const std::string& value); /// Unset an environment variable. @@ -56,6 +58,7 @@ bool TfSetenv(const std::string& envName, const std::string& value); /// Otherwise, the return value is true. /// /// \ingroup group_tf_SystemsExt +TF_API bool TfUnsetenv(const std::string& envName); #endif // TF_SETENV_H diff --git a/pxr/base/lib/tf/token.h b/pxr/base/lib/tf/token.h index 2e14de8700..007d2babf0 100644 --- a/pxr/base/lib/tf/token.h +++ b/pxr/base/lib/tf/token.h @@ -390,7 +390,7 @@ TF_API std::vector TfToTokenVector(const std::vector &sv); /// Convert the vector of \c TfToken \p tv into a vector of strings -std::vector +TF_API std::vector TfToStringVector(const std::vector &tv); /// Overload hash_value for TfToken. diff --git a/pxr/base/lib/vt/dictionary.h b/pxr/base/lib/vt/dictionary.h index 080c94d437..65e9a2cd58 100644 --- a/pxr/base/lib/vt/dictionary.h +++ b/pxr/base/lib/vt/dictionary.h @@ -596,13 +596,13 @@ VT_API std::ostream& VtDictionaryPrettyPrint( /// Reads a text file at the specified \p fpath, evaluates its content string /// as a python dictionary and returns it as a VtDictionary. -VtDictionary VtDictionaryFromFile( +VT_API VtDictionary VtDictionaryFromFile( const std::string& fpath); /// Pretty prints the specified VtDictionary \p vtdict as a python dictionary /// and saves the formatted string in a file at the specified \p fpath. /// The pprint module is used to format the dictionary. -bool VtDictionaryPrettyPrintToFile( +VT_API bool VtDictionaryPrettyPrintToFile( const VtDictionary& vtdict, const std::string& fpath); diff --git a/pxr/usd/lib/sdf/fileFormat.h b/pxr/usd/lib/sdf/fileFormat.h index 9aee73d6a4..76f8d9e2f5 100644 --- a/pxr/usd/lib/sdf/fileFormat.h +++ b/pxr/usd/lib/sdf/fileFormat.h @@ -167,6 +167,7 @@ class SdfFileFormat : public TfRefBase, public TfWeakBase, boost::noncopyable /// content is successfully written, this method returns true. Otherwise, /// false is returned and errors are posted. The default implementation /// returns false. + SDF_API virtual bool WriteToFile( const SdfLayerBase* layerBase, const std::string& filePath, @@ -176,11 +177,13 @@ class SdfFileFormat : public TfRefBase, public TfWeakBase, boost::noncopyable /// Reads data in the string \p str into the layer \p layerBase. If /// the file is successfully read, this method returns true. Otherwise, /// false is returned and errors are posted. + SDF_API virtual bool ReadFromString( const SdfLayerBasePtr& layerBase, const std::string& str) const; /// Write the provided \p spec to \p out indented \p indent levels. + SDF_API virtual bool WriteToStream( const SdfSpecHandle &spec, std::ostream& out, @@ -189,6 +192,7 @@ class SdfFileFormat : public TfRefBase, public TfWeakBase, boost::noncopyable /// Writes the content in \p layerBase to the string \p str. This function /// should write a textual representation of \p layerBase to the stream /// that can be read back in via ReadFromString. + SDF_API virtual bool WriteToString( const SdfLayerBase* layerBase, std::string* str, diff --git a/pxr/usd/lib/usd/usdFileFormat.h b/pxr/usd/lib/usd/usdFileFormat.h index 368608e645..9be1a81f1f 100644 --- a/pxr/usd/lib/usd/usdFileFormat.h +++ b/pxr/usd/lib/usd/usdFileFormat.h @@ -59,31 +59,38 @@ class UsdUsdFileFormat : public SdfFileFormat public: using SdfFileFormat::FileFormatArguments; + USD_API virtual SdfAbstractDataRefPtr InitData(const FileFormatArguments& args) const; + USD_API virtual bool CanRead(const std::string &file) const; + USD_API virtual bool ReadFromFile( const SdfLayerBasePtr& layerBase, const std::string& filePath, bool metadataOnly) const; + USD_API virtual bool WriteToFile( const SdfLayerBase* layerBase, const std::string& filePath, const std::string& comment = std::string(), const FileFormatArguments& args = FileFormatArguments()) const; + USD_API virtual bool ReadFromString( const SdfLayerBasePtr& layerBase, const std::string& str) const; + USD_API virtual bool WriteToString( const SdfLayerBase* layerBase, std::string* str, const std::string& comment = std::string()) const; + USD_API virtual bool WriteToStream( const SdfSpecHandle &spec, std::ostream& out, From 875835e77aba35a4f725dca549b604cdc6db8e46 Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 21 Sep 2016 17:21:15 +0100 Subject: [PATCH 19/20] Allow source files in plugins to have a __FILENAME__ property for the constructor stuff to work. --- cmake/macros/Public.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/macros/Public.cmake b/cmake/macros/Public.cmake index 003c0cc764..ec82ce19ad 100644 --- a/cmake/macros/Public.cmake +++ b/cmake/macros/Public.cmake @@ -565,6 +565,16 @@ function(pxr_plugin PLUGIN_NAME) ) endif() + if(sl_CPPFILES) + pxr_add_filename_property(${PLUGIN_NAME} "${sl_CPPFILES}") + endif() + if(sl_PRIVATE_CLASSES) + pxr_add_filename_property(${PLUGIN_NAME} "${sl_PRIVATE_CLASSES}") + endif() + if(sl_PUBLIC_CLASSES) + pxr_add_filename_property(${PLUGIN_NAME} "${sl_PUBLIC_CLASSES}") + endif() + # Plugins do not have a lib* prefix like usual shared libraries set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") From e39a3cf244518e84d1e38280c5474b3939d4b3cd Mon Sep 17 00:00:00 2001 From: Jamie Kenyon Date: Wed, 21 Sep 2016 17:22:05 +0100 Subject: [PATCH 20/20] usdObj and usdSchemaExamples now compile on Windows. --- extras/usd/examples/CMakeLists.txt | 8 +++----- extras/usd/examples/usdObj/fileFormat.h | 6 ++++-- extras/usd/examples/usdSchemaExamples/tokens.h | 8 +++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/extras/usd/examples/CMakeLists.txt b/extras/usd/examples/CMakeLists.txt index 5cb4dd8c47..0c6d48cb14 100644 --- a/extras/usd/examples/CMakeLists.txt +++ b/extras/usd/examples/CMakeLists.txt @@ -1,8 +1,6 @@ set(PXR_PREFIX examples) set(PXR_INSTALL_SUBDIR share/usd/examples) -if(UNIX) - add_subdirectory(usdObj) - add_subdirectory(usdSchemaExamples) - add_subdirectory(usdMakeFileVariantModelAsset) -endif() \ No newline at end of file +add_subdirectory(usdObj) +add_subdirectory(usdSchemaExamples) +add_subdirectory(usdMakeFileVariantModelAsset) \ No newline at end of file diff --git a/extras/usd/examples/usdObj/fileFormat.h b/extras/usd/examples/usdObj/fileFormat.h index c7c7eb29a7..b7b2de5043 100644 --- a/extras/usd/examples/usdObj/fileFormat.h +++ b/extras/usd/examples/usdObj/fileFormat.h @@ -24,7 +24,8 @@ #ifndef USDOBJ_FILE_FORMAT_H #define USDOBJ_FILE_FORMAT_H -#include "Python.h" +#include "Python.h" +#include "pxr/base/arch/api.h" #include "pxr/usd/sdf/fileFormat.h" #include "pxr/base/tf/staticTokens.h" #include @@ -35,7 +36,8 @@ ((Version, "1.0")) \ ((Target, "usd")) -TF_DECLARE_PUBLIC_TOKENS(UsdObjFileFormatTokens, USDOBJ_FILE_FORMAT_TOKENS); +TF_DECLARE_PUBLIC_TOKENS(UsdObjFileFormatTokens, ARCH_EXPORT, + USDOBJ_FILE_FORMAT_TOKENS); TF_DECLARE_WEAK_AND_REF_PTRS(UsdObjFileFormat); TF_DECLARE_WEAK_AND_REF_PTRS(SdfLayerBase); diff --git a/extras/usd/examples/usdSchemaExamples/tokens.h b/extras/usd/examples/usdSchemaExamples/tokens.h index ab91a39209..d454ed06bf 100644 --- a/extras/usd/examples/usdSchemaExamples/tokens.h +++ b/extras/usd/examples/usdSchemaExamples/tokens.h @@ -27,12 +27,13 @@ /// \file usdSchemaExamples/tokens.h // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -// +// // This is an automatically generated file (by usdGenSchema.py). // Do not hand-edit! -// +// // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +#include "pxr/base/arch/api.h" #include "pxr/base/tf/staticTokens.h" /// \hideinitializer @@ -70,6 +71,7 @@ /// \li paramsVelocity - UsdSchemaExamplesParamsAPI /// \li paramsVolume - UsdSchemaExamplesParamsAPI /// \li target - UsdSchemaExamplesSimple -TF_DECLARE_PUBLIC_TOKENS(UsdSchemaExamplesTokens, USDSCHEMAEXAMPLES_TOKENS); +TF_DECLARE_PUBLIC_TOKENS(UsdSchemaExamplesTokens, ARCH_EXPORT, + USDSCHEMAEXAMPLES_TOKENS); #endif