#!/usr/bin/env bash

BUILDDIR="$PWD"

# Load appropriate modules on Hammer
if [ "$(dnsdomainname)" = "hammer.esg.utulsa.edu" ]; then
        echo "Loading Modules."
        module load cmake
        module load gcc
        module load boost
        module load openmpi
		#module load mpich
        module load postgresql
fi

# DMTCP Support
cd ../src/dmtcp
# Check to see if it has been installed. If not, install
if find -- bin/ -prune -type d -empty | grep -q '^'; then
	echo "DMTCP not built. Configuring and building."
	./configure --enable-infiniband-support --enable-openmp --enable-timing
	make
fi
cd "${BUILDDIR}"

# AG/CG 
cmake -DCMAKE_BUILD_TYPE=Debug ../ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DMPICH_IGNORE_CXX_SEEK=1
make ag_gen
