Skip to content

Commit

Permalink
(conan-io#25178) Upgrade MaterialX to 1.39.1 release
Browse files Browse the repository at this point in the history
* Upgrade MaterialX to 1.39.1 release

* Fix Cmake version and hardcoded cxx standards

* Fix Cmake version and hardcoded cxx standards

---------

Co-authored-by: Abril Rincón Blanco <[email protected]>
  • Loading branch information
2 people authored and OMGtechy committed Dec 31, 2024
1 parent 1e89d71 commit 16b4ffe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions recipes/materialx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.39.1":
url: "https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v1.39.1.tar.gz"
sha256: "a392fd0aa372bbea7a6f27d20160829ec9380a801976ff467949a90e6555258d"
"1.38.10":
url: "https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v1.38.10.tar.gz"
sha256: "706f44100188bc283a135ad24b348e55b405ac9e70cb64b7457c381383cc2887"
25 changes: 20 additions & 5 deletions recipes/materialx/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, export_conandata_patches, get, rm, rmdir
from conan.tools.files import copy, export_conandata_patches, get, rm, rmdir, replace_in_file
from conan.tools.apple import is_apple_os
from conan.tools.scm import Version
import os
Expand Down Expand Up @@ -35,7 +35,10 @@ class MaterialXConan(ConanFile):

@property
def _min_cppstd(self):
return 14
if Version(self.version) >= "1.39.0":
return 17
else:
return 14

@property
def _compilers_minimum_version(self):
Expand All @@ -59,12 +62,11 @@ def configure(self):
self.options.rm_safe("fPIC")

def layout(self):
# src_folder must use the same source folder name the project
cmake_layout(self, src_folder="src")

def requirements(self):
if self.options.with_openimageio:
self.requires("openimageio/2.5.10.1")
self.requires("openimageio/2.5.14.0")
if self.settings.os in ["Linux", "FreeBSD"]:
self.requires("xorg/system")
self.requires("opengl/system")
Expand All @@ -80,7 +82,7 @@ def validate(self):
)

def build_requirements(self):
self.tool_requires("cmake/[>=3.16 <4]")
self.tool_requires("cmake/[>=3.24 <4]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -91,12 +93,25 @@ def generate(self):
tc.variables["MATERIALX_TEST_RENDER"] = False
tc.variables["MATERIALX_BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["MATERIALX_BUILD_GEN_MSL"] = self.options.build_gen_msl and is_apple_os
# TODO: Remove when Conan 1 support is dropped
if not self.settings.compiler.cppstd:
tc.variables["MATERIALX_BUILD_USE_CCACHE"] = self._min_cppstd
tc.variables["MATERIALX_BUILD_USE_CCACHE"] = False
tc.generate()

tc = CMakeDeps(self)
tc.generate()

def _patch_sources(self):
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"set(CMAKE_CXX_STANDARD",
"# set(CMAKE_CXX_STANDARD")
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"set(CMAKE_POSITION_INDEPENDENT_CODE",
"# set(CMAKE_POSITION_INDEPENDENT_CODE")

def build(self):

cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down
2 changes: 2 additions & 0 deletions recipes/materialx/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.39.1":
folder: all
"1.38.10":
folder: all

0 comments on commit 16b4ffe

Please sign in to comment.