From 84fe34a0b7fdd7bbf179981d1583693d5d5ec68b Mon Sep 17 00:00:00 2001 From: Stephen Neuendorffer Date: Tue, 25 Jan 2022 07:53:48 -0800 Subject: [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 --- mlir/cmake/modules/MLIRDetectPythonEnv.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mlir/cmake/modules/MLIRDetectPythonEnv.cmake') 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} -- cgit v1.2.3