From a2daa910a992af1e3c7bf2f66a4008ae7016ab87 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 11 Nov 2024 09:05:24 -0500 Subject: [PATCH 01/10] v4: Updates for meson-f2py support --- CHANGELOG.md | 2 + python/f2py/FindF2PY.cmake | 12 ++++- python/f2py/UseF2Py.cmake | 89 +++++++++++++++++++++++++++--------- python/f2py3/FindF2PY3.cmake | 20 +++++--- python/f2py3/UseF2Py3.cmake | 46 +++++++++---------- 5 files changed, 117 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 807065d4..af81314e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- For F2PY3 code, set CMake Policy CMP0132 if Python is 3.12+ or higher + ### Deprecated ## [4.8.1] - 2024-11-07 diff --git a/python/f2py/FindF2PY.cmake b/python/f2py/FindF2PY.cmake index 8a00c1cd..21a1dfca 100644 --- a/python/f2py/FindF2PY.cmake +++ b/python/f2py/FindF2PY.cmake @@ -40,14 +40,22 @@ find_program(F2PY_EXECUTABLE NAMES "f2py${Python_VERSION_MAJOR}.${Python_VERSION if(F2PY_EXECUTABLE) # extract the version string execute_process(COMMAND "${F2PY_EXECUTABLE}" -v - OUTPUT_VARIABLE F2PY_VERSION_STRING - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_VARIABLE F2PY_VERSION_STRING + OUTPUT_STRIP_TRAILING_WHITESPACE) if("${F2PY_VERSION_STRING}" MATCHES "^([0-9]+)(.([0-9+]))?(.([0-9+]))?$") set(F2PY_VERSION_MAJOR "${CMAKE_MATCH_1}") set(F2PY_VERSION_MINOR "${CMAKE_MATCH_3}") set(F2PY_VERSION_PATCH "${CMAKE_MATCH_5}") endif() + # Testing has shown that f2py3 with Python 3.12+ needs to set + # a new CMake policy, CMP0132, because f2py3 uses Meson in the + # instead of distutils. + # See https://github.com/mesonbuild/meson/issues/13882 + if (F2PY_VERSION_MAJOR GREATER_EQUAL 3 AND F2PY_VERSION_MINOR GREATER_EQUAL 12) + cmake_policy(SET CMP0132 NEW) + endif () + # Get the compiler-id and map it to compiler vendor as used by f2py. # Currently, we only check for GNU, but this can easily be extended. # Cache the result, so that we only need to check once. diff --git a/python/f2py/UseF2Py.cmake b/python/f2py/UseF2Py.cmake index 3937452a..ae909708 100644 --- a/python/f2py/UseF2Py.cmake +++ b/python/f2py/UseF2Py.cmake @@ -74,11 +74,32 @@ macro (add_f2py_module _name) #message(STATUS "${_name} F2PY_Fortran_FLAGS ${F2PY_Fortran_FLAGS}") - set(_fcompiler_opts "--fcompiler=${F2PY_FCOMPILER}") - list(APPEND _fcompiler_opts "--f77exec=${CMAKE_Fortran_COMPILER}" "--f77flags='${F2PY_Fortran_FLAGS}'") - if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - list(APPEND _fcompiler_opts "--f90exec=${CMAKE_Fortran_COMPILER}" "--f90flags='${F2PY_Fortran_FLAGS}'") - endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + # NOTE: This style of calling f2py is only for distutils. If you are using + # Python 3.12, the backend is now meson and this will not work + # so we need to test the Python version and then call the correct + # f2py + + if (Python_VERSION VERSION_GREATER_EQUAL "3.12") + set(F2PY_BACKEND "meson") + else () + set(F2PY_BACKEND "distutils") + endif () + + #message(STATUS "Using F2PY_BACKEND: ${F2PY_BACKEND}") + + if (F2PY_BACKEND STREQUAL "distutils") + set(_fcompiler_opts "--fcompiler=${F2PY_FCOMPILER}") + list(APPEND _fcompiler_opts "--f77exec=${CMAKE_Fortran_COMPILER}" "--f77flags='${F2PY_Fortran_FLAGS}'") + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + list(APPEND _fcompiler_opts "--f90exec=${CMAKE_Fortran_COMPILER}" "--f90flags='${F2PY_Fortran_FLAGS}'") + endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + else () + set(_fcompiler_opts "") + list(APPEND _fcompiler_opts "--f77flags='${F2PY_Fortran_FLAGS}'") + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + list(APPEND _fcompiler_opts "--f90flags='${F2PY_Fortran_FLAGS}'") + endif(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + endif () # Make the source filenames absolute. set(_abs_srcs) @@ -87,6 +108,13 @@ macro (add_f2py_module _name) list(APPEND _abs_srcs ${_abs_src}) endforeach(_src ${add_f2py_module_SOURCES}) + # Let's also get all directories that the sources are in + set(_src_inc_dirs) + foreach(_src ${_abs_srcs}) + get_filename_component(_dir ${_src} DIRECTORY) + list(APPEND _src_inc_dirs ${_dir}) + endforeach(_src ${_abs_srcs}) + # Get a list of the include directories. # The f2py --include_paths option, used when generating a signature file, # needs a colon-separated list. The f2py -I option, used when compiling @@ -103,6 +131,12 @@ macro (add_f2py_module _name) endforeach(_dir) string(REPLACE ";" ":" _inc_paths "${_inc_dirs}") + # We also want to include the directory where the + # sources are located as well into _inc_opts + foreach(_dir ${_src_inc_dirs}) + list(APPEND _inc_opts "-I${_dir}") + endforeach(_dir) + set(_libs_opts) foreach(_lib ${add_f2py_module_LIBRARIES}) # MAT This is hacky, but so is this whole code @@ -189,8 +223,8 @@ macro (add_f2py_module _name) continue() endif () endif () - list(APPEND _lib_opts "-l${_lib}") + endforeach() else() @@ -227,25 +261,38 @@ macro (add_f2py_module _name) # Define the command to generate the Fortran to Python interface module. The # output will be a shared library that can be imported by python. - if ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY_SUFFIX}" - COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" - ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py_module_SOURCES} - COMMENT "[F2PY] Building Fortran to Python interface module ${_name}") - else ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + # We also need to set FC in the environment to the fortran compiler + #message(STATUS "add_f2py_module_SOURCES: ${add_f2py_module_SOURCES}") + #message(STATUS "_inc_opts: ${_inc_opts}") + if ( F2PY_BACKEND STREQUAL "meson") add_custom_command(OUTPUT "${_name}${F2PY_SUFFIX}" - COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" - --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + COMMAND ${CMAKE_COMMAND} -E env "FC=${CMAKE_Fortran_COMPILER}" + ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" - -c "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}/${_name}.pyf" - ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} + ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} DEPENDS ${add_f2py_module_SOURCES} COMMENT "[F2PY] Building Fortran to Python interface module ${_name}") - endif ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + else () + if ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY_SUFFIX}" + COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" + ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py_module_SOURCES} + COMMENT "[F2PY] Building Fortran to Python interface module ${_name}") + else ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY_SUFFIX}" + COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" + --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + COMMAND ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" + -c "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}/${_name}.pyf" + ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py_module_SOURCES} + COMMENT "[F2PY] Building Fortran to Python interface module ${_name}") + endif ( "${add_f2py_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + endif () diff --git a/python/f2py3/FindF2PY3.cmake b/python/f2py3/FindF2PY3.cmake index 18aa378e..bc57c1f4 100644 --- a/python/f2py3/FindF2PY3.cmake +++ b/python/f2py3/FindF2PY3.cmake @@ -32,22 +32,30 @@ # Path to the f2py3 executable find_program(F2PY3_EXECUTABLE NAMES "f2py${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" - "f2py-${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" - "f2py${Python3_VERSION_MAJOR}" - "f2py" - ) + "f2py-${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" + "f2py${Python3_VERSION_MAJOR}" + "f2py" + ) if(F2PY3_EXECUTABLE) # extract the version string execute_process(COMMAND "${F2PY3_EXECUTABLE}" -v - OUTPUT_VARIABLE F2PY3_VERSION_STRING - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_VARIABLE F2PY3_VERSION_STRING + OUTPUT_STRIP_TRAILING_WHITESPACE) if("${F2PY3_VERSION_STRING}" MATCHES "^([0-9]+)(.([0-9+]))?(.([0-9+]))?$") set(F2PY3_VERSION_MAJOR "${CMAKE_MATCH_1}") set(F2PY3_VERSION_MINOR "${CMAKE_MATCH_3}") set(F2PY3_VERSION_PATCH "${CMAKE_MATCH_5}") endif() + # Testing has shown that f2py3 with Python 3.12+ needs to set + # a new CMake policy, CMP0132, because f2py3 uses Meson in the + # instead of distutils. + # See https://github.com/mesonbuild/meson/issues/13882 + if (F2PY_VERSION_MAJOR GREATER_EQUAL 3 AND F2PY_VERSION_MINOR GREATER_EQUAL 12) + cmake_policy(SET CMP0132 NEW) + endif () + # Get the compiler-id and map it to compiler vendor as used by f2py3. # Currently, we only check for GNU, but this can easily be extended. # Cache the result, so that we only need to check once. diff --git a/python/f2py3/UseF2Py3.cmake b/python/f2py3/UseF2Py3.cmake index db631ad3..2b8b8399 100644 --- a/python/f2py3/UseF2Py3.cmake +++ b/python/f2py3/UseF2Py3.cmake @@ -54,11 +54,11 @@ macro (add_f2py3_module _name) # # If you really want to pass in the flags used by the rest of the model # # # this is how. But I don't think we want to do this # # if (CMAKE_BUILD_TYPE MATCHES Release) # - # set(F2PY3_Fortran_FLAGS ${CMAKE_Fortran_FLAGS_RELEASE}) # + # set(F2PY3_Fortran_FLAGS ${CMAKE_Fortran_FLAGS_RELEASE}) # # elseif(CMAKE_BUILD_TYPE MATCHES Debug) # - # set(F2PY3_Fortran_FLAGS ${CMAKE_Fortran_FLAGS_DEBUG}) # + # set(F2PY3_Fortran_FLAGS ${CMAKE_Fortran_FLAGS_DEBUG}) # # endif() # - # separate_arguments(F2PY3_Fortran_FLAGS) # + # separate_arguments(F2PY3_Fortran_FLAGS) # ########################################################################### if (${add_f2py3_module_USE_OPENMP}) @@ -245,7 +245,7 @@ macro (add_f2py3_module _name) # it to allow for this. It's possible it's not correct, but it seem to # let things run if(${add_f2py3_module_DOUBLE_PRECISION}) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/.f2py3_f2cmap "{'real':{'':'double'},'integer':{'':'long'},'real*8':{'':'double'},'complex':{'':'complex_double'}}") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/.f2py3_f2cmap "{'real':{'':'double'},'integer':{'':'long'},'real*8':{'':'double'},'complex':{'':'complex_double'}}") endif() # Debugging f2py is a lot easier if you don't quiet it, but we do not @@ -273,25 +273,25 @@ macro (add_f2py3_module _name) DEPENDS ${add_f2py3_module_SOURCES} COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") else () - if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" - ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" + ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) endif () From 1abfe10b9262232da1a183ff6a7b663ded14987f Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 12 Nov 2024 09:05:20 -0500 Subject: [PATCH 02/10] More fixes for meson --- python/f2py/FindF2PY.cmake | 7 ++++--- python/f2py/try_f2py_compile.cmake | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/python/f2py/FindF2PY.cmake b/python/f2py/FindF2PY.cmake index 21a1dfca..ec99bdd8 100644 --- a/python/f2py/FindF2PY.cmake +++ b/python/f2py/FindF2PY.cmake @@ -48,11 +48,12 @@ if(F2PY_EXECUTABLE) set(F2PY_VERSION_PATCH "${CMAKE_MATCH_5}") endif() - # Testing has shown that f2py3 with Python 3.12+ needs to set - # a new CMake policy, CMP0132, because f2py3 uses Meson in the + # Testing has shown that f2py with Python 3.12+ needs to set + # a new CMake policy, CMP0132, because f2py uses Meson in the # instead of distutils. # See https://github.com/mesonbuild/meson/issues/13882 - if (F2PY_VERSION_MAJOR GREATER_EQUAL 3 AND F2PY_VERSION_MINOR GREATER_EQUAL 12) + if (Python_VERSION_MINOR GREATER_EQUAL 12) + message(STATUS "[F2PY]: Setting CMP0132 policy to NEW") cmake_policy(SET CMP0132 NEW) endif () diff --git a/python/f2py/try_f2py_compile.cmake b/python/f2py/try_f2py_compile.cmake index 5d8a7c5f..c8818562 100644 --- a/python/f2py/try_f2py_compile.cmake +++ b/python/f2py/try_f2py_compile.cmake @@ -11,13 +11,27 @@ macro (try_f2py_compile file var) set( _f2py_check_bindir "${CMAKE_BINARY_DIR}/f2py_tmp") file(MAKE_DIRECTORY ${_f2py_check_bindir}) - execute_process( - COMMAND ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} - WORKING_DIRECTORY ${_f2py_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + # We need to work around a meson bug with ifort and stderr output + # Once we fully move to use ifx this can be removed + if (IFORT_HAS_DEPRECATION_WARNING) + message(STATUS "Using workaround for ifort with deprecation message") + set(IFORT_IGNORE_DEPRECATION_WARNING "ifort -diag-disable=10448") + execute_process( + COMMAND cmake -E env "FC=${FC_WITH_SPACES}" ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} + WORKING_DIRECTORY ${_f2py_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) + else () + execute_process( + COMMAND ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} + WORKING_DIRECTORY ${_f2py_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) + endif () if (result EQUAL 0) file(GLOB F2PY_TEST_OUTPUT_FILE ${_f2py_check_bindir}/*.so) From edd89425dc5f5c4ad219c51ad15b015e71548cda Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 12 Nov 2024 09:05:42 -0500 Subject: [PATCH 03/10] More fixes for meson, but all --- python/f2py3/FindF2PY3.cmake | 7 ++--- python/f2py3/UseF2Py3.cmake | 38 ++++++++++++++-------------- python/f2py3/try_f2py3_compile.cmake | 28 +++++++++++++++----- 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/python/f2py3/FindF2PY3.cmake b/python/f2py3/FindF2PY3.cmake index bc57c1f4..b1e78e7c 100644 --- a/python/f2py3/FindF2PY3.cmake +++ b/python/f2py3/FindF2PY3.cmake @@ -52,9 +52,10 @@ if(F2PY3_EXECUTABLE) # a new CMake policy, CMP0132, because f2py3 uses Meson in the # instead of distutils. # See https://github.com/mesonbuild/meson/issues/13882 - if (F2PY_VERSION_MAJOR GREATER_EQUAL 3 AND F2PY_VERSION_MINOR GREATER_EQUAL 12) - cmake_policy(SET CMP0132 NEW) - endif () + if (Python3_VERSION_MINOR GREATER_EQUAL 12) + message(STATUS "[F2PY3]: Setting CMP0132 policy to NEW") + cmake_policy(SET CMP0132 NEW) + endif () # Get the compiler-id and map it to compiler vendor as used by f2py3. # Currently, we only check for GNU, but this can easily be extended. diff --git a/python/f2py3/UseF2Py3.cmake b/python/f2py3/UseF2Py3.cmake index 2b8b8399..765a8578 100644 --- a/python/f2py3/UseF2Py3.cmake +++ b/python/f2py3/UseF2Py3.cmake @@ -273,25 +273,25 @@ macro (add_f2py3_module _name) DEPENDS ${add_f2py3_module_SOURCES} COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") else () - if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" - ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" + ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) endif () diff --git a/python/f2py3/try_f2py3_compile.cmake b/python/f2py3/try_f2py3_compile.cmake index 9a92c8c0..2c638c54 100644 --- a/python/f2py3/try_f2py3_compile.cmake +++ b/python/f2py3/try_f2py3_compile.cmake @@ -11,13 +11,27 @@ macro (try_f2py3_compile file var) set( _f2py3_check_bindir "${CMAKE_BINARY_DIR}/f2py3_tmp") file(MAKE_DIRECTORY ${_f2py3_check_bindir}) - execute_process( - COMMAND ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} - WORKING_DIRECTORY ${_f2py3_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + # We need to work around a meson bug with ifort and stderr output + # Once we fully move to use ifx this can be removed + if (IFORT_HAS_DEPRECATION_WARNING) + message(STATUS "Using workaround for ifort with deprecation message") + set(IFORT_IGNORE_DEPRECATION_WARNING "ifort -diag-disable=10448") + execute_process( + COMMAND cmake -E env "FC=${FC_WITH_SPACES}" ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} + WORKING_DIRECTORY ${_f2py3_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) + else () + execute_process( + COMMAND ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} + WORKING_DIRECTORY ${_f2py3_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) + endif () if (result EQUAL 0) file(GLOB F2PY3_TEST_OUTPUT_FILE ${_f2py3_check_bindir}/*.so) From c2f96e314d5dd33cf7f80cf3cffe63b814508a52 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 12 Nov 2024 09:05:56 -0500 Subject: [PATCH 04/10] More fixes for meson, but really all --- CHANGELOG.md | 1 + compiler/checks/check_fortran_support.cmake | 25 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af81314e..3c612836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - For F2PY3 code, set CMake Policy CMP0132 if Python is 3.12+ or higher +- Add test to see if `ifort` spits out the deprecation warning. Needed to hack f2py/meson ### Deprecated diff --git a/compiler/checks/check_fortran_support.cmake b/compiler/checks/check_fortran_support.cmake index 7bd1d415..f4a48585 100644 --- a/compiler/checks/check_fortran_support.cmake +++ b/compiler/checks/check_fortran_support.cmake @@ -8,3 +8,28 @@ try_fortran_compile( ${CMAKE_CURRENT_LIST_DIR}/findloc.F90 FORTRAN_COMPILER_SUPPORTS_FINDLOC ) + +# We also need to do something if we are using Intel Fortran Classic +# Namely, we need to know if when we run just plain 'ifort' if +# anything is output to stderr. If so, we need to set a CMake variable +# that will allow us to do something different later in the +# CMake process. + +if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + if (NOT CMAKE_REQUIRED_QUIET) + message (STATUS "Checking if Intel Fortran Classic compiler has deprecation warning") + endif () + execute_process( + COMMAND ${CMAKE_Fortran_COMPILER} --version + OUTPUT_QUIET + RESULT_VARIABLE IFORT_RESULT + ERROR_VARIABLE IFORT_STDERR + ) + if (IFORT_STDERR) + message (STATUS "Checking if Intel Fortran Classic compiler has deprecation warning: FOUND") + message (STATUS "Setting IFORT_HAS_DEPRECATION_WARNING to TRUE") + set (IFORT_HAS_DEPRECATION_WARNING TRUE) + else () + message (STATUS "Checking if Intel Fortran Classic compiler has deprecation warning: NOT FOUND") + endif () +endif () From 3591cbcb5f24726c9e7315c4fc3e36c5be18e397 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 12 Nov 2024 11:36:09 -0500 Subject: [PATCH 05/10] More fixes --- python/f2py/UseF2Py.cmake | 7 +++- python/f2py/esma_add_f2py_module.cmake | 35 +++++++----------- python/f2py/try_f2py_compile.cmake | 24 +++++-------- python/f2py3/UseF2Py3.cmake | 45 +++++++++++++----------- python/f2py3/esma_add_f2py3_module.cmake | 33 +++++++---------- python/f2py3/try_f2py3_compile.cmake | 24 +++++-------- 6 files changed, 74 insertions(+), 94 deletions(-) diff --git a/python/f2py/UseF2Py.cmake b/python/f2py/UseF2Py.cmake index ae909708..340b0214 100644 --- a/python/f2py/UseF2Py.cmake +++ b/python/f2py/UseF2Py.cmake @@ -265,8 +265,13 @@ macro (add_f2py_module _name) #message(STATUS "add_f2py_module_SOURCES: ${add_f2py_module_SOURCES}") #message(STATUS "_inc_opts: ${_inc_opts}") if ( F2PY_BACKEND STREQUAL "meson") + if(IFORT_HAS_DEPRECATION_WARNING) + set(MESON_F2PY_FCOMPILER "ifort -diag-disable=10448") + else() + set(MESON_F2PY_FCOMPILER "${CMAKE_Fortran_COMPILER}") + endif() add_custom_command(OUTPUT "${_name}${F2PY_SUFFIX}" - COMMAND ${CMAKE_COMMAND} -E env "FC=${CMAKE_Fortran_COMPILER}" + COMMAND ${CMAKE_COMMAND} -E env "FC=${MESON_F2PY_FCOMPILER}" ${F2PY_EXECUTABLE} ${F2PY_QUIET} -m ${_name} --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-${_name}" ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} diff --git a/python/f2py/esma_add_f2py_module.cmake b/python/f2py/esma_add_f2py_module.cmake index cb72739c..2136ee83 100644 --- a/python/f2py/esma_add_f2py_module.cmake +++ b/python/f2py/esma_add_f2py_module.cmake @@ -2,27 +2,18 @@ macro (esma_add_f2py_module name) add_f2py_module (${name} ${ARGN}) - if (NOT CMAKE_Fortran_COMPILER_ID MATCHES GNU) - set(UNIT_TEST test_${name}) - add_test ( - NAME ${UNIT_TEST} - COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python_EXECUTABLE} -c "import ${name}" - ) - - add_custom_command( - TARGET ${name} - COMMENT "Running Python import test on ${name}" - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python_EXECUTABLE} -c "import ${name}" - ) - else () - # This code emits the warning once - get_property(prop_defined GLOBAL PROPERTY GNU_F2PY_WARNING_EMITTED DEFINED) - if (NOT prop_defined) - ecbuild_warn("There are currently issues with GNU and f2py from Conda that prevent running tests") - define_property(GLOBAL PROPERTY GNU_F2PY_WARNING_EMITTED BRIEF_DOCS "GNU-f2py" FULL_DOCS "GNU-f2py") - endif () - endif () + set(UNIT_TEST test_${name}) + add_test ( + NAME ${UNIT_TEST} + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python_EXECUTABLE} -c "import ${name}" + ) + + add_custom_command( + TARGET ${name} + COMMENT "Running Python import test on ${name}" + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python_EXECUTABLE} -c "import ${name}" + ) endmacro () diff --git a/python/f2py/try_f2py_compile.cmake b/python/f2py/try_f2py_compile.cmake index c8818562..83aef3a5 100644 --- a/python/f2py/try_f2py_compile.cmake +++ b/python/f2py/try_f2py_compile.cmake @@ -15,23 +15,17 @@ macro (try_f2py_compile file var) # Once we fully move to use ifx this can be removed if (IFORT_HAS_DEPRECATION_WARNING) message(STATUS "Using workaround for ifort with deprecation message") - set(IFORT_IGNORE_DEPRECATION_WARNING "ifort -diag-disable=10448") - execute_process( - COMMAND cmake -E env "FC=${FC_WITH_SPACES}" ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} - WORKING_DIRECTORY ${_f2py_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + set(MESON_F2PY_FCOMPILER "ifort -diag-disable=10448") else () - execute_process( - COMMAND ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} - WORKING_DIRECTORY ${_f2py_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + set(MESON_F2PY_FCOMPILER "${CMAKE_Fortran_COMPILER}") endif () + execute_process( + COMMAND cmake -E env "FC=${MESON_F2PY_COMPILER}" ${F2PY_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY_FCOMPILER} + WORKING_DIRECTORY ${_f2py_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) if (result EQUAL 0) file(GLOB F2PY_TEST_OUTPUT_FILE ${_f2py_check_bindir}/*.so) diff --git a/python/f2py3/UseF2Py3.cmake b/python/f2py3/UseF2Py3.cmake index 765a8578..8cb04c5b 100644 --- a/python/f2py3/UseF2Py3.cmake +++ b/python/f2py3/UseF2Py3.cmake @@ -265,33 +265,38 @@ macro (add_f2py3_module _name) #message(STATUS "add_f2py3_module_SOURCES: ${add_f2py3_module_SOURCES}") #message(STATUS "_inc_opts: ${_inc_opts}") if ( F2PY3_BACKEND STREQUAL "meson") + if(IFORT_HAS_DEPRECATION_WARNING) + set(MESON_F2PY3_FCOMPILER "ifort -diag-disable=10448") + else() + set(MESON_F2PY3_FCOMPILER "${CMAKE_Fortran_COMPILER}") + endif() add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${CMAKE_COMMAND} -E env "FC=${CMAKE_Fortran_COMPILER}" + COMMAND ${CMAKE_COMMAND} -E env "FC=${MESON_F2PY3_FCONFILER}" ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} DEPENDS ${add_f2py3_module_SOURCES} COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") else () - if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) - add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} - COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} - --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" - -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" - ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} - DEPENDS ${add_f2py3_module_SOURCES} - COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") - endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + if ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + ${_fcompiler_opts} ${_inc_opts} -c ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + else ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) + add_custom_command(OUTPUT "${_name}${F2PY3_SUFFIX}" + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} -h ${_name}.pyf + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + --include-paths ${_inc_paths} --overwrite-signature ${_abs_srcs} ${REDIRECT_TO_DEV_NULL} + COMMAND ${F2PY3_EXECUTABLE} ${F2PY_QUIET} -m ${_name} + --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}" + -c "${CMAKE_CURRENT_BINARY_DIR}/f2py3-${_name}/${_name}.pyf" + ${_fcompiler_opts} ${_inc_opts} ${_lib_opts} ${_abs_srcs} ${_lib_opts} ${_only} ${REDIRECT_TO_DEV_NULL} + DEPENDS ${add_f2py3_module_SOURCES} + COMMENT "[F2PY3] Building Fortran to Python3 interface module ${_name}") + endif ( "${add_f2py3_module_SOURCES}" MATCHES "^[^;]*\\.pyf;" ) endif () diff --git a/python/f2py3/esma_add_f2py3_module.cmake b/python/f2py3/esma_add_f2py3_module.cmake index 013a3708..3576861b 100644 --- a/python/f2py3/esma_add_f2py3_module.cmake +++ b/python/f2py3/esma_add_f2py3_module.cmake @@ -2,27 +2,18 @@ macro (esma_add_f2py3_module name) add_f2py3_module (${name} ${ARGN}) - if (NOT CMAKE_Fortran_COMPILER_ID MATCHES GNU) - set(UNIT_TEST test_${name}) - add_test ( - NAME ${UNIT_TEST} - COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python3_EXECUTABLE} -c "import ${name}" - ) + set(UNIT_TEST test_${name}) + add_test ( + NAME ${UNIT_TEST} + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python3_EXECUTABLE} -c "import ${name}" + ) - add_custom_command( - TARGET ${name} - COMMENT "Running Python3 import test on ${name}" - POST_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python3_EXECUTABLE} -c "import ${name}" - ) - else () - # This code emits the warning once - get_property(prop_defined GLOBAL PROPERTY GNU_F2PY3_WARNING_EMITTED DEFINED) - if (NOT prop_defined) - ecbuild_warn("There are currently issues with GNU and f2py3 from Conda that prevent running tests") - define_property(GLOBAL PROPERTY GNU_F2PY3_WARNING_EMITTED BRIEF_DOCS "GNU-f2py3" FULL_DOCS "GNU-f2py3") - endif () - endif () + add_custom_command( + TARGET ${name} + COMMENT "Running Python3 import test on ${name}" + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${Python3_EXECUTABLE} -c "import ${name}" + ) endmacro () diff --git a/python/f2py3/try_f2py3_compile.cmake b/python/f2py3/try_f2py3_compile.cmake index 2c638c54..fd638e31 100644 --- a/python/f2py3/try_f2py3_compile.cmake +++ b/python/f2py3/try_f2py3_compile.cmake @@ -15,23 +15,17 @@ macro (try_f2py3_compile file var) # Once we fully move to use ifx this can be removed if (IFORT_HAS_DEPRECATION_WARNING) message(STATUS "Using workaround for ifort with deprecation message") - set(IFORT_IGNORE_DEPRECATION_WARNING "ifort -diag-disable=10448") - execute_process( - COMMAND cmake -E env "FC=${FC_WITH_SPACES}" ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} - WORKING_DIRECTORY ${_f2py3_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + set(MESON_F2PY3_FCOMPILER "ifort -diag-disable=10448") else () - execute_process( - COMMAND ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} - WORKING_DIRECTORY ${_f2py3_check_bindir} - RESULT_VARIABLE result - OUTPUT_QUIET - ERROR_QUIET - ) + set(MESON_F2PY3_FCOMPILER "${CMAKE_Fortran_COMPILER}") endif () + execute_process( + COMMAND cmake -E env "FC=${MESON_F2PY3_COMPILER}" ${F2PY3_EXECUTABLE} -m test_ -c ${file} --fcompiler=${F2PY3_FCOMPILER} + WORKING_DIRECTORY ${_f2py3_check_bindir} + RESULT_VARIABLE result + OUTPUT_QUIET + ERROR_QUIET + ) if (result EQUAL 0) file(GLOB F2PY3_TEST_OUTPUT_FILE ${_f2py3_check_bindir}/*.so) From ddb369c5ca10fbfef5d07b286342abb78870a0f6 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 12 Nov 2024 13:33:54 -0500 Subject: [PATCH 06/10] Update minimum CMake version to 3.24 --- CHANGELOG.md | 1 + python/esma_python.cmake | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c612836..8017f036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - For F2PY3 code, set CMake Policy CMP0132 if Python is 3.12+ or higher - Add test to see if `ifort` spits out the deprecation warning. Needed to hack f2py/meson +- Set minimum CMake version to 3.24 for the meson + f2py fix ### Deprecated diff --git a/python/esma_python.cmake b/python/esma_python.cmake index 67e54837..4a73e0c5 100644 --- a/python/esma_python.cmake +++ b/python/esma_python.cmake @@ -1,7 +1,8 @@ # CMake code involving Python # FIND_STRATEGY needs CMake 3.15 or later -cmake_minimum_required(VERSION 3.15) +# The new policy needed for f2py3 and Meson is 3.24 +cmake_minimum_required(VERSION 3.24) # Find Python find_package(Python COMPONENTS Interpreter) From 35dfe0ebfa2a858429d2954ae0ffe0782b495ae4 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 13 Nov 2024 07:41:52 -0500 Subject: [PATCH 07/10] Fix for mepo status bug --- CHANGELOG.md | 3 +++ esma_support/esma_mepo_status.cmake | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8017f036..8131574e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed `mepo status` code to allow for quiet failures. There seems to be an odd scenario on non-internet-connected machines where + `mepo status` will fail unless first run on a node with internet access. We are as yet uncertain why this is the case. + ### Removed ### Added diff --git a/esma_support/esma_mepo_status.cmake b/esma_support/esma_mepo_status.cmake index 2c8f2d24..448cbd37 100644 --- a/esma_support/esma_mepo_status.cmake +++ b/esma_support/esma_mepo_status.cmake @@ -20,10 +20,11 @@ function(esma_capture_mepo_status) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_FILE "${OUTPUT_FILE}" RESULT_VARIABLE MEPO_STATUS_RESULT + ERROR_QUIET ) if(NOT MEPO_STATUS_RESULT EQUAL 0) - message(WARNING "mepo state and command were found but failed to run mepo status --hashes. This is odd.") + message(WARNING "mepo state and command were found but failed to run mepo status --hashes. This seems to happen when internet access is not available. Sometimes. We are not sure yet.") else() message(STATUS "mepo status output captured in ${OUTPUT_FILE_NAME}") From bd6e0eb86b733a34d6418d830570664bebd1d3f7 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 13 Nov 2024 09:10:44 -0500 Subject: [PATCH 08/10] Clarify warning --- esma_support/esma_mepo_status.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esma_support/esma_mepo_status.cmake b/esma_support/esma_mepo_status.cmake index 448cbd37..affdbb2e 100644 --- a/esma_support/esma_mepo_status.cmake +++ b/esma_support/esma_mepo_status.cmake @@ -24,7 +24,7 @@ function(esma_capture_mepo_status) ) if(NOT MEPO_STATUS_RESULT EQUAL 0) - message(WARNING "mepo state and command were found but failed to run mepo status --hashes. This seems to happen when internet access is not available. Sometimes. We are not sure yet.") + message(WARNING "mepo state and command were found but failed to run mepo status --hashes. This seems to happen with blobless clones and running on a node without access to the internet. Skipping mepo status output capture, but to fix, run mepo status on a node with internet access.") else() message(STATUS "mepo status output captured in ${OUTPUT_FILE_NAME}") From 4442a8b660b6748c9c2eebb2e2d8a30c329de7b0 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 13 Nov 2024 09:13:06 -0500 Subject: [PATCH 09/10] Clarify changelog --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8131574e..66dc0998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed `mepo status` code to allow for quiet failures. There seems to be an odd scenario on non-internet-connected machines where - `mepo status` will fail unless first run on a node with internet access. We are as yet uncertain why this is the case. +- Fixed `mepo status` code to allow for quiet failures. There seems to be an odd scenario on non-internet-connected machines where `mepo status` will fail in blobless clones of some repos. Running `mepo status` on a node with internet access seems to fix this. ### Removed From e4b392b402518a435a9190384b2e777fc756549a Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 13 Nov 2024 09:13:51 -0500 Subject: [PATCH 10/10] Update changelog for release --- CHANGELOG.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66dc0998..b4474cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,20 +9,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed `mepo status` code to allow for quiet failures. There seems to be an odd scenario on non-internet-connected machines where `mepo status` will fail in blobless clones of some repos. Running `mepo status` on a node with internet access seems to fix this. - ### Removed ### Added ### Changed +### Deprecated + +## [4.9.0] - 2024-11-13 + +### Fixed + +- Fixed `mepo status` code to allow for quiet failures. There seems to be an odd scenario on non-internet-connected machines where `mepo status` will fail in blobless clones of some repos. Running `mepo status` on a node with internet access seems to fix this. + +### Changed + - For F2PY3 code, set CMake Policy CMP0132 if Python is 3.12+ or higher - Add test to see if `ifort` spits out the deprecation warning. Needed to hack f2py/meson - Set minimum CMake version to 3.24 for the meson + f2py fix -### Deprecated - ## [4.8.1] - 2024-11-07 ### Fixed