Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
de7b36c
DRR - Cpptraj: Remove ambpdb as it is now included in AmberTools and …
drroe Feb 26, 2019
becd9dd
DRR - Cpptraj: Remove ambpdb from test framework
drroe Feb 26, 2019
bbc0876
DRR - Cpptraj: One more ambpdb reference removed
drroe Feb 26, 2019
09872b5
Merge branch 'master' into remove-ambpdb
drroe Feb 27, 2019
6aa0a26
DRR - Cpptraj: Simplify bundled readline config.
drroe Feb 27, 2019
df68c52
DRR - Cpptraj: Fill out DIRECTIVES and INCLUDE for readline config file.
Feb 28, 2019
063b170
DRR - Cpptraj: Have configure set AR and remove command. Convert xdrf…
Feb 28, 2019
f80ce5e
DRR - Cpptraj: Add AR and DEL_FILE to main config.h. Update cuda Make…
Feb 28, 2019
c1ad26f
DRR - Cpptraj: Give arpack build its own config.
Feb 28, 2019
b3c5646
DRR - Cpptraj: Get rid of buildrules include.
Feb 28, 2019
e105399
DRR - Cpptraj: Clean up unused and uninitialized vars
Feb 28, 2019
891a89d
DRR - Cpptraj: Squash more compiler warnings.
Feb 28, 2019
7f33be9
DRR - Cpptraj: Give cuda build its own config
Feb 28, 2019
ec8ed57
DRR - Cpptraj: Replace hard coded instances of rm
Feb 28, 2019
35f60b6
DRR - Cpptraj: Fix dependency.
Feb 28, 2019
f39cf20
DRR - Cpptraj: Remove ambpdb from cmakelists
Feb 28, 2019
49186ff
DRR - Cpptraj: Add missing close parentheses
Feb 28, 2019
aaa5df9
DRR - Cpptraj: Start adding cmake to configure
Mar 1, 2019
5375fdb
DRR - Cpptraj: Some more cmake options
Mar 1, 2019
11ce020
DRR - Cpptraj: Add OPT=openmp to cmake openmp build so proper tests a…
Mar 1, 2019
73ffd61
DRR - Cpptraj: Add missing install line for cmake.
Mar 1, 2019
b450273
DRR - Cpptraj: Remove reference to ambpdb from appveyor
Mar 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ matrix:
- { os: linux, env: COMPILER=gnu USE_CMAKE=0 BUILD_FLAGS="-mpi" DO_PARALLEL="mpiexec -n 2" BUILD_TYPE=install TEST_TYPE=test.showerrors }
- { os: osx, compiler: clang, env: COMPILER=clang USE_CMAKE=0 BUILD_FLAGS="-macAccelerate --with-fftw3=/usr/local --with-netcdf=/usr/local -noarpack" BUILD_TYPE=install TEST_TYPE=test.showerrors }
- { os: linux, env: COMPILER=gnu USE_CMAKE=0 BUILD_FLAGS="-openmp -shared -fftw3" OPT=openmp OMP_NUM_THREADS=1 BUILD_TYPE=libcpptraj TEST_TYPE=test.libcpptraj }
- { os: linux, env: COMPILER=GNU USE_CMAKE=1 BUILD_FLAGS="-DOPENMP=TRUE" OMP_NUM_THREADS=4 TEST_TYPE=test.showerrors}
- { os: linux, env: COMPILER=GNU USE_CMAKE=1 BUILD_FLAGS="-DOPENMP=TRUE" OMP_NUM_THREADS=4 OPT=openmp TEST_TYPE=test.showerrors}
- { os: osx, osx_image: xcode9.2, env: COMPILER=CLANG USE_CMAKE=1 BUILD_FLAGS="" TEST_TYPE=test.showerrors}

#shell_session_update() { echo "Overriding shell_session_update"; };
Expand Down
218 changes: 184 additions & 34 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ UsageFull() {
}

# ----- Script variables -------------------------------------------------------
WORKDIR=`dirname $0` # Working directory of the configure script
COMPILERS='' # User-specified compiler suite to use.
FLINK='' # Flag for linking in Fortran code
REQUIRES_FLINK=0 # If 1 FLINK flag required during link phase
Expand All @@ -108,6 +109,7 @@ SFX='' # Binary suffix
EXE='' # Binary executable suffix

