File MaterialX.spec of Package MaterialX
#
# spec file for package MaterialX
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} == 1500
%global force_gcc_version 14
%endif
%global materialx_prefix %{_libdir}/%{name}
%global __builder ninja
Name: MaterialX
Version: 1.38.8
Release: 0
Summary: An open standard for the exchange of rich material and look-development content
License: Apache-2.0
URL: http://www.materialx.org/
BuildRequires: gcc%{?force_gcc_version}-c++
BuildRequires: gcc%{?force_gcc_version}
BuildRequires: cmake
BuildRequires: ninja
BuildRequires: pkgconfig(glfw3)
BuildRequires: cmake(OpenColorIO)
BuildRequires: pkgconfig(xt)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xcursor)
BuildRequires: pkgconfig(xi)
BuildRequires: python3-pybind11-devel
BuildRequires: python3-devel
BuildRequires: pkgconfig(wayland-client) >= 0.2.7
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(wayland-protocols) >= 1.15
BuildRequires: hicolor-icon-theme
BuildRequires: kf6-extra-cmake-modules
%description
MaterialX is an open standard for representing rich material and
look-development content in computer graphics, enabling its
platform-independent description and exchange across applications and
renderers. Launched at Industrial Light & Magic in 2012, MaterialX has been a
key technology in their feature films and real-time experiences since Star
Wars: The Force Awakens and Millennium Falcon: Smugglers Run. The project was
released as open source in 2017, with companies including Sony Pictures
Imageworks, Pixar, Autodesk, Adobe, and SideFX contributing to its ongoing
development. In 2021, MaterialX became the seventh hosted project of the
Academy Software Foundation.
%package devel
Summary: Development files for MaterialX
Requires: %{name} = %{version}
Requires: pkgconfig(xt)
%description devel
MaterialX is an open standard for representing rich material and
look-development content in computer graphics, enabling its
platform-independent description and exchange across applications and
renderers. Launched at Industrial Light & Magic in 2012, MaterialX has been a
key technology in their feature films and real-time experiences since Star
Wars: The Force Awakens and Millennium Falcon: Smugglers Run. The project was
released as open source in 2017, with companies including Sony Pictures
Imageworks, Pixar, Autodesk, Adobe, and SideFX contributing to its ongoing
development. In 2021, MaterialX became the seventh hosted project of the
Academy Software Foundation.
This package holds the development files
%prep
mv %{_sourcedir}/%{name}-%{version} %{_builddir}/%{name}-%{version}
%autosetup -p1 -D -T 0
%build
%if 0%{?force_gcc_version}
export CC="gcc-%{?force_gcc_version}"
export CXX="g++-%{?force_gcc_version}"
%endif
sed -i 's|CMAKE_INSTALL_PREFIX|CMAKE_BINARY_DIR|g' python/CMakeLists.txt
sed -i 's|resources|%{matrix_datadir}/resources|g' \
source/MaterialXView/{Main.cpp,Viewer.cpp} \
source/MaterialXGraphEditor/{Main.cpp,Graph.cpp}
sed -i 's|"libraries"|"%{matrix_datadir}/libraries"|g' \
source/MaterialXGraphEditor/{Main.cpp,Graph.cpp} \
source/MaterialXGenShader/GenOptions.h \
source/MaterialXView/Main.cpp
%cmake \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_INSTALL_PREFIX:PATH=%{materialx_prefix} \
-DLIB_INSTALL_DIR:PATH=%{materialx_prefix}/%{_lib} \
-Wno-dev \
-DMATERIALX_INSTALL_LIB_PATH=%{_lib} \
%if %{with glfw_use_wayland}
-DGLFW_USE_WAYLAND:BOOL=ON \
%else
-DGLFW_USE_WAYLAND:BOOL=OFF \
%endif
%if %{with python}
-DMATERIALX_PYTHON_FOLDER_NAME=%{python3_sitearch}/%{name}/ \
-DMATERIALX_BUILD_PYTHON=ON \
%else
-DMATERIALX_BUILD_PYTHON=OFF \
%endif
-DMATERIALX_BUILD_SHARED_LIBS=ON \
-DMATERIALX_BUILD_VIEWER=ON \
-DMATERIALX_BUILD_GRAPH_EDITOR=ON \
%{nil}
%cmake_build
%install
%cmake_install
mkdir -p %{buildroot}%{_libdir}/cmake/MaterialX %{buildroot}%{_bindir} %{buildroot}%{_includedir}
mv \
%{buildroot}%{materialx_prefix}/%{_lib}/*.so* \
%{buildroot}%{_libdir}
mv \
%{buildroot}%{materialx_prefix}/include/* \
%{buildroot}%{_includedir}/
ln -sf \
%{materialx_prefix}/%{_lib}/cmake/MaterialX/{MaterialXConfig.cmake,MaterialXConfigVersion.cmake,MaterialXTargets-relwithdebinfo.cmake,MaterialXTargets.cmake} \
%{buildroot}%{_libdir}/cmake/MaterialX/
ln -sf \
%{materialx_prefix}/bin/MaterialXGraphEditor \
%{materialx_prefix}/bin/MaterialXView \
%{buildroot}%{_bindir}
rm %{buildroot}%{materialx_prefix}/*.md %{buildroot}%{materialx_prefix}/LICENSE
perl -p -i -e 's|(get_filename_component\(_realCurr ")\$\{CMAKE_CURRENT_LIST_DIR\}(" REALPATH\))|$1%{materialx_prefix}/%{_lib}/cmake/MaterialX$2|g' \
%{buildroot}%{materialx_prefix}/%{_lib}/cmake/MaterialX/MaterialXConfig.cmake
%check
%ctest
%ldconfig_scriptlets
%files
%dir %{materialx_prefix}
%{materialx_prefix}/bin/
%{materialx_prefix}/libraries/
%{materialx_prefix}/resources/
%{_bindir}/MaterialXGraphEditor
%{_bindir}/MaterialXView
%{_libdir}/libMaterialXCore.so.*
%{_libdir}/libMaterialXFormat.so.*
%{_libdir}/libMaterialXGenGlsl.so.*
%{_libdir}/libMaterialXGenMdl.so.*
%{_libdir}/libMaterialXGenMsl.so.*
%{_libdir}/libMaterialXGenOsl.so.*
%{_libdir}/libMaterialXGenShader.so.*
%{_libdir}/libMaterialXRender.so.*
%{_libdir}/libMaterialXRenderGlsl.so.*
%{_libdir}/libMaterialXRenderHw.so.*
%{_libdir}/libMaterialXRenderOsl.so.*
%files devel
%{_includedir}/%{name}*
%dir %{materialx_prefix}/%{_lib}/
%dir %{materialx_prefix}/%{_lib}/cmake/
%{materialx_prefix}/%{_lib}/cmake/MaterialX/
%{_libdir}/cmake/MaterialX/
%{_libdir}/libMaterialXCore.so
%{_libdir}/libMaterialXFormat.so
%{_libdir}/libMaterialXGenGlsl.so
%{_libdir}/libMaterialXGenMdl.so
%{_libdir}/libMaterialXGenMsl.so
%{_libdir}/libMaterialXGenOsl.so
%{_libdir}/libMaterialXGenShader.so
%{_libdir}/libMaterialXRender.so
%{_libdir}/libMaterialXRenderGlsl.so
%{_libdir}/libMaterialXRenderHw.so
%{_libdir}/libMaterialXRenderOsl.so
%changelog