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

Commit

Permalink
Switched back to using Homebrew, as it is a much more reliable way to…
Browse files Browse the repository at this point in the history
… get a build that actually works
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Sep 1, 2023
1 parent be7283e commit abe9c52
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 43 deletions.
2 changes: 0 additions & 2 deletions buildscripts/build_hdf5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ else
sudo make install
fi

rsync -va ${PREFIX}/lib/libhdf5* ${ROOT_DIR}/lib/

if [ $? -ne 0 ]; then
printf "hdf5 could not be compiled.\n"
exit 1
Expand Down
10 changes: 8 additions & 2 deletions buildscripts/build_macwheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ declare -a MACVER=("10.13" "11.0" "12.4" "13.0")

for MACOSX_DEPLOYMENT_TARGET in "${MACVER[@]}"; do
ARGS="-p ${PREFIX} -d ${DEPENDENCY_DIR} -m ${MACOSX_DEPLOYMENT_TARGET}"

if [ "${MACOSX_DEPLOYMENT_TARGET}" != "10.13" ]; then
${SCRIPT_DIR}/build_dependencies.sh ${ARGS}
${SCRIPT_DIR}/build_swiftest.sh ${ARGS}
cmake -P distclean.cmake
fi
arch -x86_64 /bin/bash -c "${SCRIPT_DIR}/build_swiftest.sh ${ARGS}"
cmake -P distclean.cmake

if [ "${MACOSX_DEPLOYMENT_TARGET}" != "13.0" ]; then
arch -x86_64 /bin/bash -c "${SCRIPT_DIR}/build_dependencies.sh ${ARGS}"
arch -x86_64 /bin/bash -c "${SCRIPT_DIR}/build_swiftest.sh ${ARGS}"
cmake -P distclean.cmake
fi
done
python3 -m build --sdist

Expand Down
3 changes: 1 addition & 2 deletions buildscripts/build_netcdf-c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ printf "HDF5_ROOT: ${HDF5_ROOT}\n"
printf "*********************************************************\n"

cd ${DEPENDENCY_DIR}/netcdf-c-*
COPTS="--disable-testsets --prefix=${PREFIX}"
COPTS="--disable-testsets --disable-nczarr --prefix=${PREFIX}"
printf "COPTS: ${COPTS}\n"
./configure $COPTS
make && make check
Expand All @@ -40,7 +40,6 @@ if [ -w ${PREFIX} ]; then
else
sudo make install
fi
rsync -va ${PREFIX}/lib/libnetcdf* ${ROOT_DIR}/lib/

if [ $? -ne 0 ]; then
printf "netcdf-c could not be compiled."\n
Expand Down
4 changes: 1 addition & 3 deletions buildscripts/build_netcdf-fortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ printf "LDFLAGS: ${LDFLAGS}\n"
printf "*********************************************************\n"

cd ${DEPENDENCY_DIR}/netcdf-fortran-*
./configure --enable-large-file-tests=no --enable-filter-test=no --prefix=${PREFIX}
./configure --enable-large-file-tests=no --enable-static=no --enable-filter-test=no --prefix=${PREFIX}
make && make check i
if [ -w ${PREFIX} ]; then
make install
else
sudo make install
fi
rsync -a ${PREFIX}/lib/libnetcdff* ${ROOT_DIR}/lib/
rsync -a ${PREFIX}/include/netcdf.mod ${ROOT_DIR}/include/

if [ $? -ne 0 ]; then
printf "netcdf-fortran could not be compiled.\n"
Expand Down
7 changes: 0 additions & 7 deletions buildscripts/build_swiftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,11 @@ fi
read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh)
echo $OS $ARCH

printf "Using ${OS} compilers:\nFC: ${FC}\nCC: ${CC}\nCXX: ${CXX}\n\n"
printf "Installing to ${PREFIX}\n"
printf "Dependency libraries in ${PREFIX}\n"
${SCRIPT_DIR}/build_dependencies.sh ${ARGS}

