2013-08-16 11:35:44 +02:00
|
|
|
#
|
|
|
|
# Macros for cmake
|
|
|
|
#
|
|
|
|
%__cmake %{_bindir}/cmake
|
2014-08-18 10:21:42 +02:00
|
|
|
%__ctest %{_bindir}/ctest
|
2016-03-08 08:29:07 +01:00
|
|
|
%__builddir build
|
2016-08-26 12:34:52 +02:00
|
|
|
%__builder %__make
|
2016-09-26 13:02:24 +02:00
|
|
|
%__sourcedir .
|
2013-08-16 11:35:44 +02:00
|
|
|
|
|
|
|
%cmake \
|
2016-09-10 08:48:32 +02:00
|
|
|
find %__sourcedir -name CMakeLists.txt \\\
|
2014-07-02 10:57:25 +02:00
|
|
|
-exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\\\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\\\)/{s/^/#IGNORE /}' {} + \
|
2016-03-08 08:29:07 +01:00
|
|
|
mkdir -p %__builddir \
|
|
|
|
cd %__builddir \
|
2016-09-26 13:02:24 +02:00
|
|
|
%__cmake $OLDPWD/%__sourcedir \\\
|
2016-08-26 12:34:52 +02:00
|
|
|
%if "%__builder" == "%__make" \
|
|
|
|
-G"Unix Makefiles" \\\
|
|
|
|
%else \
|
|
|
|
-GNinja \\\
|
|
|
|
%endif \
|
2013-08-16 11:35:44 +02:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
|
|
|
|
-DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
|
|
|
|
-DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
|
|
|
|
-DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
|
|
|
|
-DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\\
|
2015-11-13 10:24:59 +01:00
|
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
|
2016-08-26 12:34:52 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
|
2016-07-11 19:29:16 +02:00
|
|
|
-DCMAKE_C_FLAGS="${CFLAGS:-%optflags} -DNDEBUG" \\\
|
|
|
|
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags} -DNDEBUG" \\\
|
|
|
|
-DCMAKE_Fortran_FLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}} -DNDEBUG" \\\
|
|
|
|
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
2018-01-04 13:34:02 +01:00
|
|
|
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed" \\\
|
2016-07-11 19:29:16 +02:00
|
|
|
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \\\
|
2013-08-16 11:35:44 +02:00
|
|
|
%if "%{?_lib}" == "lib64" \
|
|
|
|
-DLIB_SUFFIX=64 \\\
|
|
|
|
%endif \
|
|
|
|
-DCMAKE_SKIP_RPATH:BOOL=ON \\\
|
|
|
|
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
|
|
|
|
-DBUILD_SHARED_LIBS:BOOL=ON \\\
|
|
|
|
-DBUILD_STATIC_LIBS:BOOL=OFF \\\
|
|
|
|
-DCMAKE_COLOR_MAKEFILE:BOOL=OFF \\\
|
|
|
|
-DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \\\
|
2015-12-03 10:46:18 +01:00
|
|
|
-DCMAKE_MODULES_INSTALL_DIR=%{_datadir}/cmake/Modules
|
2013-08-16 11:35:44 +02:00
|
|
|
|
2014-08-20 12:42:37 +02:00
|
|
|
%make_jobs \
|
2016-08-26 12:34:52 +02:00
|
|
|
%if "%__builder" == "%__make" \
|
|
|
|
%__make %{?_smp_mflags} VERBOSE=1 \
|
|
|
|
%else \
|
|
|
|
ninja -v %{?_smp_mflags} \
|
|
|
|
%endif
|
2014-08-20 12:42:37 +02:00
|
|
|
|
2013-08-16 11:35:44 +02:00
|
|
|
%cmake_install \
|
2016-08-26 12:34:52 +02:00
|
|
|
DESTDIR=%{buildroot} %__builder install -C %__builddir
|
2014-08-18 10:21:42 +02:00
|
|
|
|
|
|
|
%ctest \
|
2016-03-08 08:29:07 +01:00
|
|
|
cd %__builddir \
|
2014-08-18 10:21:42 +02:00
|
|
|
%__ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} \
|
|
|
|
cd ..
|