From 7dd6fa62fe55498c7a03984917db43b535f8d00b Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Mon, 9 Dec 2024 18:18:33 +0100 Subject: [PATCH] Initialize nanobind at top-level (#19422) Initalizes nanobind at the top-level as MLIR is switching over to nanobind with https://github.com/llvm/llvm-project/pull/118583. --- CMakeLists.txt | 12 ++++++++++++ runtime/bindings/python/CMakeLists.txt | 9 --------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16ab9a3c4d05..be53afcdcc60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -773,6 +773,18 @@ endif() # MLIR/LLVM Dependency #------------------------------------------------------------------------------- +# Both the IREE and MLIR Python bindings require nanobind. We initialize it here +# at the top level so that everything uses ours consistently. +if(IREE_BUILD_PYTHON_BINDINGS OR IREE_BUILD_COMPILER) + include(FetchContent) + FetchContent_Declare( + nanobind + GIT_REPOSITORY https://github.com/wjakob/nanobind.git + GIT_TAG 0f9ce749b257fdfe701edb3cf6f7027ba029434a # v2.4.0 + ) + FetchContent_MakeAvailable(nanobind) +endif() + # Both the IREE and MLIR Python bindings require pybind11. We initialize it here # at the top level so that everything uses ours consistently. if(IREE_BUILD_PYTHON_BINDINGS AND IREE_BUILD_COMPILER) diff --git a/runtime/bindings/python/CMakeLists.txt b/runtime/bindings/python/CMakeLists.txt index affd1b316922..7171c2e3aaa1 100644 --- a/runtime/bindings/python/CMakeLists.txt +++ b/runtime/bindings/python/CMakeLists.txt @@ -4,15 +4,6 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# nanobind -include(FetchContent) -FetchContent_Declare( - nanobind - GIT_REPOSITORY https://github.com/wjakob/nanobind.git - GIT_TAG 0f9ce749b257fdfe701edb3cf6f7027ba029434a # v2.4.0 -) -FetchContent_MakeAvailable(nanobind) - set(_EXTRA_INSTALL_TOOL_TARGETS) set(_TRACY_ENABLED OFF)