%global forgeurl https://github.com/dreamworksanimation %global cmodver 1.0.0.5 # Core Dump Fix %global optflags %(echo '%optflags' | sed s/-Wp,-D_GLIBCXX_ASSERTIONS//) # CUDA/Optix Support %bcond gpu 0 %bcond tests 1 Name: moonray Version: 16.36.0.0 Release: %{autorelease} Summary: MoonRay render engine and the moonray command-line renderer License: Apache-2.0 URL: https://openmoonray.org/ Source0: %{forgeurl}/%{name}/archive/refs/tags/%{name}-%{version}.tar.gz Source1: %{forgeurl}/cmake_modules/archive/refs/tags/cmake_modules-%{cmodver}.tar.gz Patch0: %{name}-includes.patch Patch1: %{name}-tbb.patch %if %{with gpu} Patch2: %{name}-optix.patch %endif BuildRequires: cmake >= 3.23.1 BuildRequires: gcc-c++ BuildRequires: ispc BuildRequires: libatomic BuildRequires: bison BuildRequires: flex BuildRequires: openvdb-devel BuildRequires: cppunit-devel BuildRequires: boost-devel BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(libjpeg) BuildRequires: OpenEXR BuildRequires: pkgconfig(OpenEXR) BuildRequires: cmake(OpenSubdiv) BuildRequires: cmake(embree) BuildRequires: Random123-devel BuildRequires: cmake(OpenImageIO) BuildRequires: tbb-devel %if %{with gpu} BuildRequires: nvidia-sdk-optix >= 8.0.0 BuildRequires: cuda-nvcc %endif BuildRequires: cmake(McrtDenoise) = 5.22.0.0 BuildRequires: cmake(SceneRdl2) = 14.22.0.0 Provides: Moonray = %{version} %description MoonRay render engine and the moonray command-line renderer. The code is comprised of roughly 20 libraries. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: boost-devel %if %{with gpu} Requires: nvidia-sdk-optix >= 8.0.0 %endif Requires: libatomic Requires: openvdb-devel Requires: pkgconfig(zlib) Requires: pkgconfig(libjpeg) Requires: OpenEXR Requires: pkgconfig(OpenEXR) Requires: cmake(OpenSubdiv) Requires: cmake(embree) Requires: Random123-devel Requires: cmake(OpenImageIO) Requires: tbb-devel Requires: tbb-devel Requires: cmake(McrtDenoise) = 5.22.0.0 Requires: cmake(SceneRdl2) = 14.22.0.0 %description devel The %{name}-devel package contains libraries and header files of %{name}, required to build other parts of OpenMoonRay. %prep %autosetup -p1 -n %{name}-%{name}-%{version} mkdir -p cmake_modules tar -xzf %{SOURCE1} --strip-components=1 -C $_ # Restructure sed -i 's|\bshaders\b|${CMAKE_INSTALL_LIBDIR}/openmoonray/shaders|g' \ lib/rendering/rt/CMakeLists.txt sed -i 's|/shaders|%{_libdir}/openmoonray/shaders|g' \ lib/rendering/rt/gpu/optix/OptixGPUAccelerator.cc sed -i 's|rdl2dso)|%{_libdir}/openmoonray/rdl2dso)|g' \ CMakeLists.txt sed -i 's|${COMPILER_LIBRARY_DIR}|%{_libdir}|g' \ CMakeLists.txt sed -i 's|\bcoredata\b|%{_libdir}/openmoonray/coredata|g' \ cmake_modules/cmake/MoonrayDso.cmake %build %if %{with gpu} export NVCC_PREPEND_FLAGS='-allow-unsupported-compiler' %endif CMAKE_MODULES_ROOT=%{_builddir}/%{buildsubdir}/cmake_modules \ ARRAS_SESSION_PATH=%{_libdir}/openmoonray/sessions \ %cmake \ -DCMAKE_MODULE_PATH=${CMAKE_MODULES_ROOT}/cmake \ -DBUILD_TESTING=%{expr:%{with tests}?"ON":"OFF"} \ -DCMAKE_EXE_LINKER_FLAGS:STRING='-Wl,-O1,--sort-common,-z,relro,-z,now' \ %if %{with gpu} -DOptiX_INCLUDE_DIRS=/usr/include/optix \ -DCMAKE_CUDA_COMPILER=%{_bindir}/nvcc \ -DCMAKE_CUDA_FLAGS="-Xcompiler -fPIC" \ %endif -DMOONRAY_USE_OPTIX=%{expr:%{with gpu}?"ON":"OFF"} %cmake_build %install %cmake_install # List shaders. It will be used to remove the generated json files on post-uninstall scriptlet. ls %{buildroot}%{_libdir}/openmoonray/rdl2dso \ | grep -v '\.proxy$' \ | sed 's/\.[^.]*$/.json/' \ > %{buildroot}%{_libdir}/openmoonray/%{name}_shaders.txt %post # Build shader class descriptions RDL2_DSO_PATH=%{_libdir}/openmoonray/rdl2dso \ %{_bindir}/rdl2_json_exporter --rdl2_version "14.22.0.0" --moonray_version "16.36.0.0" --out %{_libdir}/openmoonray/shader_json/ --sparse %preun cd %{_libdir}/openmoonray/shader_json xargs rm < %{_libdir}/openmoonray/%{name}_shaders.txt find %{_libdir}/openmoonray -maxdepth 0 -type d -empty -exec rmdir {} \; %files %license LICENSE %{_bindir}/{denoise,moonray} %{_libdir}/lib{application,bvh_shading_ispc,deepfile,grid_engine_tool,map_primvar,statistics,texturing_sampler}.so %{_libdir}/libcommon_{file_resource,mcrt_util}.so %{_libdir}/librendering_{bvh_shading,displayfilter,geom,lpe,mcrt_common,pbr,rndr,rt,shading}.so %{_libdir}/libshading_{eval_ispc,ispc}.so %{_libdir}/openmoonray/{rdl2dso,coredata} %if %{with gpu} %{_libdir}/openmoonray/shaders/OptixGPUPrograms.ptx %endif %files devel %{_includedir}/%{name} %{_libdir}/cmake/Moonray-%(echo %{version} | sed 's/\(.*\)\.[0-9]*$/\1/').0 %changelog %autochangelog