# ----- Configure options ------------------------
USE_CMAKE=0 # 1 = use cmake for build
COMPILE_VERBOSE=0 # 1 = show details during compile
USE_MPI=0 # 0 = no MPI, 1 = mpicc etc, 2 = mpiicc etc
USE_OPENMP=0 # 0 = no OpenMP, 1 = OpenMP
Expand All @@ -128,6 +130,9 @@ USE_CPPTRAJDEBUG=0 # Enable internal cpptraj debug flags
CLEAN='yes' # yes = clean after configure, no = do not
PERFORM_CHECKS='yes' # yes = Check compilers/libraries, no = do not

AR_CMD='ar cqs' # Archive command for creating static libraries.
RM_CMD='/bin/rm -f' # Command for removing files.

# Flags for large file support
LFS='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'

Expand Down Expand Up @@ -1453,6 +1458,151 @@ EOF
fi
}

#-------------------------------------------------------------------------------
# BuildRules <config file> {cxx|cc|f77} ...
# Write build rules for config files.
BuildRules() {
if [ -z "$1" ] ; then
echo "Internal Error: BuildRules(): No output file." > /dev/stderr
exit 1
fi
configfile=$1
shift
while [ ! -z "$1" ] ; do
rule=''
case "$1" in
cxx )
echo "CXX=$CXX" >> $configfile
echo "CXXFLAGS=$CXXFLAGS \$(DBGFLAGS)" >> $configfile
rule='.cpp.o:'
cmd='CXX'
line='$(CXX) $(DIRECTIVES) $(INCLUDE) $(CXXFLAGS)'
;;
cc )
echo "CC=$CC" >> $configfile
echo "CFLAGS=$CFLAGS \$(DBGFLAGS)" >> $configfile
rule='.c.o:'
cmd='CC'
line='$(CC) $(DIRECTIVES) $(INCLUDE) $(CFLAGS)'
;;
f77 )
echo "FC=$FC" >> $configfile
echo "F77FLAGS=$F77FLAGS \$(DBGFLAGS)" >> $configfile
rule='.f.o:'
cmd='FC'
line='$(FC) $(DIRECTIVES) $(INCLUDE) $(F77FLAGS)'
;;
f90 )
echo "FC=$FC" >> $configfile
echo "FFLAGS=$FFLAGS \$(DBGFLAGS)" >> $configfile
# No rule needed for pub_fft.F90
;;
nvcc )
echo "NVCC=$NVCC" >> $configfile
echo "NVCCFLAGS=$NVCCFLAGS" >> $configfile
rule='%%.o : %%.cu'
cmd='NVCC'
line='$(NVCC) $(DBGFLAGS) $(NVCCFLAGS)'
;;
esac
if [ ! -z "$rule" ] ; then
printf "\n$rule\n" >> $configfile
if [ $COMPILE_VERBOSE -eq 0 ] ; then
printf "\t@echo $cmd \$<\n" >> $configfile
printf "\t@$line -c -o \$@ \$<\n\n" >> $configfile
else
printf "\n\t$line -c -o \$@ \$<\n\n" >> $configfile
fi
fi
shift
done
}

