[Mlir-commits] [mlir] 84fe34a - [MLIR] Workaround for python detection problems.

Stephen Neuendorffer llvmlistbot at llvm.org
Thu Jan 27 13:32:42 PST 2022


Author: Stephen Neuendorffer
Date: 2022-01-27T13:32:29-08:00
New Revision: 84fe34a0b7fdd7bbf179981d1583693d5d5ec68b

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

LOG: [MLIR] Workaround for python detection problems.

Although cmake should be platform-independent, we've observed
that some aspects of Python detection don't work on all platforms,
even with recent versions of cmake.  This appears to be due to bugs
in the python detection logic, especially when the NumPy component
is required and not located within the python installation.
As a workaround, this patch first searches for "Development" before
searching for "Development.Module", which seems to workaround the
issue.

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

Added: 
    

Modified: 
    mlir/cmake/modules/MLIRDetectPythonEnv.cmake

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 9b36406edfcde..87039fd4b2e93 100644
--- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
+++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
@@ -23,6 +23,11 @@ macro(mlir_configure_python_dev_packages)
     )
     set(_python_development_component Development)
   else()
+    # 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.
+    find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
+      COMPONENTS Development)
     set(_python_development_component Development.Module)
   endif()
   find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}


        


More information about the Mlir-commits mailing list