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
28 changes: 28 additions & 0 deletions recipes/usd-mojo/install-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/tools/conda_install.py
+++ b/tools/conda_install.py
@@ -22,0 +23,22 @@
+
+
+def normalize_linux_rpath(bridge, native):
+ current = subprocess.check_output(
+ ["patchelf", "--print-rpath", str(bridge)], text=True
+ ).strip()
+ if not current:
+ raise RuntimeError("Installed bridge has no runtime search path")
+ script = native / "normalize_rpath.cmake"
+ script.write_text(
+ 'file(RPATH_CHANGE FILE "${BRIDGE}" OLD_RPATH "${OLD_RPATH}" '
+ 'NEW_RPATH "$ORIGIN")\n'
+ )
+ subprocess.run(
+ ["cmake", f"-DBRIDGE={bridge}", f"-DOLD_RPATH={current}", "-P", str(script)],
+ check=True,
+ )
+ actual = subprocess.check_output(
+ ["patchelf", "--print-rpath", str(bridge)], text=True
+ ).strip()
+ if actual != "$ORIGIN":
+ raise RuntimeError("Installed bridge runtime search path is not relative")
@@ -108,0 +131,2 @@
+ elif sys.platform == "linux":
+ normalize_linux_rpath(bridge, native)
67 changes: 51 additions & 16 deletions recipes/usd-mojo/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"package": {
"name": "usd-mojo",
"version": "0.1.0"
"version": "0.2.0"
},
"source": {
"git": "https://github.com/henlamp/usd-mojo.git",
"rev": "1ba375b5f99c49062d967036063b0f69054178a2"
"rev": "8908e9815627d4d478edb59fe074166fb7962268",
"patches": [
"install-rpath.patch"
]
},
"build": {
"number": 0,
"string": "mojo110_0",
"skip": "not (osx and arm64)",
"string": "mojo120_0",
"skip": "not ((osx and arm64) or (linux and x86_64))",
"files": [
"lib/mojo/usd_mojo.mojoc",
"lib/libusd_mojo_bridge.*",
"bin/usd-mojo-build",
"share/usd-mojo/**"
],
"script": [
"export CXXFLAGS=\"${CXXFLAGS:-} -ffile-prefix-map=${SRC_DIR}=source -ffile-prefix-map=${BUILD_PREFIX}=build-tools\"",
"python tools/conda_install.py"
],
"dynamic_linking": {
Expand All @@ -32,25 +36,55 @@
"requirements": {
"build": [
"python 3.12.*",
"mojo-compiler ==1.1.0",
"mojo-compiler ==1.2.0",
"cmake >=3.30,<5",
"ninja >=1.12,<2",
"cxx-compiler ==2.0.0"
"cxx-compiler ==2.0.0",
{
"if": "linux",
"then": [
"sysroot_linux-64 ==2.28",
"patchelf >=0.19,<0.20"
]
}
],
"host": [
"mojo-compiler ==1.1.0",
"openusd ==26.08 py312h07b4ffe_0",
"mojo-compiler ==1.2.0",
"openusd ==26.08",
"python 3.12.*",
"libcxx ==23.1.3",
"tbb ==2023.0.0"
{
"if": "osx",
"then": "libcxx ==23.1.3"
},
"tbb ==2023.0.0",
{
"if": "linux",
"then": [
"libgcc ==15.3.0",
"libstdcxx ==15.3.0"
]
}
],
"run": [
"mojo-compiler ==1.1.0",
"openusd ==26.08 py312h07b4ffe_0",
"mojo-compiler ==1.2.0",
"openusd ==26.08",
"python 3.12.*",
"__osx >=13.0",
"libcxx >=23.1.3,<24",
"tbb >=2023.0.0,<2024"
{
"if": "osx",
"then": [
"__osx >=13.0",
"libcxx >=23.1.3,<24"
]
},
"tbb >=2023.0.0,<2024",
{
"if": "linux",
"then": [
"__glibc >=2.28",
"libgcc >=15.3.0,<16",
"libstdcxx >=15.3.0,<16"
]
}
]
},
"tests": [
Expand All @@ -75,7 +109,8 @@
"LICENSE",
"THIRD_PARTY_NOTICES.md",
"licenses/OpenUSD-LICENSE.txt",
"licenses/OpenUSD-NOTICE.txt"
"licenses/OpenUSD-NOTICE.txt",
"licenses/MaterialX-LICENSE.txt"
],
"summary": "Typed Mojo access to OpenUSD scenes and geometry"
},
Expand Down
26 changes: 25 additions & 1 deletion recipes/usd-mojo/smoke.mojo
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from std.sys import argv
from usd_mojo import Stage
from usd_mojo import (
Stage,
Layer,
SceneSnapshot,
SchemaSnapshot,
poll_changes,
ArraySnapshot,
validate_stage,
)


def main() raises:
Expand All @@ -9,4 +17,20 @@ def main() raises:
var points = mesh.points()
if len(points) != 9 or points[3] != 1 or points[7] != 1:
raise Error("Installed USD mesh differs")
var scene = SceneSnapshot(stage)
if len(scene.transforms()) != 32:
raise Error("Installed scene snapshot differs")
var schema = SchemaSnapshot(stage, "/World/Mesh")
if schema.value("points").numbers[3] != 1:
raise Error("Installed schema snapshot differs")
var root = Layer(stage)
if root.is_anonymous() or poll_changes(stage).generation != 0:
raise Error("Installed layer/notice behavior differs")
var array = ArraySnapshot(stage, "/World/Mesh", "points")
if array.view[DType.float32]()[3] != 1:
raise Error("Installed native array differs")
if not validate_stage(
stage, validators=[String("usd_mojo:MeshTopology")]
).is_valid():
raise Error("Installed scene validation differs")
print("PASS: installed usd-mojo with resolved SDK")
Loading