summaryrefslogtreecommitdiff
path: root/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
diff options
context:
space:
mode:
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>2022-01-25 07:53:48 -0800
committerStephen Neuendorffer <stephen.neuendorffer@xilinx.com>2022-01-27 13:32:29 -0800
commit84fe34a0b7fdd7bbf179981d1583693d5d5ec68b (patch)
treec7ea08cb342f13448b1f96bd70765a88e840be4b /mlir/cmake/modules/MLIRDetectPythonEnv.cmake
parentcd317637708decd8faf34dd9773a8b2dec424010 (diff)
[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
Diffstat (limited to 'mlir/cmake/modules/MLIRDetectPythonEnv.cmake')
-rw-r--r--mlir/cmake/modules/MLIRDetectPythonEnv.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake
index 9b36406edfcd..87039fd4b2e9 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}