if [ $OS = "Linux" ]; then
cibuildwheel --platform linux
else
SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=ON -DUSE_SIMD=OFF"
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"generic\""
OMPROOT=${DEVTOOLDIR}/MacOSX${MACOSX_DEPLOYMENT_TARGET}/${ARCH}/usr/local
rsync -va ${OMPROOT}/* ${ROOT_DIR}/

NETCDF_FORTRAN_HOME=${ROOT_DIR}
NETCDF_INCLUDE=${ROOT_DIR}/include
Expand Down
1 change: 0 additions & 1 deletion buildscripts/build_zlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if [ -w ${PREFIX} ]; then
else
sudo make install
fi
rsync -va ${PREFIX}/lib/libz* ${ROOT_DIR}/lib/

if [ $? -ne 0 ]; then
printf "zlib could not be compiled.\n"
Expand Down
66 changes: 40 additions & 26 deletions buildscripts/set_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,43 @@ case $OS in
CPP=${$(command -v cpp)}
;;
MacOSX)
COMPILER_PREFIX="/usr"
CC=${COMPILER_PREFIX}/bin/clang
CXX=${COMPILER_PREFIX}/bin/clang++
CPP=${COMPILER_PREFIX}/bin/cpp
AR=${COMPILER_PREFIX}/bin/ar
NM=${COMPILER_PREFIX}/bin/nm
RANLIB=${COMPILER_PREFIX}/bin/ranlib

# Use custom gfortran location for a given MacOS Target version if vailable
FROOT=${DEVTOOLDIR}/MacOSX${MACOSX_DEPLOYMENT_TARGET}/${ARCH}/usr/local
printf "FROOT: ${FROOT}\n"
if [ -f ${FROOT}/bin/gfortran ]; then
FC=${FROOT}/bin/gfortran
else
FC=$(command -v gfortran)
FROOT=$(realpath $(dirname $(command -v $FC))/..)
fi
if [ ! -f ${FC} ]; then
printf "No working fortran compiler found!\n"
exit 1
fi
LDFLAGS="-Wl,-no_compact_unwind"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype"
LD_LIBRARY_PATH=""
CPATH=""
# For Apple Silicon, use native clang for everything except gfortran, in which case we assume Homebrew
# For Intel, use Homebrew for everything
case $ARCH in
arm64)
COMPILER_PREFIX="/usr"
CC=${COMPILER_PREFIX}/bin/clang
CXX=${COMPILER_PREFIX}/bin/clang++
CPP=${COMPILER_PREFIX}/bin/cpp
AR=${COMPILER_PREFIX}/bin/ar
NM=${COMPILER_PREFIX}/bin/nm
RANLIB=${COMPILER_PREFIX}/bin/ranlib

# Use Homebrew gfortran location for a given MacOS Target version if vailable
FROOT=/opt/homebrew
FC=${FROOT}/bin/gfortran
LDFLAGS="-Wl,-no_compact_unwind"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype"
LD_LIBRARY_PATH=""
CPATH=""
;;
x86_64)
COMPILER_PREFIX=/usr/local
CC=${COMPILER_PREFIX}/bin/gcc-13
CXX=${COMPILER_PREFIX}/bin/g++-13
CPP=${COMPILER_PREFIX}/bin/cpp-13
AR=${COMPILER_PREFIX}/bin/gcc-ar-13
NM=${COMPILER_PREFIX}/bin/gcc-nm-13
RANLIB=${COMPILER_PREFIX}/bin/gcc-ranlib-13

# Use custom gfortran location for a given MacOS Target version if vailable
FC=${COMPILER_PREFIX}/bin/gfortran-13
LDFLAGS="-Wl,-no_compact_unwind"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype"
LD_LIBRARY_PATH=""
CPATH=""
;;
esac
;;
*)
printf "Unknown compiler type: ${OS}\n"
Expand All @@ -69,4 +81,6 @@ case $OS in
exit 1
;;
esac
F77=${FC}
F77=${FC}

printf "Using ${OS} compilers:\nFC: ${FC}\nCC: ${CC}\nCXX: ${CXX}\n\n"

0 comments on commit abe9c52

Please sign in to comment.