#!/usr/bin/env modbuild

SOURCE_URL="dks-1.1.2.tar.gz"

declare -ra vers=( ${V//./ } )

conf=()
if (( ${vers[0]} >= 1 && ${vers[1]} >= 1 )); then
	conf+=("-DDKS_FULL=ON")
fi
if (( ${vers[0]} >= 1 && ${vers[1]} >= 1 && ${vers[2]} >= 2 )); then
	# if we want to link OPAL with static cuda libraries, we
	# cannot use DKS_FULL=ON. This must be fixed in DKS.
	conf=()
	conf+=("-DENABLE_OPAL=ON")
	conf+=("-DSTATIC_CUDA=1")
fi

pbuild::configure() {
	export CXX=mpicxx
	export CC=mpicc
	cmake \
		-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
		"${conf[@]}" \
		"${MODULE_SRCDIR}" \
		|| exit 1
}

pbuild::install() {
	install -d "${PREFIX}/lib"
	make install
}

pbuild::add_to_group 'MPI'
pbuild::make_all

# Local Variables:
# mode: sh
# sh-basic-offset: 8
# tab-width: 8
# End:
