DassHydro / smash

An open source, Python library interfacing the Fortran Spatially distributed Modelling and ASsimilation for Hydrology platform.
https://smash.recover.inrae.fr/
GNU General Public License v3.0
11 stars 6 forks source link

MAINT: Add Python 3.12 and MacOS wheels #183

Closed inoelloc closed 1 month ago

inoelloc commented 3 months ago

Since the release of the version 0.2.14 of f90wrap, binary wheels are now available for Python 3.12 and MacOS. Therefore, we can now also provide this wheels for smash. Nothing specific to do for Python 3.12, apart from modifying the pyproject.toml file. For wheels on MacOS, the implementation is a little more complex, especially for OpenMP dependency. The following lines will be added to the meson.build file

# https://github.com/dipy/dipy/blob/95d75a8ad73fe76d7ebaa35b40ee8c734c9b267f/dipy/meson.build#L141-L157
openmp_dep = dependency('OpenMP', required: false)
if not openmp_dep.found() and cc.get_id() == 'clang'
  # Check for libomp (OpenMP) using Homebrew
  brew = find_program('brew', required : false)
  if brew.found()
    output = run_command(brew, 'list', 'libomp', check: true)
    output = output.stdout().strip()
    if output.contains('/libomp/')
      omp_prefix = fs.parent(output.split('\n')[0])
      message('OpenMP Found: YES (Manual search) - ', omp_prefix)
      openmp_dep = declare_dependency(compile_args : ['-Xpreprocessor', '-fopenmp'],
                               link_args : ['-L' + omp_prefix + '/lib', '-lomp'],
                               include_directories : include_directories(omp_prefix / 'include')
                              )
    endif
  endif
endif
inoelloc commented 3 months ago

This issue cannot be resolved with f90wrap 0.2.14. This need to wait f90wrap 0.2.15. Switch to 1.0.0 milestone