Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test-linux

on:
push:
branches: [ main ]
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

Expand All @@ -15,17 +15,14 @@ permissions:

jobs:
test-linux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
usd: ["v23.11", "v24.08"]
python: ["3.7", "3.10"]
include:
- usd: "v24.08"
python: "3.11"
usd: ["v25.05"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We skipped 25.02a because the expected notices from muted layers were temporarily altered and later reverted in 25.05.
PixarAnimationStudios/OpenUSD@d0fe05e

python: ["3.10", "3.12"]

name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test-windows

on:
push:
branches: [ main ]
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]

Expand All @@ -21,11 +21,8 @@ jobs:
strategy:
fail-fast: false
matrix:
usd: ["v23.11", "v24.08"]
python: ["3.7", "3.10"]
include:
- usd: "v24.08"
python: "3.11"
usd: ["v25.05"]
python: ["3.10", "3.12"]

name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"

Expand Down
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
# https://cmake.org/cmake/help/latest/policy/CMP0094.html
cmake_policy(SET CMP0094 NEW)

find_package(USD 0.20.11 REQUIRED)
find_package(TBB 2017.0 COMPONENTS tbb REQUIRED)

if(BUILD_PYTHON_BINDINGS)
# The 'manylinux' images do not include the Python library.
# CMake >= 3.18 is required for this option to work as expected.
Expand All @@ -82,11 +85,13 @@ if(BUILD_PYTHON_BINDINGS)
set(_py_version ${Python_VERSION_MAJOR}${Python_VERSION_MINOR})
mark_as_advanced(_py_version)

find_package(Boost 1.70.0 COMPONENTS "python${_py_version}" REQUIRED)
if (NOT USD_USE_INTERNAL_BOOST_PYTHON)
find_package(Boost 1.70.0 COMPONENTS "python${_py_version}" REQUIRED)

# Define generic target for Boost Python if necessary.
if (NOT TARGET Boost::python)
add_library(Boost::python ALIAS "Boost::python${_py_version}")
# Define generic target for Boost Python if necessary.
if (NOT TARGET Boost::python)
add_library(Boost::python ALIAS "Boost::python${_py_version}")
endif()
endif()

# Set variable to identify the path to install and test python libraries.
Expand All @@ -97,13 +102,8 @@ if(BUILD_PYTHON_BINDINGS)
set(PYTHON_DESTINATION
"${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages"
CACHE INTERNAL "Python library path.")
else()
find_package(Boost 1.70.0 REQUIRED)
endif()

find_package(USD 0.20.11 REQUIRED)
find_package(TBB 2017.0 COMPONENTS tbb REQUIRED)

add_subdirectory(src)

if (BUILD_TESTS)
Expand Down
36 changes: 28 additions & 8 deletions cmake/modules/FindUSD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ find_path(
include
)

set(USD_LIBRARIES usd sdf tf plug arch vt)
set(USD_LIBRARIES usd sdf tf plug arch vt boost python)

set(USD_DEPENDENCIES "Boost::boost;TBB::tbb")

if (BUILD_PYTHON_BINDINGS)
set(USD_DEPENDENCIES "${USD_DEPENDENCIES};Python::Python;Boost::python")
endif()

mark_as_advanced(USD_INCLUDE_DIR USD_LIBRARIES USD_DEPENDENCIES)
mark_as_advanced(USD_INCLUDE_DIR USD_LIBRARIES)

