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

Commit

Permalink
Updated version number and made a number of changes aimed at getting …
Browse files Browse the repository at this point in the history
…a stable MacOS build
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Aug 29, 2023
1 parent 8dbecd6 commit 1551c09
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 91 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN})
# Have the .mod files placed in the lib folder
SET(CMAKE_Fortran_MODULE_DIRECTORY ${MOD})

# Set the name of the swiftest library
SET(SWIFTEST_LIBRARY swiftest)

# The source for the SWIFTEST binary and have it placed in the bin folder
ADD_SUBDIRECTORY(${SRC} ${BIN})

Expand Down
2 changes: 1 addition & 1 deletion buildscripts/_build_getopts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if [ -z ${DEPENDENCY_ENV_VARS+x} ]; then
LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}"
CPPFLAGS="${CPPFLAGS} -isystem ${PREFIX}/include"
LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
CPATH="${CPATH} ${PREFIX}/include}"
CPATH="${PREFIX}/include:${CPATH}"

HDF5_ROOT="${PREFIX}"
HDF5_LIBDIR="${HDF5_ROOT}/lib"
Expand Down
62 changes: 26 additions & 36 deletions buildscripts/build_swiftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,39 @@ if [ ! -f "${ROOT_DIR}/setup.py" ]; then
exit 1
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"


SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF"

if [ $OS = "Intel" ]; then
FCFLAGS="${CFLAGS} -standard-semantics"
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"SSE2\""
if [ $OS = "Linux" ]; then
cibuildwheel --platform linux
else
SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF"
SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"generic\""
fi

read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh)
echo $OS $ARCH

cd $ROOT_DIR

printf "\n"
printf "*********************************************************\n"
printf "* BUILDING SWIFTEST *\n"
printf "*********************************************************\n"
printf "LIBS: ${LIBS}\n"
printf "CFLAGS: ${CFLAGS}\n"
printf "FFLAGS: ${FFLAGS}\n"
printf "FCFLAGS: ${FCFLAGS}\n"
printf "CPPFLAGS: ${CPPFLAGS}\n"
printf "CPATH: ${CPATH}\n"
printf "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}\n"
printf "LDFLAGS: ${LDFLAGS}\n"
printf "NETCDF_FORTRAN_HOME: ${NETCDF_FORTRAN_HOME}\n"
printf "NETCDF_INCLUDE: ${NETCDF_INCLUDE}\n"
printf "SKBUILD_CONFIGURE_OPTIONS: ${SKBUILD_CONFIGURE_OPTIONS}\n"
if [ $OS = "MacOSX" ]; then
cd $ROOT_DIR

printf "\n"
printf "*********************************************************\n"
printf "* BUILDING SWIFTEST *\n"
printf "*********************************************************\n"
printf "LIBS: ${LIBS}\n"
printf "CFLAGS: ${CFLAGS}\n"
printf "FFLAGS: ${FFLAGS}\n"
printf "FCFLAGS: ${FCFLAGS}\n"
printf "CPPFLAGS: ${CPPFLAGS}\n"
printf "CPATH: ${CPATH}\n"
printf "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}\n"
printf "LDFLAGS: ${LDFLAGS}\n"
printf "NETCDF_FORTRAN_HOME: ${NETCDF_FORTRAN_HOME}\n"
printf "NETCDF_INCLUDE: ${NETCDF_INCLUDE}\n"
printf "SKBUILD_CONFIGURE_OPTIONS: ${SKBUILD_CONFIGURE_OPTIONS}\n"
printf "MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET}\n"
fi
printf "*********************************************************\n"
printf "*********************************************************\n"

