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

Commit

Permalink
More changes to improve the robustness of the buildscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Aug 30, 2023
1 parent 2c5b377 commit 0d7c712
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
23 changes: 10 additions & 13 deletions buildscripts/_build_getopts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@ SCRIPT_DIR=$(realpath $(dirname $0))
ROOT_DIR=$(realpath ${SCRIPT_DIR}/..)

# Parse arguments
USTMT="Usage: ${0} [-d /path/to/dependency/source] [-p /prefix/path] [-m MACOSX_DEPLOYMENT_TARGET|{11.0}]"
MACOSX_DEPLOYMENT_TARGET="11.0"

read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh)
BUILD_DIR=${BUILD_DIR:-$(mktemp -ut swiftest_build)}
if [ $OS = "MacOSX" ]; then
PREFIX=${PREFIX:-${BUILD_DIR}/${OS}${MACOSX_DEPLOYMENT_TARGET}/${ARCH}}
else
PREFIX=${PREFIX:-${BUILD_DIR}/${OS}/${ARCH}}
fi

DEPENDENCY_DIR=${DEPENDENCY_DIR:-${BUILD_DIR}/downloads}
USTMT="Usage: ${0} [-d /path/to/dependency/source] [-p /prefix/path] [-m MACOSX_DEPLOYMENT_TARGET]"
MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"11.0"}

while getopts ":d:p:m:h" ARG; do
case "${ARG}" in
Expand Down Expand Up @@ -54,13 +44,20 @@ while getopts ":d:p:m:h" ARG; do
esac
done

read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh)
BUILD_DIR=${BUILD_DIR:-$(mktemp -ut swiftest_build)}
if [ $OS = "MacOSX" ]; then
printf "MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET}\n"
PREFIX=${PREFIX:-${BUILD_DIR}/${OS}${MACOSX_DEPLOYMENT_TARGET}/${ARCH}}
else
PREFIX=${PREFIX:-${BUILD_DIR}/${OS}/${ARCH}}
fi

DEPENDENCY_DIR=${DEPENDENCY_DIR:-${BUILD_DIR}/downloads}

printf "DEPENDENCY_DIR: ${DEPENDENCY_DIR}\n"
printf "PREFIX : ${PREFIX}\n"


if [ -z ${DEPENDENCY_ENV_VARS+x} ]; then
. ${SCRIPT_DIR}/set_compilers.sh

Expand Down
3 changes: 3 additions & 0 deletions buildscripts/build_swiftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ 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"
read -rsn1 -p"Press any key to continue";echo

${SCRIPT_DIR}/build_dependencies.sh ${ARGS}


if [ $OS = "Linux" ]; then
cibuildwheel --platform linux
else
Expand Down
15 changes: 13 additions & 2 deletions buildscripts/set_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,19 @@ case $OS in
AR=${AR:-${COMPILER_PREFIX}/bin/ar}
NM=${NM:-${COMPILER_PREFIX}/bin/nm}
RANLIB=${RANLIB:-${COMPILER_PREFIX}/bin/ranlib}
FC=${FC:-$(command -v gfortran)}
FROOT=$(realpath $(dirname $(command -v $FC))/..)

# Use custom gfortran location for a given MacOS Target version if vailable
FROOT=${DEVTOOLDIR}/MacOSX${MACOSX_DEPLOYMENT_TARGET}/${ARCH}/usr/local
if [ -f ${FROOT}/bin/gfortran ]; then
FC=${FROOT}/bin/gfortran
else
FC=${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
LD_LIBRARY_PATH="${COMPILER_PREFIX}/lib:${FROOT}/lib:${LD_LIBRARY_PATH}"
LDFLAGS="${LDFLAGS} -Wl,-rpath,${COMPILER_PREFIX}/lib -Wl,-no_compact_unwind"
CPPFLAGS="${CPPFLAGS} -isystem ${COMPILER_PREFIX}/include"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=ON"}
environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=ON -DUSE_SIMD=OFF"}
test-command = "pytest {package}/tests"
test-requires = ['pytest','cython']
test-skip = "cp312-*"
Expand Down

0 comments on commit 0d7c712

Please sign in to comment.