foreach(NAME IN LISTS USD_LIBRARIES)
find_library(
Expand All @@ -64,6 +58,7 @@ foreach(NAME IN LISTS USD_LIBRARIES)
mark_as_advanced("${NAME}_LIBRARY")
endforeach()


if(USD_INCLUDE_DIR AND EXISTS "${USD_INCLUDE_DIR}/pxr/pxr.h")
file(READ "${USD_INCLUDE_DIR}/pxr/pxr.h" _pxr_header)
foreach(label MAJOR MINOR PATCH)
Expand All @@ -75,11 +70,34 @@ if(USD_INCLUDE_DIR AND EXISTS "${USD_INCLUDE_DIR}/pxr/pxr.h")

set(USD_VERSION ${_pxr_MAJOR}.${_pxr_MINOR}.${_pxr_PATCH})

set(USD_DEPENDENCIES "TBB::tbb")
if (BUILD_PYTHON_BINDINGS)
list(APPEND USD_DEPENDENCIES "Python::Python")
endif()

# Detect whether PXR_USE_INTERNAL_BOOST_PYTHON is explicitly enabled
set(USD_USE_INTERNAL_BOOST_PYTHON ON CACHE INTERNAL "")
string(REGEX MATCH
"#if +1[^\n]*\n[ \t]*#define +PXR_USE_INTERNAL_BOOST_PYTHON"
_use_internal_boost_python "${_pxr_header}")

# Use external Boost dependencies if USD version is less than 0.25.5, and
# if internal Boost.Python is not explicitly enabled
if (USD_VERSION VERSION_LESS "0.25.5" AND NOT _use_internal_boost_python)
set(USD_USE_INTERNAL_BOOST_PYTHON OFF CACHE INTERNAL "")
list(APPEND USD_DEPENDENCIES "Boost::boost")
if (BUILD_PYTHON_BINDINGS)
list(APPEND USD_DEPENDENCIES "Boost::python")
endif()
endif()

mark_as_advanced(
_pxr_MAJOR
_pxr_MINOR
_pxr_PATCH
_use_internal_boost_python
USD_VERSION
USD_DEPENDENCIES
)
endif()

Expand All @@ -93,6 +111,8 @@ find_package_handle_standard_args(
plug_LIBRARY
arch_LIBRARY
vt_LIBRARY
boost_LIBRARY
python_LIBRARY
VERSION_VAR
USD_VERSION
)
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ target_link_libraries(unf
usd::vt
)

# Transitive Pixar libraries depend on vendorized Boost.Python
# (Required due to manual CMake module used to locate USD)
if (BUILD_PYTHON_BINDINGS)
target_link_libraries(unf PUBLIC usd::boost usd::python)
endif()

install(
TARGETS unf
EXPORT ${PROJECT_NAME}
Expand Down
12 changes: 7 additions & 5 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ target_include_directories(pyUnf
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_link_libraries(pyUnf
PUBLIC
unf
Boost::python
)
target_link_libraries(pyUnf PUBLIC unf)

if (NOT USD_USE_INTERNAL_BOOST_PYTHON)
target_link_libraries(pyUnf PUBLIC Boost::python)
else()
target_link_libraries(pyUnf PUBLIC usd::boost usd::python)
endif()

set_target_properties(pyUnf
PROPERTIES
Expand Down
7 changes: 6 additions & 1 deletion src/python/predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
#include <pxr/base/tf/pyNoticeWrapper.h>
#include <pxr/pxr.h>

#ifndef PXR_USE_INTERNAL_BOOST_PYTHON
#include <boost/python.hpp>
using namespace boost::python;
#else
#include <pxr/external/boost/python.hpp>
using namespace PXR_BOOST_PYTHON_NAMESPACE;
#endif

#include <functional>

using namespace boost::python;
using namespace unf;

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
11 changes: 9 additions & 2 deletions src/python/wrapBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
#include <pxr/usd/usd/common.h>
#include <pxr/usd/usd/stage.h>

#ifndef PXR_USE_INTERNAL_BOOST_PYTHON
#include <boost/python.hpp>

using namespace boost::python;
using noncopyable = boost::noncopyable;
#else
#include <pxr/external/boost/python.hpp>
using namespace PXR_BOOST_PYTHON_NAMESPACE;
using noncopyable = PXR_BOOST_PYTHON_NAMESPACE::noncopyable;
#endif

using namespace unf;

PXR_NAMESPACE_USING_DIRECTIVE
Expand All @@ -31,7 +38,7 @@ void wrapBroker()
// Ensure that predicate function can be passed from Python.
TfPyFunctionFromPython<_CapturePredicateFuncRaw>();

class_<Broker, BrokerWeakPtr, boost::noncopyable>(
class_<Broker, BrokerWeakPtr, noncopyable>(
"Broker",
"Intermediate object between the Usd Stage and any clients that needs "
"asynchronous handling and upstream filtering of notices.",
Expand Down
7 changes: 6 additions & 1 deletion src/python/wrapCapturePredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

#include "unf/capturePredicate.h"

#ifndef PXR_USE_INTERNAL_BOOST_PYTHON
#include <boost/python.hpp>

using namespace boost::python;
#else
#include <pxr/external/boost/python.hpp>
using namespace PXR_BOOST_PYTHON_NAMESPACE;
#endif

using namespace unf;

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
7 changes: 6 additions & 1 deletion src/python/wrapNotice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@

#include <pxr/pxr.h>

#ifndef PXR_USE_INTERNAL_BOOST_PYTHON
#include <boost/python.hpp>

using namespace boost::python;
#else
#include <pxr/external/boost/python.hpp>
using namespace PXR_BOOST_PYTHON_NAMESPACE;
#endif

using namespace unf::UnfNotice;

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
8 changes: 7 additions & 1 deletion src/python/wrapTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
#include <pxr/usd/usd/common.h>
#include <pxr/usd/usd/stage.h>

#ifndef PXR_USE_INTERNAL_BOOST_PYTHON
#include <boost/python.hpp>
#include <boost/python/return_internal_reference.hpp>

using namespace boost::python;
#else
#include <pxr/external/boost/python.hpp>
#include <pxr/external/boost/python/return_internal_reference.hpp>
using namespace PXR_BOOST_PYTHON_NAMESPACE;
#endif

using namespace unf;

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
5 changes: 2 additions & 3 deletions test/utility/unfTest/observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include <pxr/pxr.h>
#include <pxr/usd/usd/stage.h>

#include <boost/optional.hpp>

#include <optional>
#include <exception>

namespace Test {
Expand Down Expand Up @@ -64,7 +63,7 @@ class Observer : public PXR_NS::TfWeakBase {
}
}

boost::optional<T> _notice;
std::optional<T> _notice;
size_t _count;
PXR_NS::TfNotice::Key _key;
std::function<void(const T&)> _callback;
Expand Down