Date: Tue, 2 Mar 2021 21:16:04 +0000 (UTC) From: Thierry Thomas <thierry@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r566983 - head/Mk/Uses Message-ID: <202103022116.122LG4m8062888@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thierry Date: Tue Mar 2 21:16:04 2021 New Revision: 566983 URL: https://svnweb.freebsd.org/changeset/ports/566983 Log: Adding a new helper for MPI. Its aim is to simplify the use of MPI in the ports Makefile. It makes it easier to provide an option for the user to choose between MPICH and OpenMPI when applicable. Note: mpich2 and openmpi3 are not handled, because they will be deprecated. Differential Revision: D28210 Added: head/Mk/Uses/mpi.mk (contents, props changed) Added: head/Mk/Uses/mpi.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Mk/Uses/mpi.mk Tue Mar 2 21:16:04 2021 (r566983) @@ -0,0 +1,67 @@ +# $FreeBSD$ +# +# Handle dependencies on MPICH / OpenMPI +# +# Feature: mpi +# Usage: USES=mpi or USES=mpi:ARGS +# Valid ARGS: mpich (default) openmpi +# Note: mpich2 and openmpi3 are not handled +# +# Provides: MPI_LIBS MPI_CFLAGS MPICC MPICXX MPIF90 MPIFC MPI_HOME \ +# MPIEXEC MPIRUN +# Sets: LIB_DEPENDS +# + CMAKE_ARGS if cmake is enabled to drive FindMPI.cmake +# +# Maintainer: thierry@FreeBSD.org + +.if !defined(_INCLUDE_USES_MPI_MK) +_INCLUDE_USES_MPI_MK= yes + +_valid_ARGS= mpich openmpi + +_DEFAULT_MPI= mpich + +.if empty(mpi_ARGS) +mpi_ARGS= ${_DEFAULT_MPI} +.endif + +.if ! ${USES:Mpkgconfig} +USES+= pkgconfig +.endif + +.if ${mpi_ARGS} == mpich +LIB_DEPENDS+= libmpich.so:net/mpich +MPI_HOME= ${LOCALBASE} +MPI_LIBS+= `pkgconf --libs mpich` +. if ${USES:Mfortran} +MPI_LIBS+= -lmpifort +MPIFC= ${MPI_HOME}/bin/mpif90 +MPIF90= ${MPIFC} +. endif +MPI_CFLAGS+= `pkgconf --cflags mpich` +.elif ${mpi_ARGS} == openmpi +LIB_DEPENDS+= libmpi_cxx.so:net/openmpi +MPI_HOME= ${LOCALBASE}/mpi/openmpi +. if ${USES:Mfortran} +MPI_LIBS+= `pkgconf --libs ompi-fort` +MPIFC= ${MPI_HOME}/bin/mpif90 +MPIF90= ${MPIFC} +. else +MPI_LIBS+= `pkgconf --libs ompi` +. endif +MPI_CFLAGS+= `pkgconf --cflags ompi` +.else +IGNORE= USES=mpi: invalid arguments: ${mpi_ARGS} +.endif + +MPICC= ${MPI_HOME}/bin/mpicc +MPICXX= ${MPI_HOME}/bin/mpicxx +MPIEXEC= ${MPI_HOME}/bin/mpiexec +MPIRUN= ${MPI_HOME}/bin/mpirun + +.if ${USES:Mcmake} +CMAKE_ARGS+= -DMPIEXEC_EXECUTABLE:FILEPATH="${MPIEXEC}" \ + -DMPI_HOME:PATH="${MPI_HOME}" +.endif + +.endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103022116.122LG4m8062888>