#-------------------------------------------------------------------------------
# Use cmake to configure build.
SetupCmake() {
CMAKE=`which cmake`
if [ -z "$CMAKE" ] ; then
echo "Error: 'cmake' binary not found. Cannot configure with cmake." > /dev/stderr
exit 1
fi
# Not recommended to run in same directory as configure
if [ "$WORKDIR" = '.' ] ; then
echo "Error: 'cmake' configure should be done in a separate directory." > /dev/stderr
echo " e.g. $ cd \$CPPTRAJHOME" > /dev/stderr
echo " $ mkdir build" > /dev/stderr
echo " $ cd build" > /dev/stderr
echo " $ ../configure -cmake <options>" > /dev/stderr
exit 1
fi
# Ensure cmake bnuild system exists
if [ ! -f "$WORKDIR/cmake/AmberBuildSystemInit.cmake" ] ; then
echo "Error: cmake build system is not present." > /dev/stderr
echo " If this is a GIT repostitory, you may need to initialize the" > /dev/stderr
echo " cmake submodule:" > /dev/stderr
echo " $ git submodule update --init --recursive" > /dev/stderr
exit 1
fi
# Set up cmake options
cmake_options=''
# Figure out compilers
if [ "$COMPILERS" = 'gnu' ] ; then
cmake_options='-DCOMPILER=GNU'
elif [ "$COMPILERS" = 'intel' ] ; then
cmake_options='-DCOMPILER=INTEL'
elif [ "$COMPILERS" = 'pgi' ] ; then
cmake_options='-DCOMPILER=PGI'
elif [ "$COMPILERS" = 'clang' ] ; then
cmake_options='-DCOMPILER=CLANG'
elif [ "$COMPILERS" = 'cray' ] ; then
cmake_options='-DCOMPILER=CRAY'
fi
# Build options
if [ "$USE_MPI" -eq 0 ] ; then
cmake_options="$cmake_options -DMPI=FALSE"
else
cmake_options="$cmake_options -DMPI=TRUE"
fi
if [ "$USE_OPENMP" -eq 0 ] ; then
cmake_options="$cmake_options -DOPENMP=FALSE"
else
cmake_options="$cmake_options -DOPENMP=TRUE"
fi
if [ "$USE_CUDA" -eq 0 ] ; then
cmake_options="$cmake_options -DCUDA=FALSE"
else
cmake_options="$cmake_options -DCUDA=TRUE"
fi
#if [ "${LIB_STAT[$LFFTW3]}" = 'off' ] ; then
# cmake_options="$cmake_options -DUSE_FFT=FALSE"
#fi
if [ $USE_STATIC -eq 1 ] ; then
cmake_options="$cmake_options -DSTATIC=TRUE"
fi
if [ ! -z "$CPPTRAJHOME" ] ; then
cmake_options="$cmake_options -DCMAKE_INSTALL_PREFIX=$CPPTRAJHOME"
else
cmake_options="$cmake_options -DCMAKE_INSTALL_PREFIX=$WORKDIR"
fi
if [ $USE_OPT -eq 0 ] ; then
cmake_options="$cmake_options -DOPTIMIZE=FALSE"
else
cmake_options="$cmake_options -DOPTIMIZE=TRUE"
fi
if [ $USE_DEBUG -eq 0 ] ; then
cmake_options="$cmake_options -DCMAKE_BUILD_TYPE=Release"
else
cmake_options="$cmake_options -DCMAKE_BUILD_TYPE=Debug"
fi
if [ $COMPILE_VERBOSE -eq 1 ] ; then
cmake_options="$cmake_options -DCMAKE_VERBOSE_MAKEFILE=TRUE"
fi
echo " Cmake options: $WORKDIR $cmake_options"
# Run cmake
$CMAKE $WORKDIR $cmake_options
exit $?
}

# ==============================================================================
# MAIN SCRIPT

Expand Down Expand Up @@ -1516,6 +1666,7 @@ while [ ! -z "$1" ] ; do
'NVCCFLAGS' ) NVCCFLAGS="$VALUE" ;;
'SHADER_MODEL') SHADER_MODEL="$VALUE" ;;
# Build options
'-cmake' ) USE_CMAKE=1 ;;
'-mpi' ) USE_MPI=1 ;;
'-intelmpi' ) USE_MPI=2 ;;
'-openmp' ) USE_OPENMP=1 ;;
Expand Down Expand Up @@ -1595,6 +1746,11 @@ if [ -z "$NBITS" ] ; then
fi
fi

# Should we use cmake instead?
if [ $USE_CMAKE -eq 1 ] ; then
SetupCmake
fi

# Basic checks and directives
BasicChecks

Expand Down Expand Up @@ -1727,18 +1883,12 @@ fi

