Blob Blame History Raw
# Force out of source build
%undefine __cmake_in_source_build

%global		upstream_version 3_5_0
#%%global       prerelease RC1

Name:           opensubdiv
Version:        3.5.0
Release:        %autorelease
Summary:        High performance subdivision surface libraries

License:        Apache-2.0
#URL:            http://graphics.pixar.com/%%{name}
Url:		https://github.com/PixarAnimationStudios/OpenSubdiv
Source:	        https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v%{upstream_version}%{?prerelease}/%{name}-%{version}%{?prerelease}.tar.gz

# fix linking against libdl (see https://github.com/PixarAnimationStudios/OpenSubdiv/issues/1196)
Patch:         	%{name}-rpath.patch

BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  graphviz-devel
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glfw3)
BuildRequires:	pkgconfig(OpenCL)
BuildRequires:	pkgconfig(Ptex)
BuildRequires:  pkgconfig(python3)
BuildRequires:  pkgconfig(tbb)
BuildRequires:  pkgconfig(zlib)
BuildRequires:	python3dist(docutils)
BuildRequires:	python3dist(pygments)

%description
OpenSubdiv is a set of open source libraries that implement high performance
subdivision surface (subdiv) evaluation on massively parallel CPU and
GPU architectures. 
This codepath is optimized for drawing deforming subdivs with static topology
at interactive framerates.

%package        libs
Summary:        Core OpenSubdiv libraries
Requires:       %{name}%{?_isa} = %{version}-%{release} 
%description    libs
%{summary}

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package doc
Summary:	High performance subdivision surface libraries
BuildArch:	noarch

%description doc
OpenSubdiv is a set of open source libraries that implement high
performance subdivision surface (subdiv) evaluation on massively
parallel CPU and GPU architectures. 
This code path is optimized for
drawing deforming surfaces with static topology at interactive
frame rates.

This package includes the documentation of OpenSubdiv.

%prep
%autosetup -p1 -n OpenSubdiv-%{upstream_version}%{?prerelease}

# work around linking glitch
# https://github.com/PixarAnimationStudios/OpenSubdiv/issues/1196
sed -i 's|${PLATFORM_GPU_LIBRARIES}|${PLATFORM_GPU_LIBRARIES} ${CMAKE_DL_LIBS}|' opensubdiv/CMakeLists.txt
	
%build
%cmake \
       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
       -DCMAKE_LIBDIR_BASE=%{_libdir} \
       -DGLEW_LOCATION=%{_libdir} \
       -DGLFW_LOCATION=%{_libdir} \
       -DNO_CLEW=1 \
       -DNO_CUDA=1 \
       -DNO_EXAMPLES=1 \
       -DNO_GLFW_X11=1 \
       -DNO_OPENCL=1 \
       -DNO_METAL=1 \
       -DNO_REGRESSION=1 \
       -DNO_TUTORIALS=1 \
       -DOpenGL_GL_PREFERENCE=GLVND \
       -DTBB_LOCATION=%{_libdir}
%cmake_build

%{?_with_tests:
%check
make test V=1
}

%install
%cmake_install

# Remove static files
find %{buildroot} -name '*.la' -delete
find %{buildroot} -name '*.a' -delete

#%%files
#%%license LICENSE.txt
#%%{_bindir}/stringify

%files libs
%license LICENSE.txt
%doc README.md
%{_libdir}/*.so.%{version}

%files devel
%doc NOTICE.txt README.md
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/cmake/OpenSubdiv/

%files doc
%{_docdir}/%{name}/

%changelog
%autochangelog