[Mlir-commits] [mlir] e0af503 - [mlir] Update Python CMake version requirement.

Mike Urbach llvmlistbot at llvm.org
Mon Jul 25 10:29:39 PDT 2022


Author: Mike Urbach
Date: 2022-07-25T11:29:33-06:00
New Revision: e0af5032f17b09f1f39d4ecfe82a6c23e5526c7c

URL: https://github.com/llvm/llvm-project/commit/e0af5032f17b09f1f39d4ecfe82a6c23e5526c7c
DIFF: https://github.com/llvm/llvm-project/commit/e0af5032f17b09f1f39d4ecfe82a6c23e5526c7c.diff

LOG: [mlir] Update Python CMake version requirement.

The minimum required version is now 3.19 due to the usage of some
more recent features. Update the version check and error message
accordingly. Also remove some logic that behaved differently before
3.18, since we can assume we are now on version 3.19+.

Reviewed By: stella.stamenova

Differential Revision: https://reviews.llvm.org/D130171

Added: 
    

Modified: 
    mlir/cmake/modules/MLIRDetectPythonEnv.cmake

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 7cbad493d247a..9c89665915140 100644
--- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
+++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
@@ -2,37 +2,29 @@
 
 # Finds and configures python packages needed to build MLIR Python bindings.
 macro(mlir_configure_python_dev_packages)
-  if(CMAKE_VERSION VERSION_LESS "3.15.0")
+  if(CMAKE_VERSION VERSION_LESS "3.19.0")
   message(SEND_ERROR
       "Building MLIR Python bindings is known to rely on CMake features "
-      "that require at least version 3.15. Recommend upgrading to 3.18+ "
+      "that require at least version 3.19. Recommend upgrading to 3.19+ "
       "for full support. Detected current version: ${CMAKE_VERSION}")
   endif()
 
+  if(MLIR_DETECT_PYTHON_ENV_PRIME_SEARCH)
+    # Prime the search for python to see if there is a full development
+    # package. This seems to work around cmake bugs searching only for
+    # Development.Module in some environments. However, in other environments
+    # it may interfere with the subsequent search for Development.Module.
+    find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+      COMPONENTS Interpreter Development)
+  endif()
+
   # After CMake 3.18, we are able to limit the scope of the search to just
   # Development.Module. Searching for Development will fail in situations where
   # the Python libraries are not available. When possible, limit to just
   # Development.Module.
   # See https://pybind11.readthedocs.io/en/stable/compiling.html#findpython-mode
-  if(CMAKE_VERSION VERSION_LESS "3.18.0")
-    message(WARNING
-        "This version of CMake is not compatible with statically built Python "
-        "installations. If Python fails to detect below this may apply to you. "
-        "Recommend upgrading to at least CMake 3.18. "
-        "Detected current version: ${CMAKE_VERSION}"
-    )
-    set(_python_development_component Development)
-  else()
-    if(MLIR_DETECT_PYTHON_ENV_PRIME_SEARCH)
-      # Prime the search for python to see if there is a full development
-      # package. This seems to work around cmake bugs searching only for
-      # Development.Module in some environments. However, in other environments
-      # it may interfere with the subsequent search for Development.Module.
-      find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
-        COMPONENTS Interpreter Development)
-    endif()
-    set(_python_development_component Development.Module)
-  endif()
+  set(_python_development_component Development.Module)
+
   find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
     COMPONENTS Interpreter ${_python_development_component} NumPy REQUIRED)
   unset(_python_development_component)


        


More information about the Mlir-commits mailing list