diff --git a/recipes/openusd/all/conandata.yml b/recipes/openusd/all/conandata.yml new file mode 100644 index 00000000000000..4d6b556615cff7 --- /dev/null +++ b/recipes/openusd/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "24.05": + url: + - "https://github.com/PixarAnimationStudios/OpenUSD/archive/refs/tags/v24.05.tar.gz" + sha256: "0352619895588efc8f9d4aa7004c92be4e4fa70e1ccce77e474ce23941c05828" diff --git a/recipes/openusd/all/conanfile.py b/recipes/openusd/all/conanfile.py new file mode 100644 index 00000000000000..7fcf79945b87bc --- /dev/null +++ b/recipes/openusd/all/conanfile.py @@ -0,0 +1,525 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + +class OpenUSDConan(ConanFile): + name = "openusd" + description = "Universal Scene Description" + license = "LicenseRef-LICENSE.txt" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openusd.org/" + topics = ("3d", "scene", "usd") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_usd_tools": [True, False], + "build_imaging": [True, False], + "build_usd_imaging": [True, False], + "build_usdview": [True, False], + "build_openimageio_plugin": [True, False], + "build_opencolorio_plugin": [True, False], + "build_embree_plugin": [True, False], + "enable_materialx_support": [True, False], + "enable_vulkan_support": [True, False], + "enable_gl_support": [True, False], + "build_gpu_support": [True, False], + "enable_ptex_support": [True, False], + "enable_openvdb_support": [True, False], + "build_renderman_plugin": [True, False], + "build_alembic_plugin": [True, False], + "enable_hdf5_support": [True, False], + "build_draco_plugin": [True, False], + "enable_osl_support": [True, False], + "build_animx_tests": [True, False], + "enable_python_support": [True, False], + } + default_options = { + "shared": False, + "fPIC": False, + "build_usd_tools": True, + "build_imaging": True, + "build_usd_imaging": True, + "build_usdview": True, + # FIXME: +# /root/.conan2/p/b/openu5e99139527369/b/src/pxr/imaging/plugin/hioOiio/oiioImage.cpp:44:10: fatal error: OpenImageIO/imagebuf.h: No such file or directory +# 44 | #include + + "build_openimageio_plugin": False, + "build_opencolorio_plugin": False, + # FIXME: +# /root/.conan2/p/b/openu651f44e18fc45/b/src/pxr/imaging/plugin/hdEmbree/meshSamplers.h:32:10: fatal error: embree3/rtcore.h: No such file or directory +# 32 | #include + "build_embree_plugin": False, + "enable_materialx_support": False, + "enable_vulkan_support": False, + "enable_gl_support": False, + "build_gpu_support": False, + # FIXME: +# /root/.conan2/p/b/openub65bab647f058/b/src/pxr/imaging/hdSt/ptexMipmapTextureLoader.h:29:10: fatal error: Ptexture.h: No such file or directory +# 29 | #include + + "enable_ptex_support": False, + "enable_openvdb_support": False, + "build_renderman_plugin": False, + # FIXME: +# /root/.conan2/p/b/openu0d9487be679c5/b/src/pxr/usd/plugin/usdAbc/alembicUtil.h:38:10: fatal error: Alembic/Abc/ICompoundProperty.h: No such file or directory +# 38 | #include + + "build_alembic_plugin": False, + "enable_hdf5_support": False, + # FIXME: +# /root/.conan2/p/b/openub6914422cb70b/b/src/pxr/usd/plugin/usdDraco/attributeDescriptor.h:34:10: fatal error: draco/attributes/geometry_attribute.h: No such file or directory +# 34 | #include + + "build_draco_plugin": False, + "enable_osl_support": False, + "build_animx_tests": False, + "enable_python_support": True, + } + + short_paths = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.options.build_usd_imaging and not self.options.build_imaging: + self.options.build_usd_imaging = False + self.options.build_gpu_support = self.options.enable_gl_support or self.options.enable_metal_support or self.options.enable_vulkan_support + self.options["opensubdiv"].with_opengl = self.options.enable_gl_support + self.options["opensubdiv"].with_metal = is_apple_os(self) + if self.options.build_usdview: + if self.options.build_imaging: + self.options.build_usd_imaging = False + if self.options.build_usdview: + if not self.options.build_usd_imaging: + self.options.build_usdview = False + elif not self.options.enable_python_support: + self.options.build_usdview = False + elif not self.options.build_gpu_support: + self.options.build_usdview = False + if self.options.build_embree_plugin: + if not self.options.build_imaging: + self.options.build_embree_plugin = False + elif not self.options.build_gpu_support: + self.options.build_embree_plugin = False + if self.options.build_renderman_plugin: + if not self.options.build_imaging: + self.options.build_renderman_plugin = False + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if self.settings.os == "Windows": + self.options["openssl"].shared = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.85.0", transitive_headers=True) + # TODO: rework TBB dependency once https://github.com/PixarAnimationStudios/OpenUSD/issues/1471 fixed + # FIXME: failed to build on Fedora 40: + # ../../include/tbb/task.h:289:20: erreur: la déclaration de « tbb::task& tbb::internal::task_prefix::task() » change la signification de « task » [-Wchanges-meaning] + # 289 | tbb::task& task() {return *reinterpret_cast(this+1);} + # WORKAROUND: build using a docker image: + # docker run -it debian:bullseye bash + # apt-get -y update && \ + # DEBIAN_FRONTEND=noninteractive \ + # apt-get install -y crossbuild-essential-arm64 python3-pip cmake ccache ninja-build ssh git vim pkg-config wget software-properties-common && \ + # pip install --upgrade conan pylint yamllint + + self.requires("onetbb/2019_u9", transitive_headers=True) + + if self.options.build_imaging: + if self.options.build_openimageio_plugin and self.options.build_gpu_support: + self.requires("openimageio/2.5.12.0") + if self.options.build_opencolorio_plugin and self.options.build_gpu_support and self.options.enable_gl_support: + self.requires("opencolorio/2.3.2") + self.requires("opensubdiv/3.6.0") + if self.options.enable_vulkan_support: + self.requires("vulkan-headers/1.3.268.0") + if self.options.enable_gl_support: + self.requires("opengl/system") + if self.options.enable_ptex_support: + self.requires("ptex/2.4.2") + if self.options.enable_openvdb_support: + self.requires("openvdb/11.0.0") + if self.options.build_embree_plugin: + self.requires("embree3/3.13.5") + if self.options.build_renderman_plugin: + # TODO: add a recipe for renderman + self.requires("renderman/x.y.z") + if self.options.build_alembic_plugin: + self.requires("alembic/1.8.6") + if self.options.enable_hdf5_support: + self.requires("hdf5/1.14.4.3") + if self.options.build_draco_plugin: + self.requires("draco/1.5.6") + if self.options.enable_materialx_support: + self.requires("materialx/1.38.10", transitive_headers=True) + if self.options.enable_osl_support: + # TODO: add osl to conan center (https://github.com/AcademySoftwareFoundation/OpenShadingLanguage) + self.requires("openshadinglanguage/1.13.8.0") + if self.options.build_animx_tests: + # TODO: add animx to conan center (https://github.com/Autodesk/animx/) + self.requires("animx/x.y.z") + if self.options.build_imaging and (self.options.build_openimageio_plugin and self.options.build_gpu_support or self.options.enable_openvdb_support) or self.options.build_alembic_plugin or self.options.enable_osl_support: + self.requires("imath/3.1.11") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + if self.options.build_animx_tests: + raise ConanInvalidConfiguration("animx recipe doesn't yet exists in conan center index") + if self.options.enable_osl_support: + raise ConanInvalidConfiguration("openshadinglanguage recipe doesn't yet exists in conan center index") + if self.options.build_renderman_plugin: + raise ConanInvalidConfiguration("renderman recipe doesn't yet exists in conan center index") + + if self.options.enable_python_support: + raise ConanInvalidConfiguration("python doesn't yet supported") + + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PXR_BUILD_TESTS"] = False + tc.variables["PXR_BUILD_EXAMPLES"] = False + tc.variables["PXR_BUILD_TUTORIALS"] = False + tc.variables["PXR_BUILD_HTML_DOCUMENTATION"] = False + tc.variables["PXR_ENABLE_PYTHON_SUPPORT"] = self.options.enable_python_support + tc.variables["PXR_BUILD_USD_TOOLS"] = self.options.build_usd_tools + + tc.variables["OPENSUBDIV_LIBRARIES"] = "opensubdiv::opensubdiv" + tc.variables["OPENSUBDIV_INCLUDE_DIR"] = self.dependencies['opensubdiv'].cpp_info.includedirs[0] + + tc.variables["TBB_tbb_LIBRARY"] = "TBB::tbb" + tc.variables["OPENVDB_LIBRARY"] = "OpenVDB::openvdb" + + tc.variables["PXR_ENABLE_MATERIALX_SUPPORT"] = self.options.enable_materialx_support + + tc.variables["PXR_BUILD_IMAGING"] = self.options.build_imaging + if self.options.build_imaging: + tc.variables["PXR_BUILD_IMAGING"] = True + tc.variables["PXR_ENABLE_GL_SUPPORT"] = self.options.enable_gl_support + tc.variables["PXR_ENABLE_VULKAN_SUPPORT"] = self.options.enable_vulkan_support + tc.variables["PXR_ENABLE_PTEX_SUPPORT"] = self.options.enable_ptex_support + tc.variables["PXR_ENABLE_OPENVDB_SUPPORT"] = self.options.enable_openvdb_support + tc.variables["PXR_BUILD_OPENIMAGEIO_PLUGIN"] = self.options.build_openimageio_plugin and self.options.build_gpu_support + tc.variables["PXR_BUILD_COLORIO_PLUGIN"] = self.options.build_opencolorio_plugin and self.options.enable_gl_support and self.options.build_gpu_support + tc.variables["PXR_BUILD_EMBREE_PLUGIN"] = self.options.build_embree_plugin + tc.variables["EMBREE_FOUND"] = self.options.build_embree_plugin + if self.options.build_usd_imaging: + tc.variables["PXR_BUILD_USD_IMAGING"] = True + if self.options.build_usdview: + tc.variables["PXR_BUILD_USDVIEW"] = True + + tc.variables["PXR_BUILD_PRMAN_PLUGIN"] = self.options.build_renderman_plugin + tc.variables["PXR_BUILD_ALEMBIC_PLUGIN"] = self.options.build_alembic_plugin + tc.variables["ALEMBIC_FOUND"] = self.options.build_alembic_plugin + tc.variables["PXR_ENABLE_HDF5_SUPPORT"] = self.options.build_alembic_plugin and self.options.enable_hdf5_support + tc.variables["PXR_BUILD_DRACO_PLUGIN"] = self.options.build_draco_plugin + tc.variables["PXR_ENABLE_OSL_SUPPORT"] = self.options.enable_osl_support + tc.variables["PXR_BUILD_ANIMX_TESTS"] = self.options.build_animx_tests + + + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def _patch_sources(self): + rmdir(self, os.path.join(self.source_folder, "cmake", "modules")) + + if self.options.enable_materialx_support: + pxrImagingHdMtlxCMakeListsToUpdate = os.path.join(self.source_folder, "pxr/imaging/hdMtlx/CMakeLists.txt") + replace_in_file(self, pxrImagingHdMtlxCMakeListsToUpdate, "MaterialXCore", "materialx::MaterialXCore") + replace_in_file(self, pxrImagingHdMtlxCMakeListsToUpdate, "MaterialXFormat", "materialx::MaterialXFormat") + pxrImagingHdStCMakeListsToUpdate = os.path.join(self.source_folder, "pxr/imaging/hdSt/CMakeLists.txt") + replace_in_file(self, pxrImagingHdStCMakeListsToUpdate, "MaterialXGenShader", "materialx::MaterialXGenShader") + replace_in_file(self, pxrImagingHdStCMakeListsToUpdate, "MaterialXRender", "materialx::MaterialXRender") + replace_in_file(self, pxrImagingHdStCMakeListsToUpdate, "MaterialXCore", "materialx::MaterialXCore") + replace_in_file(self, pxrImagingHdStCMakeListsToUpdate, "MaterialXFormat", "materialx::MaterialXFormat") + replace_in_file(self, pxrImagingHdStCMakeListsToUpdate, "MaterialXGenGlsl", "materialx::MaterialXGenGlsl") + pxrUsdUsdMtlxCMakeListsToUpdate = os.path.join(self.source_folder, "pxr/usd/usdMtlx/CMakeLists.txt") + replace_in_file(self, pxrUsdUsdMtlxCMakeListsToUpdate, "MaterialXCore", "materialx::MaterialXCore") + replace_in_file(self, pxrUsdUsdMtlxCMakeListsToUpdate, "MaterialXFormat", "materialx::MaterialXFormat") + pxrUsdImagingBinUseBakeMtlxCMakeListsToUpdate = os.path.join(self.source_folder, "pxr/usdImaging/bin/usdBakeMtlx/CMakeLists.txt") + replace_in_file(self, os.path.join(self.source_folder, pxrUsdImagingBinUseBakeMtlxCMakeListsToUpdate), "MaterialXCore", "materialx::MaterialXCore") + replace_in_file(self, os.path.join(self.source_folder, pxrUsdImagingBinUseBakeMtlxCMakeListsToUpdate), "MaterialXFormat", "materialx::MaterialXFormat") + replace_in_file(self, os.path.join(self.source_folder, pxrUsdImagingBinUseBakeMtlxCMakeListsToUpdate), "MaterialXRenderGlsl", "materialx::MaterialXRenderGlsl") + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + # cmake.build() + cmake.build(cli_args=["--verbose"]) + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rm(self, "pxrConfig.cmake", self.package_folder) + rmdir(self, os.path.join(self.package_folder, "cmake")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + + # base + self.cpp_info.components["usd_arch"].libs = ["usd_arch"] + + self.cpp_info.components["usd_gf"].libs = ["usd_gf"] + self.cpp_info.components["usd_gf"].requires = ["usd_arch", "usd_tf"] + + self.cpp_info.components["usd_js"].libs = ["usd_js"] + self.cpp_info.components["usd_js"].requires = ["usd_tf"] + + self.cpp_info.components["usd_plug"].libs = ["usd_plug"] + self.cpp_info.components["usd_plug"].requires = ["usd_arch", "usd_tf", "usd_js", "usd_trace", "usd_work", "onetbb::libtbb"] + + self.cpp_info.components["usd_tf"].libs = ["usd_tf"] + self.cpp_info.components["usd_tf"].requires = ["usd_arch", "onetbb::libtbb"] + # ${WINLIBS} + # ${PYTHON_LIBRARIES} + + self.cpp_info.components["usd_trace"].libs = ["usd_trace"] + self.cpp_info.components["usd_trace"].requires = ["usd_arch", "usd_tf", "usd_js", "onetbb::libtbb"] + + self.cpp_info.components["usd_ts"].libs = ["usd_ts"] + self.cpp_info.components["usd_ts"].requires = ["usd_arch", "usd_gf", "usd_plug", "usd_tf", "usd_trace", "usd_vt"] + + self.cpp_info.components["usd_vt"].libs = ["usd_vt"] + self.cpp_info.components["usd_vt"].requires = ["usd_arch", "usd_tf", "usd_gf", "usd_trace", "onetbb::libtbb"] + + self.cpp_info.components["usd_work"].libs = ["usd_work"] + self.cpp_info.components["usd_work"].requires = ["usd_tf", "usd_trace", "onetbb::libtbb"] + + # imaging + if self.options.build_imaging: + self.cpp_info.components["usd_cameraUtil"].libs = ["usd_cameraUtil"] + self.cpp_info.components["usd_cameraUtil"].requires = ["usd_tf", "usd_gf"] + + if self.options.enable_gl_support: + self.cpp_info.components["usd_garch"].libs = ["usd_garch"] + self.cpp_info.components["usd_garch"].requires = ["usd_arch", "usd_tf"] + # ${X11_LIBRARIES} + # ${OPENGL_gl_LIBRARY} + # ${GARCH_PLATFORM_LIBRARIES} + + self.cpp_info.components["usd_geomUtil"].libs = ["usd_geomUtil"] + self.cpp_info.components["usd_geomUtil"].requires = ["usd_arch", "usd_gf", "usd_tf", "usd_vt", "usd_pxOsd"] + + if self.options.enable_gl_support: + self.cpp_info.components["usd_glf"].libs = ["usd_glf"] + self.cpp_info.components["usd_glf"].requires = ["usd_ar", "usd_arch", "usd_garch", "usd_gf", "usd_hf", "usd_hio", "usd_plug", "usd_tf", "usd_trace", "usd_sdf", "opengl::opengl"] + # ${X11_LIBRARIES} + + self.cpp_info.components["usd_hd"].libs = ["usd_hd"] + self.cpp_info.components["usd_hd"].requires = ["usd_plug", "usd_tf", "usd_trace", "usd_vt", "usd_work", "usd_sdf", "usd_cameraUtil", "usd_hf", "usd_pxOsd", "usd_sdr", "onetbb::libtbb"] + + self.cpp_info.components["usd_hdar"].libs = ["usd_hdar"] + self.cpp_info.components["usd_hdar"].requires = ["usd_hd", "usd_ar"] + + self.cpp_info.components["usd_hdGp"].libs = ["usd_hdGp"] + self.cpp_info.components["usd_hdGp"].requires = ["usd_hd", "usd_hf", "onetbb::libtbb"] + + self.cpp_info.components["usd_hdsi"].libs = ["usd_hdsi"] + self.cpp_info.components["usd_hdsi"].requires = ["usd_plug", "usd_tf", "usd_trace", "usd_vt", "usd_work", "usd_sdf", "usd_cameraUtil", "usd_geomUtil", "usd_hf", "usd_hd", "usd_pxOsd"] + + + if self.options.enable_materialx_support: + self.cpp_info.components["usd_hdMtlx"].libs = ["usd_hdMtlx"] + self.cpp_info.components["usd_hdMtlx"].requires = ["usd_gf", "usd_hd", "usd_sdf", "usd_sdr", "usd_tf", "usd_trace", "usd_usdMtlx", "usd_vt", "usd_vt", "materialx::MaterialXCore", "materialx::MaterialXFormat"] + + self.cpp_info.components["usd_pxOsd"].libs = ["usd_pxOsd"] + self.cpp_info.components["usd_pxOsd"].requires = ["usd_tf", "usd_gf", "usd_vt", "opensubdiv::opensubdiv"] + + if self.options.enable_gl_support and self.options.build_gpu_support: + self.cpp_info.components["usd_hdSt"].libs = ["usd_hdSt"] + self.cpp_info.components["usd_hdSt"].requires = ["usd_hio", "usd_garch", "usd_glf", "usd_hd", "usd_hdsi", "usd_hgiGL", "usd_hgiInterop", "usd_sdr", "usd_tf", "usd_trace", "opensubdiv::opensubdiv"] + if self.options.enable_materialx_support: + self.cpp_info.components["usd_hdSt"].requires.extend(["materialx::MaterialXGenShader", "materialx::MaterialXRender", "materialx::MaterialXCore", "materialx::MaterialXFormat", "materialx::MaterialXGenGlsl", "usd_hdMtlx"]) + if self.options.enable_ptex_support: + self.cpp_info.components["usd_hdSt"].requires.append("ptex::ptex") + + if self.options.enable_gl_support and self.options.build_gpu_support: + self.cpp_info.components["usd_hdx"].libs = ["usd_hdx"] + self.cpp_info.components["usd_hdx"].requires = ["usd_plug", "usd_tf", "usd_vt", "usd_gf", "usd_work", "usd_garch", "usd_glf", "usd_pxOsd", "usd_hd", "usd_hdSt", "usd_hgi", "usd_hgiInterop", "usd_cameraUtil", "usd_sdf"] + if self.options.build_opencolorio_plugin: + self.cpp_info.components["usd_hdx"].requires.append("opencolorio::opencolorio") + + self.cpp_info.components["usd_hf"].libs = ["usd_hf"] + self.cpp_info.components["usd_hf"].requires = ["usd_plug", "usd_tf", "usd_trace"] + + self.cpp_info.components["usd_hgi"].libs = ["usd_hgi"] + self.cpp_info.components["usd_hgi"].requires = ["usd_gf", "usd_plug", "usd_tf", "usd_hio"] + + if self.options.enable_gl_support: + self.cpp_info.components["usd_hgiGL"].libs = ["usd_hgiGL"] + self.cpp_info.components["usd_hgiGL"].requires = ["usd_arch", "usd_garch", "usd_hgi", "usd_tf", "usd_trace"] + + if self.options.enable_gl_support and self.options.build_gpu_support: + self.cpp_info.components["usd_hgiInterop"].libs = ["usd_hgiInterop"] + self.cpp_info.components["usd_hgiInterop"].requires = ["usd_garch", "usd_gf", "usd_tf", "usd_hgi", "usd_vt", "usd_trace"] + if self.options.enable_vulkan_support: + self.cpp_info.components["usd_hgiInterop"].requires.append("usd_hgiVulkan") + if is_apple_os(self): + self.cpp_info.components["usd_hgiInterop"].requires.append("usd_hgiMetal") + + if self.options.build_gpu_support and is_apple_os(self): + self.cpp_info.components["usd_hgiMetal"].libs = ["usd_hgiMetal"] + self.cpp_info.components["usd_hgiMetal"].requires = ["usd_arch", "usd_hgi", "usd_tf", "usd_trace"] + + if self.options.build_gpu_support and self.options.enable_vulkan_support: + self.cpp_info.components["usd_hgiVulkan"].libs = ["usd_hgiVulkan"] + self.cpp_info.components["usd_hgiVulkan"].requires = ["usd_arch", "usd_hgi", "usd_tf", "usd_trace"] + + self.cpp_info.components["usd_hio"].libs = ["usd_hio"] + self.cpp_info.components["usd_hio"].requires = ["usd_arch", "usd_js", "usd_plug", "usd_tf", "usd_vt", "usd_trace", "usd_ar", "usd_hf"] + + if self.options.enable_openvdb_support and self.options.build_gpu_support: + self.cpp_info.components["usd_hioOpenVDB"].libs = ["usd_hioOpenVDB"] + self.cpp_info.components["usd_hioOpenVDB"].requires = ["usd_ar", "usd_gf", "usd_hio", "usd_tf", "usd_usd", "imath::imath", "openvdb::openvdb"] + + # plugins + if self.options.build_openimageio_plugin and self.options.build_gpu_support: + self.cpp_info.components["usd_hioOiio"].libs = ["usd_hioOiio"] + self.cpp_info.components["usd_hioOiio"].requires = ["usd_ar", "usd_arch", "usd_gf", "usd_hio", "usd_tf", "openimageio::openimageio", "imath::imath"] + + if self.options.build_embree_plugin and self.options.build_gpu_support: + self.cpp_info.components["usd_hdEmbree"].libs = ["usd_hdEmbree"] + self.cpp_info.components["usd_hdEmbree"].requires = ["usd_plug", "usd_tf", "usd_vt", "usd_gf", "usd_work", "usd_hf", "usd_hd", "usd_hdx", "onetbb::libtbb", "embree::embree"] + + if self.options.build_usd_imaging: + self.cpp_info.components["usd_usdImaging"].libs = ["usd_usdImaging"] + self.cpp_info.components["usd_usdImaging"].requires = ["usd_gf", "usd_tf", "usd_plug", "usd_trace", "usd_vt", "usd_work", "usd_geomUtil", "usd_hd", "usd_hdar", "usd_hio", "usd_pxOsd", "usd_sdf", "usd_usd", "usd_usdGeom", "usd_usdLux", "usd_usdRender", "usd_usdShade", "usd_usdVol", "usd_ar", "onetbb::libtbb"] + + if self.options.enable_gl_support and self.options.build_gpu_support: + self.cpp_info.components["usd_usdImaging"].libs = ["usd_usdImaging"] + self.cpp_info.components["usd_usdImaging"].requires = ["usd_gf", "usd_tf", "usd_plug", "usd_trace", "usd_vt", "usd_work", "usd_hio", "usd_garch", "usd_glf", "usd_hd", "usd_hdsi", "usd_hdx", "usd_pxOsd", "usd_sdf", "usd_sdr", "usd_usd", "usd_usdGeom", "usd_usdHydra", "usd_usdShade", "usd_usdImaging", "usd_ar", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdProcImaging"].libs = ["usd_usdProcImaging"] + self.cpp_info.components["usd_usdProcImaging"].requires = ["usd_usdImaging", "usd_usdProc"] + + self.cpp_info.components["usd_usdRiPxrImaging"].libs = ["usd_usdRiPxrImaging"] + self.cpp_info.components["usd_usdRiPxrImaging"].requires = ["usd_gf", "usd_tf", "usd_plug", "usd_trace", "usd_vt", "usd_work", "usd_hd", "usd_pxOsd", "usd_sdf", "usd_usd", "usd_usdGeom", "usd_usdLux", "usd_usdShade", "usd_usdImaging", "usd_usdVol", "usd_ar", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdSkelImaging"].libs = ["usd_usdSkelImaging"] + self.cpp_info.components["usd_usdSkelImaging"].requires = ["usd_hio", "usd_hd", "usd_usdImaging", "usd_usdSkel"] + + if self.options.build_usdview: + self.cpp_info.components["usd_usdviewq"].libs = ["usd_usdviewq"] + self.cpp_info.components["usd_usdviewq"].requires = ["usd_tf", "usd_usd", "usd_usdGeom", "usd_hd"] + + self.cpp_info.components["usd_usdVolImaging"].libs = ["usd_usdVolImaging"] + self.cpp_info.components["usd_usdVolImaging"].requires = ["usd_usdImaging"] + + # usd + self.cpp_info.components["usd_ar"].libs = ["usd_ar"] + self.cpp_info.components["usd_ar"].requires = ["usd_arch", "usd_js", "usd_tf", "usd_plug", "usd_vt"] + + self.cpp_info.components["usd_kind"].libs = ["usd_kind"] + self.cpp_info.components["usd_kind"].requires = ["usd_tf", "usd_plug"] + + self.cpp_info.components["usd_ndr"].libs = ["usd_ndr"] + self.cpp_info.components["usd_ndr"].requires = ["usd_tf", "usd_plug", "usd_vt", "usd_work", "usd_ar", "usd_sdf"] + + self.cpp_info.components["usd_pcp"].libs = ["usd_pcp"] + self.cpp_info.components["usd_pcp"].requires = ["usd_tf", "usd_trace", "usd_vt", "usd_sdf", "usd_work", "usd_ar", "onetbb::libtbb"] + + self.cpp_info.components["usd_sdf"].libs = ["usd_sdf"] + self.cpp_info.components["usd_sdf"].requires = ["usd_arch", "usd_tf", "usd_gf", "usd_trace", "usd_vt", "usd_work", "usd_ar"] + + self.cpp_info.components["usd_sdr"].libs = ["usd_sdr"] + self.cpp_info.components["usd_sdr"].requires = ["usd_tf", "usd_vt", "usd_ar", "usd_ndr", "usd_sdf"] + + self.cpp_info.components["usd_usd"].libs = ["usd_usd"] + self.cpp_info.components["usd_usd"].requires = ["usd_arch", "usd_kind", "usd_pcp", "usd_sdf", "usd_ar", "usd_plug", "usd_tf", "usd_trace", "usd_vt", "usd_work", "boost::boost", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdGeom"].libs = ["usd_usdGeom"] + self.cpp_info.components["usd_usdGeom"].requires = ["usd_js", "usd_tf", "usd_plug", "usd_vt", "usd_sdf", "usd_trace", "usd_usd", "usd_work", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdHydra"].libs = ["usd_usdHydra"] + self.cpp_info.components["usd_usdHydra"].requires = ["usd_tf", "usd_usd", "usd_usdShade"] + + self.cpp_info.components["usd_usdLux"].libs = ["usd_usdLux"] + self.cpp_info.components["usd_usdLux"].requires = ["usd_tf", "usd_vt", "usd_ndr", "usd_sdf", "usd_usd", "usd_usdGeom", "usd_usdShade"] + + self.cpp_info.components["usd_usdMedia"].libs = ["usd_usdMedia"] + self.cpp_info.components["usd_usdMedia"].requires = ["usd_tf", "usd_vt", "usd_sdf", "usd_usd", "usd_usdGeom"] + + if self.options.enable_materialx_support: + self.cpp_info.components["usd_usdMtlx"].libs = ["usd_usdMtlx"] + self.cpp_info.components["usd_usdMtlx"].requires = ["usd_arch", "usd_gf", "usd_ndr", "usd_sdf", "usd_sdr", "usd_tf", "usd_vt", "usd_usd", "usd_usdGeom", "usd_usdShade", "usd_usdUI", "usd_usdUtils", "materialx::MaterialXCore", "materialx::MaterialXFormat"] + + self.cpp_info.components["usd_usdPhysics"].libs = ["usd_usdPhysics"] + self.cpp_info.components["usd_usdPhysics"].requires = ["usd_tf", "usd_plug", "usd_vt", "usd_sdf", "usd_trace", "usd_usd", "usd_usdGeom", "usd_usdShade", "usd_work", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdProc"].libs = ["usd_usdProc"] + self.cpp_info.components["usd_usdProc"].requires = ["usd_tf", "usd_usd", "usd_usdGeom"] + + self.cpp_info.components["usd_usdRender"].libs = ["usd_usdRender"] + self.cpp_info.components["usd_usdRender"].requires = ["usd_gf", "usd_tf", "usd_usd", "usd_usdGeom", "usd_usdShade"] + + self.cpp_info.components["usd_usdRi"].libs = ["usd_usdRi"] + self.cpp_info.components["usd_usdRi"].requires = ["usd_tf", "usd_vt", "usd_sdf", "usd_usd", "usd_usdShade", "usd_usdGeom"] + + self.cpp_info.components["usd_usdShade"].libs = ["usd_usdShade"] + self.cpp_info.components["usd_usdShade"].requires = ["usd_tf", "usd_vt", "usd_js", "usd_sdf", "usd_ndr", "usd_sdr", "usd_usd", "usd_usdGeom"] + + self.cpp_info.components["usd_usdSkel"].libs = ["usd_usdSkel"] + self.cpp_info.components["usd_usdSkel"].requires = ["usd_arch", "usd_gf", "usd_tf", "usd_trace", "usd_vt", "usd_work", "usd_sdf", "usd_usd", "usd_usdGeom", "onetbb::libtbb"] + + self.cpp_info.components["usd_usdUI"].libs = ["usd_usdUI"] + self.cpp_info.components["usd_usdUI"].requires = ["usd_tf", "usd_vt", "usd_sdf", "usd_usd"] + + self.cpp_info.components["usd_usdUtils"].libs = ["usd_usdUtils"] + self.cpp_info.components["usd_usdUtils"].requires = ["usd_arch", "usd_tf", "usd_gf", "usd_sdf", "usd_usd", "usd_usdGeom", "usd_usdShade"] + + self.cpp_info.components["usd_usdVol"].libs = ["usd_usdVol"] + self.cpp_info.components["usd_usdVol"].requires = ["usd_tf", "usd_usd", "usd_usdGeom"] diff --git a/recipes/openusd/all/test_package/CMakeLists.txt b/recipes/openusd/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..b89266e39872d1 --- /dev/null +++ b/recipes/openusd/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/openusd/all/test_package/conanfile.py b/recipes/openusd/all/test_package/conanfile.py new file mode 100644 index 00000000000000..62700a47f28cc9 --- /dev/null +++ b/recipes/openusd/all/test_package/conanfile.py @@ -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") diff --git a/recipes/openusd/all/test_package/test_package.cpp b/recipes/openusd/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..a64bf1ea61664d --- /dev/null +++ b/recipes/openusd/all/test_package/test_package.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +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; +} diff --git a/recipes/openusd/config.yml b/recipes/openusd/config.yml new file mode 100644 index 00000000000000..f315de0685de9f --- /dev/null +++ b/recipes/openusd/config.yml @@ -0,0 +1,3 @@ +versions: + "24.05": + folder: all