Skip to content

Commit 7505fa3

Browse files
committed
Add recipe for usd package
1 parent 7f8ce3b commit 7505fa3

File tree

4 files changed

+163
-0
lines changed

4 files changed

+163
-0
lines changed

recipes/usd/build.bat

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
mkdir build
2+
cd build
3+
4+
cmake %CMAKE_ARGS% ^
5+
-G "Ninja" ^
6+
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
7+
-DCMAKE_BUILD_TYPE=Release ^
8+
-DBUILD_TESTING:BOOL=ON ^
9+
-DBUILD_SHARED_LIBS:BOOL=ON ^
10+
-DPXR_HEADLESS_TEST_MODE:BOOL=ON ^
11+
-DPXR_BUILD_IMAGING:BOOL=ON ^
12+
-DPXR_BUILD_USD_IMAGING=ON ^
13+
-DPXR_ENABLE_PYTHON_SUPPORT=ON ^
14+
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=ON ^
15+
-DPXR_PYTHON_SHEBANG="/usr/bin/env python" ^
16+
%SRC_DIR%
17+
if errorlevel 1 exit 1
18+
19+
:: Build.
20+
cmake --build . --config Release
21+
if errorlevel 1 exit 1
22+
23+
:: Install.
24+
cmake --build . --config Release --target install
25+
if errorlevel 1 exit 1
26+
27+
:: Test.
28+
ctest --output-on-failure -C Release
29+
if errorlevel 1 exit 1

recipes/usd/build.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
mkdir build
4+
cd build
5+
6+
# -fvisibility-inlines-hidden results in linking errors like:
7+
# testVtCpp.cpp:(.text.startup.main+0x2fa): undefined reference to pxrInternal_v0_25_2__pxrReserved__::VtArray<int>::_DecRef()'
8+
# This is a temporary workaround until https://github.com/PixarAnimationStudios/OpenUSD/pull/3452 is merged upstream,
9+
# that should solve this issue in a clean way
10+
export CFLAGS="$(echo $CFLAGS | sed 's/-fvisibility-inlines-hidden//g')"
11+
export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-fvisibility-inlines-hidden//g')"
12+
13+
# From https://conda-forge.org/docs/maintainer/knowledge_base/#finding-numpy-in-cross-compiled-python-packages-using-cmake
14+
Python_INCLUDE_DIR="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
15+
CMAKE_ARGS="${CMAKE_ARGS} -DPython_EXECUTABLE:PATH=${PYTHON}"
16+
CMAKE_ARGS="${CMAKE_ARGS} -DPython_INCLUDE_DIR:PATH=${Python_INCLUDE_DIR}"
17+
CMAKE_ARGS="${CMAKE_ARGS} -DPython3_EXECUTABLE:PATH=${PYTHON}"
18+
CMAKE_ARGS="${CMAKE_ARGS} -DPython3_INCLUDE_DIR:PATH=${Python_INCLUDE_DIR}"
19+
20+
cmake ${CMAKE_ARGS} -GNinja .. \
21+
-DCMAKE_BUILD_TYPE=Release \
22+
-DBUILD_TESTING:BOOL=ON \
23+
-DPXR_HEADLESS_TEST_MODE:BOOL=ON \
24+
-DPXR_BUILD_IMAGING:BOOL=ON \
25+
-DPXR_BUILD_USD_IMAGING:BOOL=ON \
26+
-DPXR_ENABLE_PYTHON_SUPPORT:BOOL=ON \
27+
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=ON \
28+
-DPXR_PYTHON_SHEBANG="/usr/bin/env python"
29+
30+
cmake --build . --config Release
31+
cmake --build . --config Release --target install
32+
ctest --output-on-failure -C Release
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/pxr/external/boost/python/CMakeLists.txt b/pxr/external/boost/python/CMakeLists.txt
2+
index 3874e7b24d..b5bb9f15a4 100644
3+
--- a/pxr/external/boost/python/CMakeLists.txt
4+
+++ b/pxr/external/boost/python/CMakeLists.txt
5+
@@ -338,6 +338,23 @@ target_compile_definitions(python
6+
PRIVATE $<$<NOT:$<CONFIG:Debug>>:NDEBUG>
7+
)
8+
9+
+# Even if PXR_PY_UNDEFINED_DYNAMIC_LOOKUP is defined (to avoid that the usd python extensions
10+
+# links to the python library, to avoid problems with statically linked python interpreters)
11+
+# we want that executables that link usd_python to link with the Python library,
12+
+# as otherwise they would fail due to missing symbols, see
13+
+# https://github.com/PixarAnimationStudios/OpenUSD/issues/2371
14+
+# and https://github.com/PixarAnimationStudios/OpenUSD/issues/2568
15+
+# This can be done by adding to INTERFACE_LINK_LIBRARIES the appropriate generator expression,
16+
+# that will evalute to empty when usd_python is linked to a library, but it will evaluate to
17+
+# Python3::Python when linked to an executable
18+
+if (PXR_PY_UNDEFINED_DYNAMIC_LOOKUP)
19+
+ # This should equivalent to target_link_libraries(python INTERFACE ...), that we can't
20+
+ # use as pxr_library already use the target_link_libraries plain signature, and the two can't be mixed
21+
+ set_property(TARGET python APPEND PROPERTY INTERFACE_LINK_LIBRARIES
22+
+ "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:Python3::Python>"
23+
+ )
24+
+endif()
25+
+
26+
# Since we're not going through the normal pxr_build_test macros
27+
# we need to elide tests here if requested.
28+
if (NOT PXR_BUILD_TESTS)
29+

recipes/usd/recipe.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
schema_version: 1
2+
3+
context:
4+
name: usd
5+
version: 25.02
6+
7+
package:
8+
name: ${{ name }}
9+
version: ${{ version }}
10+
11+
source:
12+
- url: https://github.com/PixarAnimationStudios/OpenUSD/archive/refs/tags/v${{ version }}.tar.gz
13+
sha256: e06f67522cc4ff1a3ce99bc28075b049a15869792b41d33b0d4387fb22122cfe
14+
patches:
15+
- link_python_to_executables.patch
16+
17+
build:
18+
number: 0
19+
20+
requirements:
21+
build:
22+
- ${{ compiler('c') }}
23+
- ${{ stdlib('c') }}
24+
- ${{ compiler('cxx') }}
25+
- ninja
26+
- cmake
27+
host:
28+
- if: linux
29+
then:
30+
- libgl-devel
31+
- libglx-devel
32+
- xorg-libxrandr
33+
- glfw
34+
- tbb-devel
35+
- libboost-devel
36+
- libopensubdiv
37+
- python
38+
- jinja2
39+
- pyside6
40+
- pyopengl
41+
run:
42+
- python
43+
run_exports:
44+
- ${{ pin_subpackage(name, upper_bound='x.x') }}
45+
46+
tests:
47+
- package_contents:
48+
include:
49+
- pxr/pxr.h
50+
lib:
51+
- usd_ms
52+
- requirements:
53+
run:
54+
- cmake-package-check
55+
- ${{ compiler('c') }}
56+
- ${{ compiler('cxx') }}
57+
script:
58+
- cmake-package-check pxr
59+
- python:
60+
imports:
61+
- pxr
62+
- pxr.Usd
63+
- pxr.UsdGeom
64+
65+
about:
66+
license: Apache-2.0
67+
license_file: LICENSE.txt
68+
summary: Library to read and write Universal Scene Description (USD) files.
69+
homepage: https://github.com/PixarAnimationStudios/OpenUSD
70+
71+
extra:
72+
recipe-maintainers:
73+
- traversaro

0 commit comments

Comments
 (0)