forked from firemodels/fds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request firemodels#13651 from cxp484/tpbuild
FDS Build: Automatic third-party lib build scripts.
- Loading branch information
Showing
13 changed files
with
330 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export HYPRE_INSTALL_PREFIX=$FIREMODELS/libs/hypre/$HYPRE_VERSION | ||
|
||
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then | ||
C_FLAGS="-O3" | ||
elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then | ||
C_FLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" | ||
else | ||
C_FLAGS="-O3" | ||
fi | ||
|
||
cmake_args=( | ||
-DCMAKE_INSTALL_PREFIX="$HYPRE_INSTALL_PREFIX" | ||
-DCMAKE_C_COMPILER="$CC" | ||
-DCMAKE_C_FLAGS="$C_FLAGS" | ||
-DCMAKE_INSTALL_LIBDIR="lib" | ||
) | ||
|
||
# Add OSX deployment target if building for macOS | ||
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then | ||
if [ "$(uname -m)" == "x86_64" ]; then | ||
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6") | ||
else | ||
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="13.0") | ||
fi | ||
fi | ||
|
||
# Run cmake with the arguments | ||
cmake ../ "${cmake_args[@]}" | ||
|
||
# ./configure CC=$CC FC=mpiifort CFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" FFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" \ | ||
# --prefix=$FIREMODELS/libs/hypre/$HYPRE_VERSION | ||
|
||
make install |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export SUNDIALS_INSTALL_PREFIX=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION | ||
|
||
cmake_args=( | ||
-DCMAKE_INSTALL_PREFIX="$SUNDIALS_INSTALL_PREFIX" | ||
-DEXAMPLES_INSTALL_PATH="$SUNDIALS_INSTALL_PREFIX/examples" | ||
-DCMAKE_C_COMPILER="$CC" | ||
-DCMAKE_CXX_COMPILER="$CXX" | ||
-DCMAKE_Fortran_COMPILER="$FC" | ||
-DBUILD_FORTRAN_MODULE_INTERFACE=ON | ||
-DEXAMPLES_ENABLE_CXX=OFF | ||
-DEXAMPLES_ENABLE_CUDA=OFF | ||
-DEXAMPLES_ENABLE_F2003=OFF | ||
-DENABLE_OPENMP=OFF | ||
-DCMAKE_INSTALL_LIBDIR="lib" | ||
) | ||
|
||
# Add OSX deployment target if building for macOS | ||
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then | ||
if [ "$(uname -m)" == "x86_64" ]; then | ||
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6") | ||
else | ||
cmake_args+=(-DCMAKE_OSX_DEPLOYMENT_TARGET="13.0") | ||
fi | ||
fi | ||
|
||
# Run cmake with the arguments | ||
cmake ../ "${cmake_args[@]}" | ||
|
||
make install |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# PARSE OPTIONS FOR CLEAN LIBRARY BUILDS #################################### | ||
|
||
# Set FIREMODELS environment variable if it is not already exists. | ||
if [ -z "${FIREMODELS}" ]; then | ||
export FIREMODELS="$(readlink -f "$(pwd)/../../../")" | ||
fi | ||
|
||
echo "FIREMODELS=$FIREMODELS" | ||
|
||
clean_hypre=false | ||
clean_sundials=false | ||
ARG="" | ||
|
||
# Loop through the options | ||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
--clean-hypre) | ||
clean_hypre=true # Set the flag to true when --clean-hypre is used | ||
shift | ||
;; | ||
--clean-sundials) | ||
clean_sundials=true | ||
shift | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) | ||
ARG="${ARG} $1" # Append unrecognized arguments to ARG | ||
shift | ||
;; | ||
esac | ||
done | ||
|
||
# Trim leading spaces from ARG, if necessary | ||
ARG="${ARG#"${ARG%%[![:space:]]*}"}" | ||
|
||
if [ "$clean_hypre" = true ]; then | ||
echo "Option --clean-hypre is set." | ||
fi | ||
|
||
if [ "$clean_sundials" = true ]; then | ||
echo "Option --clean-sundials is set." | ||
fi | ||
|
||
# FINISHED WITH CLEANING OPTIONS ########################################### | ||
|
||
# Decide compilers | ||
source ../Scripts/set_thirdparty_compilers.sh | ||
|
||
# build hypre | ||
source ../Scripts/HYPRE/build_hypre.sh confmake.sh $clean_hypre | ||
|
||
## build sundials | ||
source ../Scripts/SUNDIALS/build_sundials.sh confmake.sh $clean_sundials | ||
|
||
|
||
# Use ARG and the options | ||
#echo "ARG is: $ARG" | ||
if [ "$SOURCE_INTEL_IFORT" -eq 1 ]; then | ||
source ../Scripts/set_intel_compiler.sh $ARG | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
echo "FDS build target = $FDS_BUILD_TARGET" | ||
|
||
# For following variables 1- indicate availble through | ||
# environment variable FIREMODELS_CC, FIREMODELS_CXX, and FIREMODELS_FC | ||
set_CC=0 | ||
set_CXX=0 | ||
set_FC=0 | ||
|
||
if [ -n "$FIREMODELS_CC" ]; then | ||
CC=$FIREMODELS_CC | ||
if command -v $CC &> /dev/null; then | ||
set_CC=1 | ||
else | ||
echo "The compiler specified by the FIREMODELS_CC environment variable ($CC) is not available on this system. Searching for an alternative compiler." | ||
fi | ||
fi | ||
|
||
if [ -n "$FIREMODELS_CXX" ]; then | ||
CXX=$FIREMODELS_CXX | ||
if command -v $CXX &> /dev/null; then | ||
set_CXX=1 | ||
else | ||
echo "The compiler specified by the FIREMODELS_CXX environment variable ($CXX) is not available on this system. Searching for an alternative compiler." | ||
fi | ||
fi | ||
|
||
if [ -n "$FIREMODELS_FC" ]; then | ||
FC=$FIREMODELS_FC | ||
if command -v $FC &> /dev/null; then | ||
set_FC=1 | ||
else | ||
echo "The compiler specified by the FIREMODELS_FC environment variable ($FC) is not available on this system. Searching for an alternative compiler." | ||
fi | ||
fi | ||
|
||
|
||
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then | ||
# Check for C compiler (mpicc, gcc, clang) | ||
if [ $set_CC -eq 0 ]; then | ||
if command -v mpicc &> /dev/null; then | ||
CC=mpicc | ||
elif command -v clang &> /dev/null; then | ||
CC=clang | ||
elif command -v gcc &> /dev/null; then | ||
CC=gcc | ||
else | ||
echo "Error: Any of mpicc, iclang, or gcc is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for clang C++ compiler (mpicxx, g++, clang ++) | ||
if [ $set_CXX -eq 0 ]; then | ||
if command -v mpicxx &> /dev/null; then | ||
CXX=mpicxx | ||
elif command -v clang++ &> /dev/null; then | ||
CXX=clang++ | ||
elif command -v g++ &> /dev/null; then | ||
CXX=g++ | ||
else | ||
echo "Error: Any of mpicxx, clang++, or g++ is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for Fortran compiler (gfortran) | ||
if [ $set_FC -eq 0 ]; then | ||
if command -v mpifort &> /dev/null; then | ||
FC=mpifort | ||
elif command -v gfortran &> /dev/null; then | ||
FC=gfortran | ||
else | ||
echo "Error: gfortran is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then | ||
# Check for Intel C compiler | ||
if [ $set_CC -eq 0 ]; then | ||
if command -v mpiicx &> /dev/null; then | ||
CC=mpiicx | ||
elif command -v icx &> /dev/null; then | ||
CC=icx | ||
elif command -v mpiicc &> /dev/null; then | ||
CC=mpiicc | ||
elif command -v icc &> /dev/null; then | ||
CC=icc | ||
else | ||
echo "Error: Any of mpiicx, icx, mpiicc, or icc is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for Intel C++ compiler | ||
if [ $set_CXX -eq 0 ]; then | ||
if command -v mpiicpx &> /dev/null; then | ||
CXX=mpiicpx | ||
elif command -v icpx &> /dev/null; then | ||
CXX=icpx | ||
elif command -v mpiicpc &> /dev/null; then | ||
CXX=mpiicpc | ||
elif command -v icpc &> /dev/null; then | ||
CXX=icpc | ||
else | ||
echo "Error: Any of mpiicpx, icpx, mpiicpc, or icpc is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for Intel Fortran compiler (ifort). ifx will be added in future. | ||
if [ $set_FC -eq 0 ]; then | ||
if command -v mpiifort &> /dev/null; then | ||
FC=mpiifort | ||
elif command -v ifort &> /dev/null; then | ||
FC=ifort | ||
else | ||
echo "Error: Any of mpiifort, or ifort is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
else #gnu | ||
# Check for gnu C compiler (gcc) | ||
if [ $set_CC -eq 0 ]; then | ||
if command -v mpicc &> /dev/null; then | ||
CC=mpicc | ||
elif command -v gcc &> /dev/null; then | ||
CC=gcc | ||
else | ||
echo "Error: Any of mpicc, gcc is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for Intel C++ compiler (g++) | ||
if [ $set_CXX -eq 0 ]; then | ||
if command -v mpicxx &> /dev/null; then | ||
CXX=mpicxx | ||
elif command -v g++ &> /dev/null; then | ||
CXX=g++ | ||
else | ||
echo "Error: Any of mpicxx, g++ is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for Fortran compiler (gfortran) | ||
if [ $set_FC -eq 0 ]; then | ||
if command -v mpifort &> /dev/null; then | ||
FC=mpifort | ||
elif command -v gfortran &> /dev/null; then | ||
FC=gfortran | ||
else | ||
echo "Error: Any of mpifort, gfortran is not available on this system." | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
echo "C Compiler CC=$CC" | ||
echo "C++ compiler CXX=$CXX" | ||
echo "Fortran compiler FC=$FC" | ||
|
||
export CC=$CC | ||
export CXX=$CXX | ||
export FC=$FC |
Oops, something went wrong.