Skip to content

Commit

Permalink
add openusd recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanDugueperoux2 committed Jul 4, 2024
1 parent 7aee73a commit b76a59e
Show file tree
Hide file tree
Showing 6 changed files with 567 additions and 0 deletions.
5 changes: 5 additions & 0 deletions recipes/openusd/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sources:
"24.05":
url:
- "https://github.com/PixarAnimationStudios/OpenUSD/archive/refs/tags/v24.05.tar.gz"
sha256: "0352619895588efc8f9d4aa7004c92be4e4fa70e1ccce77e474ce23941c05828"
489 changes: 489 additions & 0 deletions recipes/openusd/all/conanfile.py

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions recipes/openusd/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)

project(test_package LANGUAGES CXX)

find_package(openusd REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE openusd::usd_usdGeom)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
28 changes: 28 additions & 0 deletions recipes/openusd/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
# cmake.build()
cmake.build(cli_args=["--verbose"])

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
33 changes: 33 additions & 0 deletions recipes/openusd/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <pxr/base/tf/token.h>
#include <pxr/usd/sdf/path.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usd/zipFile.h>
#include <pxr/usd/usdGeom/mesh.h>
#include <pxr/usd/usdGeom/metrics.h>
#include <pxr/usd/usdGeom/primvar.h>
#include <pxr/usd/usdGeom/primvarsAPI.h>
#include <pxr/usd/usdGeom/xform.h>
#include <pxr/usdImaging/usdImaging/tokens.h>
#include <pxr/usd/usdShade/material.h>
#include <pxr/usd/usdShade/materialBindingAPI.h>
#include <pxr/usd/usdShade/shader.h>


PXR_NAMESPACE_USING_DIRECTIVE

int main(int argc, char *argv[])
{
UsdStageRefPtr stage = UsdStage::CreateNew("HelloWorld.usda");

UsdGeomSetStageUpAxis(stage, UsdGeomTokens->y);
// UsdGeomSetStageMetersPerUnit(stage, 0.01);

// // create mesh
// UsdGeomXform xform = UsdGeomXform::Define(stage, SdfPath("/root"));
// UsdGeomMesh mesh = UsdGeomMesh::Define(stage, SdfPath("/root/mesh"));
// stage->SetDefaultPrim(xform.GetPrim());

stage->GetRootLayer()->Save();

return EXIT_SUCCESS;
}
3 changes: 3 additions & 0 deletions recipes/openusd/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"24.05":
folder: all

0 comments on commit b76a59e

Please sign in to comment.