python3 -m pip install build pip
python3 -m build --sdist
if [ $OS = "MacOSX" ]; then
python3 -m pip install build pip
python3 -m build --sdist
cibuildwheel --platform macos
elif [ $OS = "Linux" ]; then
cibuildwheel --platform linux
fi
65 changes: 17 additions & 48 deletions buildscripts/set_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,54 +89,23 @@ case $OS in
CPP=${CPP:-$(command -v cpp)}
;;
MacOSX)
if [ $ARCH = "arm64" ]; then
if $(brew --version &> /dev/null); then
brew install llvm@16 libomp
else
echo \"Please install Homebrew first\"
exit 1
fi
COMPILER_PREFIX=${COMPILER_PREFIX:-"${HOMEBREW_PREFIX}/opt/llvm"}
CC=${CC:-${COMPILER_PREFIX}/bin/clang}
CXX=${CXX:-${COMPILER_PREFIX}/bin/clang++}
CPP=${CPP:-${COMPILER_PREFIX}/bin/clang-cpp}
AR=${AR:-${COMPILER_PREFIX}/bin/llvm-ar}
NM=${NM:-${COMPILER_PREFIX}/bin/llvm-nm}
RANLIB=${RANLIB:-${COMPILER_PREFIX}/bin/llvm-ranlib}
FROOT=$(realpath $(dirname $(command -v gfortran))/..)
FC=$(command -v gfortran)
LD_LIBRARY_PATH="${COMPILER_PREFIX}/lib:${FROOT}/lib:${LD_LIBRARY_PATH}"
LDFLAGS="-L${HOMEBREW_PREFIX}/opt/llvm/lib/c++ -Wl,-rpath,${HOMEBREW_PREFIX}/opt/llvm/lib/c+ -L${HOMEBREW_PREFIX}/opt/libomp/lib -Wl,-no_compact_unwind"
CPPFLAGS="-isystem ${HOMEBREW_PREFIX}/opt/libomp/include"
LIBS="-lomp ${LIBS}"
CPATH="${FROOT}/include:${CPATH}"
CXXFLAGS="${CFLAGS} ${CXXFLAGS}"
FCFLAGS="${CFLAGS} ${FCFLAGS}"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype ${CFLAGS}"
else
if $(brew --version &> /dev/null); then
brew install gcc libomp
else
echo \"Please install Homebrew first\"
exit 1
fi
COMPILER_PREFIX=${COMPILER_PREFIX:-"${HOMEBREW_PREFIX}/Cellar/gcc/13.1.0/"}
CC=${CC:-${COMPILER_PREFIX}/bin/gcc-13}
CXX=${CXX:-${COMPILER_PREFIX}/bin/g++-13}
CPP=${CPP:-${COMPILER_PREFIX}/bin/cpp-13}
AR=${AR:-${COMPILER_PREFIX}/bin/gcc-ar-13}
NM=${NM:-${COMPILER_PREFIX}/bin/gcc-nm-13}
RANLIB=${RANLIB:-${COMPILER_PREFIX}/bin/gcc-ranlib-13}
FC=${FC:-${COMPILER_PREFIX}/bin/gfortran-13}
LD_LIBRARY_PATH="${COMPILER_PREFIX}/lib/gcc/13:${LD_LIBRARY_PATH}"
LDFLAGS="-L${HOMEBREW_PREFIX}/opt/llvm/lib/c++ -Wl,-rpath,${HOMEBREW_PREFIX}/opt/llvm/lib/c+ -L${HOMEBREW_PREFIX}/opt/libomp/lib -Wl,-no_compact_unwind"
CPPFLAGS="-isystem ${HOMEBREW_PREFIX}/opt/libomp/include"
LIBS="-lomp ${LIBS}"
CPATH="${FROOT}/include:${CPATH}"
CXXFLAGS="${CFLAGS} ${CXXFLAGS}"
FCFLAGS="${CFLAGS} ${FCFLAGS}"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype ${CFLAGS}"
fi
COMPILER_PREFIX=${COMPILER_PREFIX:-"/usr"}
CC=${CC:-${COMPILER_PREFIX}/bin/clang}
CXX=${CXX:-${COMPILER_PREFIX}/bin/clang++}
CPP=${CPP:-${COMPILER_PREFIX}/bin/cpp}
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))/..)
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"
LIBS="${LIBS}"
CPATH="${FROOT}/include:${CPATH}"
CXXFLAGS="${CFLAGS} ${CXXFLAGS}"
FCFLAGS="${CFLAGS} ${FCFLAGS}"
CFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -Wno-deprecated-non-prototype ${CFLAGS}"
;;
*)
printf "Unknown compiler type: ${OS}\n"
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ ADD_EXECUTABLE(${SWIFTEST_DRIVER} ${DRIVER_src})
# Add the needed libraries
#####################################################
# Create a library from the source files, except the driver
SET(SWIFTEST_LIBRARY swiftest)
ADD_LIBRARY(${SWIFTEST_LIBRARY} ${SWIFTEST_src})
IF (NOT BUILD_SHARED_LIBS)
SET_PROPERTY(TARGET ${SWIFTEST_LIBRARY} PROPERTY POSITION_INDEPENDENT_CODE)
Expand Down
2 changes: 1 addition & 1 deletion src/globals/globals_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module globals
integer(I4B), parameter :: UPPERCASE_OFFSET = iachar('A') - iachar('a') !! ASCII character set parameter for lower to upper
!! conversion - offset between upper and lower

character(*), parameter :: VERSION = "2023.8.0" !! Swiftest version
character(*), parameter :: VERSION = "2023.8.1" !! Swiftest version

!> Symbolic name for integrator types
character(*), parameter :: UNKNOWN_INTEGRATOR = "UKNOWN INTEGRATOR"
Expand Down
6 changes: 3 additions & 3 deletions swiftest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ ADD_LIBRARY(${SWIFTEST_BINDINGS} MODULE ${SWIFTEST_BINDINGS})
IF (NOT BUILD_SHARED_LIBS)
SET_PROPERTY(TARGET ${SWIFTEST_BINDINGS} PROPERTY POSITION_INDEPENDENT_CODE)
ENDIF ()

TARGET_LINK_LIBRARIES(${SWIFTEST_BINDINGS} ${SWIFTEST_LIBRARY} ${NETCDF_LIBRARIES})
IF(USE_OPENMP OR USE_SIMD)
SET_PROPERTY(TARGET ${SWIFTEST_BINDINGS} APPEND_STRING PROPERTY COMPILE_FLAGS "${OpenMP_Fortran_FLAGS} ")
SET_PROPERTY(TARGET ${SWIFTEST_BINDINGS} APPEND_STRING PROPERTY LINK_FLAGS "${OpenMP_Fortran_FLAGS} ")
ENDIF()

TARGET_LINK_LIBRARIES(${SWIFTEST_BINDINGS} swiftest ${NETCDF_LIBRARIES})
PYTHON_EXTENSION_MODULE(${SWIFTEST_BINDINGS})
TARGET_INCLUDE_DIRECTORIES(${SWIFTEST_BINDINGS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${MOD} ${NETCDF_INCLUDE_DIR})
INSTALL(TARGETS ${SWIFTEST_BINDINGS} LIBRARY DESTINATION swiftest)
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.8.0
2023.8.1

0 comments on commit 1551c09

Please sign in to comment.