# ----- Determine which targets to build ---------
CPPTRAJ_TARGET=""
AMBPDB_TARGET=""
LIBCPPTRAJ_TARGET=""
NPROC_TARGET=""
INSTALL_TARGETS=""
# Always build cpptraj
CPPTRAJ_TARGET=cpptraj$SFX$EXE
INSTALL_TARGETS=$INSTALL_TARGETS" install_cpptraj"
# Only build ambpdb in serial
if [ $USE_MPI -eq 0 -a $USE_OPENMP -eq 0 -a $USE_CUDA -eq 0 ] ; then
AMBPDB_TARGET=ambpdb
INSTALL_TARGETS=$INSTALL_TARGETS" install_ambpdb"
fi
# Can we build libcpptraj? TODO serial/OpenMP only?
if [ $USE_SHARED -eq 1 ] ; then
LIBCPPTRAJ_TARGET='$(CPPTRAJLIB)/libcpptraj$(SHARED_SUFFIX)'
Expand All @@ -1753,22 +1903,43 @@ fi
# CUDA
if [ $USE_CUDA -eq 1 ] ; then
CUDA_TARGET='cuda_kernels/libcpptraj_cuda.a'
cat > src/cuda_kernels/cuda.config.h <<EOF
AR = $AR_CMD
DEL_FILE = $RM_CMD
EOF
BuildRules src/cuda_kernels/cuda.config.h nvcc
fi
# Readline
if [ "${LIB_STAT[$LREADLINE]}" = 'bundled' ] ; then
READLINE_TARGET=${LIB_FLAG[$LREADLINE]}
cat > src/readline/readline.config.h <<EOF
DIRECTIVES = -DHAVE_CONFIG_H
INCLUDE = -I.
AR = $AR_CMD
DEL_FILE = $RM_CMD
EOF
BuildRules src/readline/readline.config.h cc
else
READLINE_TARGET='noreadline'
fi
# Xdrfile
if [ "${LIB_STAT[$LXDRFILE]}" = 'bundled' ] ; then
XDRFILE_TARGET=${LIB_FLAG[$LXDRFILE]}
cat > src/xdrfile/xdrfile.config.h <<EOF
AR = $AR_CMD
DEL_FILE = $RM_CMD
EOF
BuildRules src/xdrfile/xdrfile.config.h cc
else
XDRFILE_TARGET='noxdrfile'
fi
# Arpack
if [ "${LIB_STAT[$LARPACK]}" = 'bundled' ] ; then
ARPACK_TARGET=${LIB_FLAG[$LARPACK]}
cat > src/arpack/arpack.config.h <<EOF
DEL_FILE = $RM_CMD
EOF
BuildRules src/arpack/arpack.config.h f77
else
ARPACK_TARGET='noarpack'
fi
Expand Down Expand Up @@ -1800,21 +1971,14 @@ if [ ! -z "$DBGFLAGS" ] ; then
echo "DBGFLAGS=$DBGFLAGS" >> config.h
fi
cat >> config.h <<EOF
CC=$CC
CXX=$CXX
FC=$FC
CFLAGS=$CFLAGS \$(DBGFLAGS)
CXXFLAGS=$CXXFLAGS \$(DBGFLAGS)
FFLAGS=$FFLAGS \$(DBGFLAGS)
F77FLAGS=$F77FLAGS \$(DBGFLAGS)
DEL_FILE = $RM_CMD

SHARED_SUFFIX=$SHARED_SUFFIX
DIRECTIVES=$DIRECTIVES
INCLUDE=$INCLUDE

LIBCPPTRAJ_TARGET=$LIBCPPTRAJ_TARGET

NVCC=$NVCC
NVCCFLAGS=$NVCCFLAGS \$(DBGFLAGS)
CUDA_TARGET=$CUDA_TARGET

READLINE_TARGET=$READLINE_TARGET
Expand All @@ -1832,25 +1996,11 @@ SFX=$SFX
EXE=$EXE

EOF
if [ $COMPILE_VERBOSE -eq 1 ] ; then
cat > buildrules.h <<EOF
.cpp.o:
\$(CXX) \$(DIRECTIVES) \$(INCLUDE) \$(CXXFLAGS) -c -o \$@ \$<

.c.o:
\$(CC) \$(DIRECTIVES) \$(INCLUDE) \$(CFLAGS) -c -o \$@ \$<
EOF
else
cat > buildrules.h <<EOF
.cpp.o:
@echo CXX \$<
@\$(CXX) \$(DIRECTIVES) \$(INCLUDE) \$(CXXFLAGS) -c -o \$@ \$<

.c.o:
@echo CC \$<
@\$(CC) \$(DIRECTIVES) \$(INCLUDE) \$(CFLAGS) -c -o \$@ \$<
EOF
fi
#if [ "$FFT_TARGET" = 'pub_fft.o' ] ; then
BuildRules config.h cc cxx f90
#else
# BuildRules config.h cc cxx
#fi

# ----- Create directories if necessary ----------
if [ ! -e "$CPPTRAJBIN" ] ; then
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion devtools/ci/appveyor/post-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ echo "hello"

if %BUILD_TYPE% equ configure-mingw (

7z a cpptraj-%APPVEYOR_BUILD_ID%.zip bin/ambpdb.exe bin/cpptraj.exe lib/libcpptraj.dll.a src/*.h
7z a cpptraj-%APPVEYOR_BUILD_ID%.zip bin/cpptraj.exe lib/libcpptraj.dll.a src/*.h

) else (
rem move and rename already created package file
Expand Down
Loading