Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Adjustments to build script for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Aug 11, 2023
1 parent 2124551 commit 47faaa0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
17 changes: 8 additions & 9 deletions buildscripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,24 @@ case $OS in
if [ "$ARCH" = "x86_64" ]; then
COMPILER="Intel"
else
COMPILER="GNU"
COMPILER="GNU-Linux"
fi
fi
;;
MacOSX)
COMPILER="GNU"
COMPILER="GNU-Mac"
export MACOSX_DEPLOYMENT_TARGET=13
export LDFLAGS="-Wl,-no_compact_unwind"
echo "Building for Mac assumes using Homebrew gfortran-13, gcc-13, and g++13. Install these first if necessary."
;;
*)
echo "Swiftest is currently not configured to build for platform ${OS}-${ARCH}"
exit 1
;;
esac

/bin/bash -lic "${SCRIPT_DIR}/fetch_dependencies.sh"
if [ "$COMPILER"="GNU" ]; then
/bin/bash -lic "${SCRIPT_DIR}/make_build_environment.sh"
conda activate swiftest-build-env
fi
/bin/bash -lic "${SCRIPT_DIR}/build_dependencies.sh $COMPILER"
/bin/bash -lic "${SCRIPT_DIR}/build_swiftest.sh $COMPILER"
${SCRIPT_DIR}/fetch_dependencies.sh && \
${SCRIPT_DIR}/build_dependencies.sh $COMPILER && \
${SCRIPT_DIR}/build_swiftest.sh $COMPILER


13 changes: 11 additions & 2 deletions buildscripts/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ case $COMPILER in
fi
export F77="${FC}"
;;
GNU)
GNU-Linux)
export FC=$(command -v gfortran)
export CC=$(command -v gcc)
export CXX=$(command -v g++)
;;
GNU-Mac)
export FC=$HOMEBREW_PREFIX/bin/gfortran-13
export CC=$HOMEBREW_PREFIX/bin/gcc-13
export CXX=$HOMEBREW_PREFIX/bin/g++-13
;;
*)
echo "Unknown compiler type: ${COMPILER}"
echo $USTMT
Expand All @@ -61,11 +66,12 @@ export HDF5_LIBDIR="${HDF5_ROOT}/lib"
export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include"
export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin"

export LDFLAGS="-L${INSTALL_DIR}/lib"
export LDFLAGS="${LDFLAGS} -L${INSTALL_DIR}/lib"
export CPATH="${INSTALL_DIR}/include"
export CFLAGS="-fPIC"

cd zlib-1.2.13
make distclean
./configure --prefix=${INSTALL_DIR} --static
make
make install
Expand All @@ -77,6 +83,7 @@ cd ../hdf5-1.14.1-2
--disable-cxx \
--prefix=${INSTALL_DIR} \
--with-zlib=${INSTALL_DIR}
make distclean
make
make install

Expand All @@ -85,6 +92,7 @@ cd ../netcdf-c-4.9.2
--disable-dap \
--disable-byterange \
--prefix=${INSTALL_DIR}
make distclean
make
make check
make install
Expand All @@ -100,6 +108,7 @@ fi
export LIBS="$(${INSTALL_DIR}/bin/nc-config --libs)"
cd ../netcdf-fortran-4.6.1
./configure --disable-shared --with-pic --prefix=${NFDIR}
make distclean
make
make check
make install
9 changes: 7 additions & 2 deletions buildscripts/build_swiftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ case $COMPILER in
fi
export F77="${FC}"
;;
GNU)
GNU-Linux)
export FC=$(command -v gfortran)
export CC=$(command -v gcc)
export CXX=$(command -v g++)
;;
GNU-Mac)
export FC=$HOMEBREW_PREFIX/bin/gfortran-13
export CC=$HOMEBREW_PREFIX/bin/gcc-13
export CXX=$HOMEBREW_PREFIX/bin/g++-13
;;
*)
echo "Unknown compiler type: ${COMPILER}"
echo $USTMT
Expand All @@ -53,7 +58,7 @@ export CPATH=$DEPDIR/include
export NETCDF_FORTRAN_HOME=$DEPDIR
export LD_LIBRARY_PATH="${DEPDIR}/lib:${LD_LIBRARY_PATH}"
export LIBS=$(${DEPDIR}/bin/nf-config --all)
export LDFLAGS="-L${DEPDIR}/lib"
export LDFLAGS="${LDFLAGS} -L${DEPDIR}/lib"
export CFLAGS="-fPIC"
export CMAKE_ARGS="-DBUILD_SHARED_LIBS=OFF"

Expand Down
2 changes: 0 additions & 2 deletions buildscripts/fetch_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ wget -qO- https://www.zlib.net/zlib-1.2.13.tar.gz | tar xvz
wget -qO- https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.1/src/hdf5-1.14.1-2.tar.gz | tar xvz
wget -qO- https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz | tar xvz
wget -qO- https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz | tar xvz

echo "Files downloaded to ${BUILD_DIR}"

0 comments on commit 47faaa0

Please sign in to comment.