File vsgExamples.spec of Package vsgExamples

#
# spec file for package vsgExamples
#
# Copyright (c) 2021 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/
#

%define addprofile 1

Name:           vsgExamples
Version:        0.0.0
Release:        0
Summary:        3D graphics toolkit
License:        MIT
Group:          Productivity/Graphics/Other
URL:            https://vsg-dev.github.io/VulkanSceneGraph
Source0:        https://github.com/vsg-dev/%{name}/archive/%{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libvsg-devel
BuildRequires:  libvsgImGui-devel
BuildRequires:  libvsgXchange-devel
BuildRequires:  pkgconfig(xcb)
BuildRequires:  vulkan-devel
Requires:       %name-data = %version

%description
Example programs that test and illustrate how to use the VulkanSceneGraph and optional add-on libraries

%package data
Summary:        3D graphics toolkit - data files for examples
License:        MIT
Group:          Productivity/Graphics/Other

%description data
Example programs that test and illustrate how to use the VulkanSceneGraph and optional add-on libraries

This package contains the data files required by the examples

%prep
%autosetup -p1 -n %{name}-%{version}

%build
%cmake -DCMAKE_RELWITHDEBINFO_POSTFIX=
%cmake_build

%install
%cmake_install

# install data files
prjdatadir=%_datadir/%name
mkdir -p %buildroot$prjdatadir
cp -av data/* %buildroot$prjdatadir

%if %addprofile
# setup VSG_FILE_PATH
profiledir=%_sysconfdir/profile.d
mkdir -p %buildroot/$profiledir
cat << EOF > %buildroot/$profiledir/%{name}.sh
export VSG_FILE_PATH=$prjdatadir
EOF
%endif

%files
%defattr(-,root,root)
%{_bindir}/vsg*

%files data
%defattr(-,root,root)
%dir %_datadir/%name
%_datadir/%name
%if %addprofile
%_sysconfdir/profile.d
%endif

%changelog
openSUSE Build Service is sponsored by