diff --git a/recipes/usd-mojo/install-rpath.patch b/recipes/usd-mojo/install-rpath.patch new file mode 100644 index 00000000..d5a0c4f1 --- /dev/null +++ b/recipes/usd-mojo/install-rpath.patch @@ -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) diff --git a/recipes/usd-mojo/recipe.yaml b/recipes/usd-mojo/recipe.yaml index 99d797c1..fea94b05 100644 --- a/recipes/usd-mojo/recipe.yaml +++ b/recipes/usd-mojo/recipe.yaml @@ -1,16 +1,19 @@ { "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.*", @@ -18,6 +21,7 @@ "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": { @@ -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": [ @@ -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" }, diff --git a/recipes/usd-mojo/smoke.mojo b/recipes/usd-mojo/smoke.mojo index 2b89d101..e91c5397 100644 --- a/recipes/usd-mojo/smoke.mojo +++ b/recipes/usd-mojo/smoke.mojo @@ -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: @@ -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")