Skip to content

Commit

Permalink
Completely remove dependencies on python & boost.
Browse files Browse the repository at this point in the history
Signed-off-by: furby™ <devs@wabi.foundation>
  • Loading branch information
furby-tm committed Feb 14, 2025
1 parent cc64f78 commit ae57f1c
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 101 deletions.
24 changes: 3 additions & 21 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "f5e02745871b95617e6f30f7baca9016ed665f2d27342bc87f9d5f6d804b536a",
"originHash" : "574e70c31d2f9e918e37ad66f2b3778e74a498b10fbcf408505b90a3b7d2c027",
"pins" : [
{
"identity" : "icu",
Expand All @@ -15,17 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/MetaverseKit",
"state" : {
"revision" : "49525217e4ef540408c062c8190895afc3b8e7b1",
"version" : "1.8.9"
}
},
{
"identity" : "metaversepythonframework",
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/MetaversePythonFramework",
"state" : {
"revision" : "e2f4ba867b7e287a283a27a0005ab64deef14279",
"version" : "3.11.7"
"branch" : "main",
"revision" : "8cf6729a950092be3d3d627964731c3b974531b8"
}
},
{
Expand All @@ -37,15 +28,6 @@
"version" : "1.26.2"
}
},
{
"identity" : "pythonkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pvieito/PythonKit.git",
"state" : {
"revision" : "43647b36cacb99558e57ef98e97ef598f91d1164",
"version" : "0.5.0"
}
},
{
"identity" : "rainbow",
"kind" : "remoteSourceControl",
Expand Down
43 changes: 4 additions & 39 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ let package = Package(
// prepare for SwiftCrossUI, for a cross-platform UsdView.
// .package(url: "https://github.com/stackotter/swift-cross-ui", revision: "5c5d8c8"),
.package(url: "https://github.com/wabiverse/icu.git", from: "76.1.2"),
.package(url: "https://github.com/wabiverse/MetaverseKit", from: "1.8.9"),
.package(url: "https://github.com/wabiverse/MetaverseKit", branch: "main"),
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.1"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.4.3"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"),
Expand All @@ -307,7 +307,6 @@ let package = Package(
.target(name: "pxr"),
/* ------------ VFX Platform. ----------- */
.product(name: "MetaTBB", package: "MetaverseKit"),
.product(name: "PyBind11", package: "MetaverseKit", condition: .when(platforms: Arch.OS.nix.platform)),
.product(name: "MaterialX", package: "MetaverseKit"),
.product(name: "Alembic", package: "MetaverseKit"),
.product(name: "OpenColorIO", package: "MetaverseKit"),
Expand All @@ -323,12 +322,12 @@ let package = Package(
/* ---------- Console logging. ---------- */
.product(name: "Logging", package: "swift-log"),
.product(name: "Rainbow", package: "Rainbow")
] + Arch.OS.dependency(.boost),
],
publicHeadersPath: "include",
cxxSettings: [
/* ---------- Turn everything on. ---------- */
.define("PXR_USE_NAMESPACES", to: "1"),
.define("PXR_PYTHON_SUPPORT_ENABLED", to: "1", .when(platforms: Arch.OS.nix.platform)),
.define("PXR_PYTHON_SUPPORT_ENABLED", to: "0"),
.define("PXR_PREFER_SAFETY_OVER_SPEED", to: "1"),
.define("PXR_OCIO_PLUGIN_ENABLED", to: "1"),
.define("PXR_OIIO_PLUGIN_ENABLED", to: "1"),
Expand Down Expand Up @@ -1862,7 +1861,7 @@ let package = Package(
.target(name: "UsdShade"),
.target(name: "UsdLux"),
.target(name: "UsdHydra"),
.target(name: "UsdAbc", condition: .when(platforms: Arch.OS.nix.platform)),
.target(name: "UsdAbc"),
.target(name: "UsdDraco"),
.target(name: "UsdMedia"),
.target(name: "UsdMtlx"),
Expand Down Expand Up @@ -1910,7 +1909,6 @@ let package = Package(
.define("static_assert(_conditional, ...)", to: "", .when(platforms: [.windows])),
],
swiftSettings: [
// enable to debug bundled (python, plugins, resources).
.define("DEBUG_PIXAR_BUNDLE"),
.interoperabilityMode(.Cxx),
]
Expand Down Expand Up @@ -1994,38 +1992,5 @@ enum Arch
case .noembeddedapple: [.macOS, .linux, .android, .openbsd, .windows]
}
}

public static func dependency(_ dependency: Dependency) -> [Target.Dependency]
{
#if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)
[dependency.product(for: .apple)].compactMap { $0 }
#elseif os(Linux) || os(Android) || os(OpenBSD) || os(FreeBSD)
[dependency.product(for: .linux)].compactMap { $0 }
#elseif os(Windows) || os(Cygwin)
[dependency.product(for: .windows)].compactMap { $0 }
#elseif os(WASI)
[dependency.product(for: .web)].compactMap { $0 }
#else
[]
#endif
}

enum Dependency
{
case boost

public func product(for os: OS) -> Target.Dependency?
{
switch self
{
case .boost:
switch os
{
case .apple: .product(name: "Boost", package: "MetaverseKit")
default: nil
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion Sources/Tf/preprocessorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//
#include "Tf/preprocessorUtils.h"

#if !defined(ARCH_OS_WINDOWS)
#if __has_include(<boost/preprocessor/arithmetic/inc.hpp>)

# include <boost/preprocessor/arithmetic/sub.hpp>
# include <boost/preprocessor/cat.hpp>
Expand Down
1 change: 0 additions & 1 deletion Sources/UsdAbc/alembicFileFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "Tf/registryManager.h"
#include "Tf/staticData.h"

#include <boost/assign.hpp>
#include <ostream>

PXR_NAMESPACE_OPEN_SCOPE
Expand Down
17 changes: 10 additions & 7 deletions Sources/UsdAbc/alembicReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
#include <Alembic/AbcGeom/IXform.h>
#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
#include <Alembic/AbcGeom/Visibility.h>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/utility/enable_if.hpp>
#include <optional>
#include <functional>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -609,7 +608,7 @@ class _ReaderContext {
typedef std::function<bool(const UsdAbc_AlembicDataAny &, const ISampleSelector &)> Converter;

/// An optional ordering of name children or properties.
typedef boost::optional<TfTokenVector> Ordering;
typedef std::optional<TfTokenVector> Ordering;

/// Sample times.
typedef UsdAbc_AlembicDataReader::TimeSamples TimeSamples;
Expand Down Expand Up @@ -773,13 +772,17 @@ class _ReaderContext {
const UsdAbc_AlembicDataAny &value) const;

// Custom auto-lock that safely ignores a NULL pointer.
class _Lock : boost::noncopyable {
class _Lock {
public:
_Lock(std::recursive_mutex *mutex) : _mutex(mutex)
{
if (_mutex)
_mutex->lock();
}

_Lock (const _Lock &) = delete;
_Lock &operator=(const _Lock &) = delete;

~_Lock()
{
if (_mutex)
Expand Down Expand Up @@ -2457,7 +2460,7 @@ struct _CopyXform {
}

private:
mutable boost::optional<MetaData> _metadata;
mutable std::optional<MetaData> _metadata;
};

/// Base class to copy attributes of an almebic camera to a USD camera
Expand Down Expand Up @@ -3480,7 +3483,7 @@ static std::string _ReadPrim(_ReaderContext &context,

// Discard name children ordering since we don't have any name
// children (except via the prototype reference).
instance->primOrdering = boost::none;
instance->primOrdering = std::nullopt;
}

// Get the prim cache. If instance is true then prim is the prototype,
Expand Down Expand Up @@ -3533,7 +3536,7 @@ static std::string _ReadPrim(_ReaderContext &context,
if (instance && instance->promoted) {
// prim is the prototype.
prim.properties.clear();
prim.propertyOrdering = boost::none;
prim.propertyOrdering = std::nullopt;
prim.metadata.clear();
prim.propertiesCache.clear();
}
Expand Down
9 changes: 3 additions & 6 deletions Sources/UsdAbc/alembicWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <Alembic/AbcGeom/OXform.h>
#include <Alembic/AbcGeom/Visibility.h>
#include <algorithm>
#include <boost/functional/hash.hpp>
#include <functional>
#include <memory>
#include <pxr/pxrns.h>
Expand Down Expand Up @@ -651,7 +650,7 @@ class _WriterContext {
/// Returns the Usd data.
const SdfAbstractData &GetData() const
{
return *boost::get_pointer(_data);
return *get_pointer(_data);
}

/// Sets or resets the flag named \p flagName.
Expand Down Expand Up @@ -1388,8 +1387,7 @@ void _Copy(const _WriterSchema &schema,
DST *dst,
R (DST::*method)(T))
{
typedef typename boost::remove_const<typename boost::remove_reference<T>::type>::type
SampleValueType;
typedef std::remove_const_t<std::remove_reference_t<T>> SampleValueType;

const SdfValueTypeName &usdType = samples.GetTypeName();
const _WriterSchema::Converter &converter = schema.GetConverter(usdType);
Expand All @@ -1414,8 +1412,7 @@ void _Copy(const _WriterSchema &schema,
DST *dst,
R (DST::*method)(T))
{
typedef typename boost::remove_const<typename boost::remove_reference<T>::type>::type
SampleValueType;
typedef std::remove_const_t<std::remove_reference_t<T>> SampleValueType;

const SdfValueTypeName &usdType = samples.GetTypeName();

Expand Down
5 changes: 3 additions & 2 deletions Sources/UsdAbc/include/UsdAbc/alembicReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "Sdf/abstractData.h"
#include "Sdf/fileFormat.h"
#include "Tf/token.h"
#include <boost/noncopyable.hpp>
#include <memory>
#include <pxr/pxrns.h>
#include <stdint.h>
Expand All @@ -45,11 +44,13 @@ PXR_NAMESPACE_OPEN_SCOPE
///
/// An alembic reader suitable for an SdfAbstractData.
///
class UsdAbc_AlembicDataReader : boost::noncopyable {
class UsdAbc_AlembicDataReader {
public:
typedef int64_t Index;

UsdAbc_AlembicDataReader();
UsdAbc_AlembicDataReader(const UsdAbc_AlembicDataReader &) = delete;
UsdAbc_AlembicDataReader &operator=(const UsdAbc_AlembicDataReader &) = delete;
~UsdAbc_AlembicDataReader();

/// Open a file. Returns \c true on success; errors are reported by
Expand Down
Loading

0 comments on commit ae57f1c

Please sign in to comment.