[Mlir-commits] [mlir] 07f1047 - [mlir] Refactor finding python
Marius Brehler
llvmlistbot at llvm.org
Tue Nov 10 12:22:02 PST 2020
Author: Marius Brehler
Date: 2020-11-10T21:21:40+01:00
New Revision: 07f1047f41d6440055ac52e9d3a98d4329fd3592
URL: https://github.com/llvm/llvm-project/commit/07f1047f41d6440055ac52e9d3a98d4329fd3592
DIFF: https://github.com/llvm/llvm-project/commit/07f1047f41d6440055ac52e9d3a98d4329fd3592.diff
LOG: [mlir] Refactor finding python
This drops the use of deprecated CMake modules to find python.
Differential Revision: https://reviews.llvm.org/D91197
Added:
Modified:
mlir/CMakeLists.txt
mlir/cmake/modules/AddMLIRPythonExtension.cmake
Removed:
################################################################################
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index c83b6f56b4cc..8c8d59280968 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -78,10 +78,9 @@ set(MLIR_PYTHON_BINDINGS_VERSION_LOCKED 1 CACHE BOOL
"Links to specific python libraries, resolving all symbols.")
if(MLIR_BINDINGS_PYTHON_ENABLED)
- find_package(PythonInterp REQUIRED)
- find_package(PythonLibs REQUIRED)
- message(STATUS "Found python include dirs: ${PYTHON_INCLUDE_DIRS}")
- message(STATUS "Found python libraries: ${PYTHON_LIBRARIES}")
+ find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+ message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
+ message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
find_package(pybind11 CONFIG REQUIRED)
# TODO: pybind11 v2.6 switched from pybind11_INCLUDE_DIRS (plural) to
# pybind11_INCLUDE_DIR (singular). A lot has changed in this area since this
diff --git a/mlir/cmake/modules/AddMLIRPythonExtension.cmake b/mlir/cmake/modules/AddMLIRPythonExtension.cmake
index 3cc01c7bd999..8a74675e2543 100644
--- a/mlir/cmake/modules/AddMLIRPythonExtension.cmake
+++ b/mlir/cmake/modules/AddMLIRPythonExtension.cmake
@@ -24,12 +24,12 @@ function(add_mlir_python_extension libname extname)
# symbols, which is better for development. Note that not all python
# configurations provide build-time libraries to link against, in which
# case, we fall back to MODULE linking.
- if(PYTHON_LIBRARIES STREQUAL "" OR NOT MLIR_PYTHON_BINDINGS_VERSION_LOCKED)
+ if(Python3_LIBRARIES STREQUAL "" OR NOT MLIR_PYTHON_BINDINGS_VERSION_LOCKED)
set(PYEXT_LINK_MODE MODULE)
set(PYEXT_LIBADD)
else()
set(PYEXT_LINK_MODE SHARED)
- set(PYEXT_LIBADD ${PYTHON_LIBRARIES})
+ set(PYEXT_LIBADD ${Python3_LIBRARIES})
endif()
# The actual extension library produces a shared-object or DLL and has
@@ -40,7 +40,7 @@ function(add_mlir_python_extension libname extname)
)
target_include_directories(${libname} PRIVATE
- "${PYTHON_INCLUDE_DIRS}"
+ "${Python3_INCLUDE_DIRS}"
"${pybind11_INCLUDE_DIR}"
)
More information about the Mlir-commits
mailing list