EAPI="5"

inherit versionator eutils cmake-utils 

DESCRIPTION="A software framework for metaheuristics"
HOMEPAGE="http://paradiseo.gforge.inria.fr"

LICENSE="CeCILL"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="edo eigen gnuplot mpi openmp smp ublas"
REQUIRED_USE="eigen? ( !ublas )"

SRC_URI="https://gforge.inria.fr/frs/download.php/31732/ParadisEO-${PV}.tar.gz"



CDEPEND="gnuplot? ( sci-visualization/gnuplot )
	eigen? ( >=dev-cpp/eigen-3 )
	mpi? ( virtual/mpi )"

DEPEND="$CDEPEND
	app-doc/doxygen"
RDEPEND="$CDEPEND"

S=${WORKDIR}/ParadisEO-$(get_version_component_range 1-2)


pkg_pretend() {
        if use openmp && ! tc-has-openmp; then
                eerror "You are using gcc built without 'openmp' USE."
                eerror "Switch CXX to an OpenMP capable compiler."
                die "Need openmp"
        fi
}


src_configure() {
	local mycmakeargs=(
		$(cmake-utils_use edo EDO)
		$(cmake-utils_use mpi MPI)
		$(cmake-utils_use smp SMP)
		$(cmake-utils_use_enable gnuplot GNUPLOT)
		$(cmake-utils_use_enable openmp OPENMP))
	use eigen && mycmakeargs=(${mycmakeargs} -DEDO_USE_LIB=Eigen3) 
	use ublas && mycmakeargs=(${mycmakeargs} -DEDO_USE_LIB=UBlas) 
	cmake-utils_src_configure
}