Add cmake options

This commit is contained in:
sagitter 2018-10-15 10:42:48 +02:00
parent 2fd343076f
commit ab30a7b3bd

View File

@ -107,15 +107,13 @@
%if %{?__isa_bits:%{__isa_bits}}%{!?__isa_bits:32} == 64
%if 0%{?el6}
%bcond_with arch64
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
%else
%bcond_without arch64
%endif
%else
%bcond_with arch64
%endif
%if 0%{?el6}
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
%endif
%if %{with arch64}
%bcond_without blas64
@ -166,7 +164,7 @@ BuildRequires: blas-devel
BuildRequires: lapack-devel
%endif
%endif
BuildRequires: gcc, gcc-c++
BuildRequires: gcc, gcc-c++, cmake3
BuildRequires: gcc-gfortran
BuildRequires: libX11-devel
BuildRequires: python2-devel, python2-sphinx
@ -412,6 +410,7 @@ CFLAGS="$CFLAGS -O3" CXXFLAGS="$CXXFLAGS -O3" FFLAGS="$FFLAGS -O3" LDFLAGS="$LDF
--CC_LINKER_FLAGS="$LDFLAGS -lgfortran" \
--FC_LINKER_FLAGS="$LDFLAGS -lgfortran" \
--with-default-arch=0 --with-make=1 \
--with-cmake-exec=%{_bindir}/cmake3 --with-ctest-exec=%{_bindir}/ctest3 \
--with-single-library=1 \
--with-precision=double \
--with-petsc-arch=%{_arch} \
@ -498,6 +497,7 @@ CFLAGS="$CFLAGS -O3" CXXFLAGS="$CXXFLAGS -O3" FFLAGS="$FFLAGS -O3" LDFLAGS="$LDF
--CC_LINKER_FLAGS="$LDFLAGS -lgfortran" \
--FC_LINKER_FLAGS="$LDFLAGS -lgfortran" \
--with-default-arch=0 --with-make=1 \
--with-cmake-exec=%{_bindir}/cmake3 --with-ctest-exec=%{_bindir}/ctest3 \
--with-single-library=1 \
--with-precision=double \
--with-petsc-arch=%{_arch} \
@ -561,6 +561,7 @@ CFLAGS="$CFLAGS -O3" CXXFLAGS="$CXXFLAGS -O3" FFLAGS="$FFLAGS -O3" LDFLAGS="$LDF
--CC_LINKER_FLAGS="$LDFLAGS -lgfortran -L$MPI_LIB -lmpi_mpifh" \
--FC_LINKER_FLAGS=" -lgfortran" \
--with-default-arch=0 --with-make=1 \
--with-cmake-exec=%{_bindir}/cmake3 --with-ctest-exec=%{_bindir}/ctest3 \
--with-single-library=1 \
--with-precision=double \
--with-petsc-arch=%{_arch} \
@ -674,6 +675,7 @@ CFLAGS="$CFLAGS -O3" CXXFLAGS="$CXXFLAGS -O3" FFLAGS="$FFLAGS -O3" LDFLAGS="$LDF
--CC_LINKER_FLAGS="$LDFLAGS -lgfortran -L$MPI_LIB -lmpichf90" \
--FC_LINKER_FLAGS=" -lgfortran" \
--with-default-arch=0 --with-make=1 \
--with-cmake-exec=%{_bindir}/cmake3 --with-ctest-exec=%{_bindir}/ctest3 \
--with-single-library=1 \
--with-precision=double \
--with-petsc-arch=%{_arch} \
@ -954,11 +956,11 @@ export PETSC_ARCH=%{_arch}
%if %{with debug}
export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes"
make -C %{name}-%{version} test MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/bin/petscmpiexec -valgrind'
%else
export CFLAGS="-O0 -g -Wl,-z,now -fPIC"
export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC"
export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules"
make -C %{name}-%{version} test MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/bin/petscmpiexec -valgrind'
%else
make -C %{name}-%{version} test
%endif
@ -968,46 +970,54 @@ export PETSC_DIR=%{_builddir}/%{name}-%{version}/build64
export PETSC_ARCH=%{_arch}
## 'make test' needs to link against -lpetsc
## Not elegant fix
## Crude fix:
ln -s %{_builddir}/%{name}-%{version}/build64/%{_arch}/lib/libpetsc64.so %{_builddir}/%{name}-%{version}/build64/%{_arch}/lib/libpetsc.so
%if %{with debug}
export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes"
make -C build64 test MPIEXEC='%{_builddir}/%{name}-%{version}/build64/bin/petscmpiexec -valgrind'
%else
export CFLAGS="-O0 -g -Wl,-z,now -fPIC"
export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC"
export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules"
make -C build64 test MPIEXEC='%{_builddir}/%{name}-%{version}/build64/bin/petscmpiexec -valgrind'
%else
make -C build64 test
%endif
%endif
%if %{with openmpi}
%{_openmpi_load}
export LD_LIBRARY_PATH=$MPI_LIB:%{_libdir}:%{_builddir}/%{name}-%{version}/buildopenmpi_dir/%{_arch}/lib
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/buildopenmpi_dir/%{_arch}/lib
export PETSC_DIR=%{_builddir}/%{name}-%{version}/buildopenmpi_dir
export PETSC_ARCH=%{_arch}
export MPI_INTERFACE_HOSTNAME=localhost
%if %{with debug}
export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes"
export CFLAGS="-O0 -g -Wl,-z,now -fPIC"
export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC"
export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules"
make -C buildopenmpi_dir test MPIEXEC='%{_builddir}/%{name}-%{version}/buildopenmpi_dir/bin/petscmpiexec -valgrind'
%else
make -C buildopenmpi_dir test
%endif
%{_openmpi_unload}
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
%if %{with mpich}
%{_mpich_load}
export LD_LIBRARY_PATH=$MPI_LIB:%{_libdir}:%{_builddir}/%{name}-%{version}/buildmpich_dir/%{_arch}/lib
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/buildmpich_dir/%{_arch}/lib
export PETSC_DIR=%{_builddir}/%{name}-%{version}/buildmpich_dir
export PETSC_ARCH=%{_arch}
export MPI_INTERFACE_HOSTNAME=localhost
%if %{with debug}
export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes"
export CFLAGS="-O0 -g -Wl,-z,now -fPIC"
export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC"
export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules"
make -C buildmpich_dir test MPIEXEC='%{_builddir}/%{name}-%{version}/buildmpich_dir/bin/petscmpiexec -valgrind'
%else
make -C buildmpich_dir test
%endif
%{_mpich_unload}
%endif
%endif