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

Commit

Permalink
Merge pull request #24 from profminton/master
Browse files Browse the repository at this point in the history
Final set of changes needed to get a stable, working build.
  • Loading branch information
carlislewishard authored and GitHub committed Sep 11, 2023
2 parents ff080e7 + 331a52e commit ed1e3ee
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: swiftest

on: [push, pull_request]
on:
release:
types: [published]

jobs:
build_wheels:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dump*
!tests/**
*ipynb_checkpoints
**/.DS_Store
!version.txt
version.txt
!LICENSE.txt
!requirements.txt
!pyproject.toml
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Define the project and the depencies that it has
##################################################
CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0...3.27.1)
SET(SKBUILD_PROJECT_NAME "swiftest" CACHE STRING "Name of project set by scikit-build")
SET(SKBUILD_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/bin" CACHE STRING "Install location of binary executable")

# Get version stored in text file
FILE(READ "version.txt" VERSION)
Expand All @@ -29,7 +31,7 @@ ENDIF ()
OPTION(USE_COARRAY "Use Coarray Fortran for parallelization of test particles" OFF)
OPTION(USE_OPENMP "Use OpenMP for parallelization" ON)
OPTION(USE_SIMD "Use SIMD vectorization" ON)
OPTION(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
OPTION(BUILD_SHARED_LIBS "Build using shared libraries" ON)

# The following section is modified from Numpy f2py documentation
IF(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,16 @@ The Swiftest CMake configuration comes with several customization options:
| Set Fortran compiler path | \-DCMAKE_Fortran_COMPILER=/path/to/fortran/compiler |
| Set path to make program | \-DCMAKE_MAKE_PROGRAM=/path/to/make |
| Enable/Disable shared libraries (Intel only) | \-DBUILD_SHARED_LIBS=[**ON\|OFF] |
| Add additional include path | \-DCMAKE_Fortran_FLAGS="-I/path/to/libries |
| Add additional include path | \-DCMAKE_Fortran_FLAGS="-I/path/to/libraries |
| Install prefix | \-DCMAKE_INSTALL_PREFIX=["/path/to/install"\|**"/usr/local"**] |


To see a list of all possible options available to CMake:
```
$ cmake -B build -S . -LA
```

The Swiftest executable, called ```swiftest_driver```, should now be created in the ```bin/``` directory.
The Swiftest executable, called `swiftest_driver`, should now be created in the `bin/` directory.


**Download the `swiftest_driver` as a Docker or Singularity container.**
Expand Down
33 changes: 33 additions & 0 deletions buildscripts/set_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Sets environment flags on MacOS
set -a
SCRIPT_DIR=$(realpath $(dirname $0))
ROOT_DIR=$(realpath ${SCRIPT_DIR}/..)
MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion)"
PREFIX="/usr/local"
HOMEBREW_PREFIX="$(brew --prefix)"
LD_LIBRARY_PATH="/usr/local/lib:${PREFIX}/lib:${HOMEBREW_PREFIX}/lib"
LDFLAGS="-Wl,-rpath,${ROOT_DIR}/lib -Wl,-no_compact_unwind -L${PREFIX}/lib -L${HOMEBREW_PREFIX}/lib"
CPATH="/usr/local/include:${PREFIX}/include:${HOMEBREW_PREFIX}/include:${ROOT_DIR}/include"
CPPFLAGS="-isystem ${PREFIX}/include -isystem /usr/local/include"
LIBS="-lomp"
FCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
FFFLAGS="${FCFLAGS}"
CFLAGS="${FCFLAGS} -Wno-deprecated-non-prototype"
CXXFLAGS="${CFLAGS}"
HDF5_ROOT="${PREFIX}"
HDF5_LIBDIR="${HDF5_ROOT}/lib"
HDF5_INCLUDE_DIR="${HDF5_ROOT}/include"
HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin"
NETCDF_FORTRAN_HOME="${PREFIX}"
NETCDF_INCLUDE="${PREFIX}"
NCDIR="${PREFIX}"
NFDIR="${PREFIX}"
FC="$(command -v gfortran-12)"
F77="${FC}"
CC="/usr/bin/clang"
CXX="/usr/bin/clang++"
CPP="/usr/bin/cpp"
AR="/usr/bin/ar"
NM="/usr/bin/nm"
RANLIB="/usr/bin/ranlib"
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "swiftest"
version = "2023.9.0"
version = "2023.9.1"
authors=[
{name = 'David A. Minton', email='daminton@purdue.edu'},
{name = 'Carlisle Wishard'},
Expand Down Expand Up @@ -51,7 +51,7 @@ requires = [
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.args = ["-DBUILD_SHARED_LIBS=ON","-DUSE_SIMD=OFF"]
cmake.args = ["-DUSE_SIMD=OFF"]
sdist.include = ["src/globals/globals_module.f90.in","swiftest/*.py","swiftest/*.pyx","swiftest/*.h"]

[tool.cibuildwheel]
Expand Down Expand Up @@ -108,3 +108,8 @@ NETCDF_FORTRAN_HOME="/usr/local"
NETCDF_INCLUDE="/usr/local/include"
LD_LIBRARY_PATH="/usr/local/lib:/project/lib"
CPATH="/usr/local/include:/project/include"

[[tool.scikit-build.generate]]
path = "version.txt"
location = "source"
template = '''${version}'''
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ ENDIF()
SET(SWIFTEST_DRIVER swiftest_driver)
ADD_EXECUTABLE(${SWIFTEST_DRIVER} ${DRIVER_src})

# Be sure the executable gets packaged with the wheel
SET_PROPERTY(TARGET ${SWIFTEST_DRIVER} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${SKBUILD_SCRIPTS_DIR})

#####################################################
# Add the needed libraries
#####################################################
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 @@ -48,7 +48,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.9.0" !! Swiftest version
character(*), parameter :: VERSION = "" !! Swiftest version

!> Symbolic name for integrator types
character(*), parameter :: UNKNOWN_INTEGRATOR = "UKNOWN INTEGRATOR"
Expand Down
1 change: 0 additions & 1 deletion version.txt

This file was deleted.

0 comments on commit ed1e3ee

Please sign in to comment.