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

Commit

Permalink
More improvements to FindNETCDF toward getting a working cibuildwheel…
Browse files Browse the repository at this point in the history
… setup
  • Loading branch information
daminton committed Aug 16, 2023
1 parent fa46010 commit ccc9cd4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
41 changes: 41 additions & 0 deletions cmake/Modules/FindNETCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,54 @@

# - Finds the NetCDF libraries

FIND_PATH(NFBIN
NAMES nf-config
HINTS
ENV NETCDF_FORTRAN_HOME
ENV PATH
PATH_SUFFIXES
bin
)

IF (NFBIN)
SET(CMD "${NFBIN}/nf-config")
LIST(APPEND CMD "--includedir")
MESSAGE(STATUS "Searching for NetCDF-Fortran include directory using ${CMD}")
EXECUTE_PROCESS(COMMAND ${CMD} OUTPUT_VARIABLE NFINCLUDE_DIR ERROR_VARIABLE ERR RESULT_VARIABLE RES OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (NFINCLUDE_DIR)
MESSAGE(STATUS "Found in ${NFINCLUDE_DIR}")
ELSE ()
MESSAGE(STATUS "Cannot execute ${CMD}")
MESSAGE(STATUS "OUTPUT: ${NFINCLUDE_DIR}")
MESSAGE(STATUS "RESULT: ${RES}")
MESSAGE(STATUS "ERROR : ${ERR}")
ENDIF ()

SET(CMD "${NFBIN}/nf-config")
LIST(APPEND CMD "--prefix")
MESSAGE(STATUS "Searching for NetCDF-Fortran library directory using ${CMD}")
EXECUTE_PROCESS(COMMAND ${CMD} OUTPUT_VARIABLE NFPREFIX_DIR ERROR_VARIABLE ERR RESULT_VARIABLE RES OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (NFPREFIX_DIR)
MESSAGE(STATUS "Found in ${NFPREFIX_DIR}")
ELSE ()
MESSAGE(STATUS "Cannot execute ${CMD}")
MESSAGE(STATUS "OUTPUT: ${NFPREFIX_DIR}")
MESSAGE(STATUS "RESULT: ${RES}")
MESSAGE(STATUS "ERROR : ${ERR}")
ENDIF ()
ENDIF()

FIND_PATH(NETCDF_INCLUDE_DIR
NAMES netcdf.mod
HINTS
${NFINCLUDE_DIR}
ENV NETCDF_INCLUDE_DIR
ENV NETCDF_FORTRAN_HOME
ENV CPATH
PATH_SUFFIXES
include
modules
mod
REQUIRED
)

Expand All @@ -32,6 +72,7 @@ ENDIF()
FIND_LIBRARY(NETCDF_FORTRAN_LIBRARY
NAMES ${NETCDFF}
HINTS
${NFPREFIX_DIR}
ENV NETCDF_FORTRAN_HOME
ENV NETCDF_HOME
ENV LD_LIBRARY_PATH
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.cibuildwheel.linux]
environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF",CPATH="/usr:/usr/local",LD_LIBRARY_PATH="/usr/lib:/usr/lib64:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/aarch64-linux-gnu"}
environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF"}
before-all = [
"yum install netcdf-fortran-static netcdf-static hdf5-static -y",
"yum install netcdf-fortran-static netcdf-static hdf5-static -y"
]

0 comments on commit ccc9cd4

Please sign in to comment.