Skip to content

Commit

Permalink
sci-chemistry/gromacs: Allow to build with clang
Browse files Browse the repository at this point in the history
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Alexey Shvetsov <[email protected]>
  • Loading branch information
alexxy committed Feb 16, 2022
1 parent 5fa4239 commit c870026
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ HOMEPAGE="http://www.gromacs.org/"
# base, vmd plugins, fftpack from numpy, blas/lapck from netlib, memtestG80 library, mpi_thread lib
LICENSE="LGPL-2.1 UoI-NCSA !mkl? ( !fftw? ( BSD ) !blas? ( BSD ) !lapack? ( BSD ) ) cuda? ( LGPL-3 ) threads? ( BSD )"
SLOT="0/${PV}"
IUSE="blas cuda +custom-cflags +doc build-manual double-precision +fftw +gmxapi +gmxapi-legacy +hwloc lapack mkl mpi +offensive opencl openmp +python +single-precision test +threads +tng ${ACCE_IUSE}"
IUSE="blas clang clang-cuda cuda +custom-cflags +doc build-manual double-precision +fftw +gmxapi +gmxapi-legacy +hwloc lapack mkl mpi +offensive opencl openmp +python +single-precision test +threads +tng ${ACCE_IUSE}"

CDEPEND="
blas? ( virtual/blas )
Expand All @@ -54,6 +54,7 @@ CDEPEND="
"
BDEPEND="${CDEPEND}
virtual/pkgconfig
clang? ( >=sys-devel/clang-6:* )
build-manual? (
app-doc/doxygen
$(python_gen_cond_dep '
Expand All @@ -73,6 +74,7 @@ REQUIRED_USE="
doc? ( !build-manual )
cuda? ( single-precision )
cuda? ( !opencl )
clang-cuda? ( clang cuda )
mkl? ( !blas !fftw !lapack )
${PYTHON_REQUIRED_USE}"

Expand Down Expand Up @@ -114,6 +116,19 @@ src_prepare() {

xdg_environment_reset #591952

# we can use clang as default
if use clang && ! tc-is-clang ; then
export CC=${CHOST}-clang
export CXX=${CHOST}-clang++
else
tc-export CXX CC
fi
# clang-cuda need to filter mfpmath
if use clang-cuda ; then
filter-mfpmath sse
filter-mfpmath i386
fi

cmake_src_prepare

use cuda && cuda_src_prepare
Expand Down Expand Up @@ -231,6 +246,7 @@ src_configure() {
[[ ${x} = "double" ]] && p="-DGMX_DOUBLE=ON" || p="-DGMX_DOUBLE=OFF"
local gpu=( "-DGMX_GPU=OFF" )
[[ ${x} = "float" ]] && use cuda && gpu=( "-DGMX_GPU=CUDA" )
[[ ${x} = "float" ]] && use cuda-clang && gpu=( "-DGMX_GPU=CUDA" "-DGMX_CLANG_CUDA=ON" )
use opencl && gpu=( "-DGMX_GPU=OPENCL" )
mycmakeargs=(
${mycmakeargs_pre[@]} ${p}
Expand Down
2 changes: 2 additions & 0 deletions sci-chemistry/gromacs/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</maintainer>
<use>
<flag name="build-manual">Build manual instead of downloading it</flag>
<flag name="clang">Build gromacs with Clang instead of default compiler</flag>
<flag name="clang-cuda">Use clang for cuda units compilation</flag>
<flag name="cuda">Enable cuda non-bonded kernels</flag>
<flag name="double-precision">More precise calculations at the expense of speed</flag>
<flag name="gmxapi">Add support for gmxapi library</flag>
Expand Down

0 comments on commit c870026

Please sign in to comment.