Skip to content

Commit 57cf805

Browse files
committed
Update
[ghstack-poisoned]
2 parents e21affc + b2ff575 commit 57cf805

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,15 @@ def run(self):
777777
"tools/cmake/executorch-wheel-config.cmake",
778778
"share/cmake/executorch-config.cmake",
779779
),
780+
# Also at the standard location, so a consumer can point
781+
# CMAKE_PREFIX_PATH at the installed package root. CMake only
782+
# searches lib/cmake/<package name> and a few similar directories
783+
# for a named package, not a bare share/cmake, so without this a
784+
# consumer has to know the exact leaf holding the file.
785+
(
786+
"tools/cmake/executorch-wheel-config.cmake",
787+
"lib/cmake/executorch/executorch-config.cmake",
788+
),
780789
]
781790
# Copy all the necessary headers into include/executorch/ so that they can
782791
# be found in the pip package. This is the subset of headers that are

tools/cmake/executorch-wheel-config.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@
4444
# fails once it is deployed somewhere else.
4545
cmake_minimum_required(VERSION 3.28)
4646

47-
# This file is installed to <site-packages>/executorch/share/cmake, so the
48-
# package root is two levels up. Everything is resolved relative to this file so
49-
# the wheel stays relocatable: no absolute path from the machine that built it
50-
# is baked in here.
51-
get_filename_component(
52-
_executorch_package_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE
47+
# Everything is resolved relative to this file so the wheel stays relocatable:
48+
# no absolute path from the machine that built it is baked in here. The file is
49+
# installed both under share/cmake, which the historical contract uses, and
50+
# under lib/cmake/executorch, which a plain CMAKE_PREFIX_PATH pointed at the
51+
# package root can discover, so the root is located by a marker rather than a
52+
# fixed depth.
53+
find_path(
54+
_executorch_package_root include/executorch
55+
PATHS "${CMAKE_CURRENT_LIST_DIR}/.." "${CMAKE_CURRENT_LIST_DIR}/../.."
56+
"${CMAKE_CURRENT_LIST_DIR}/../../.."
57+
NO_DEFAULT_PATH
5358
)
5459

5560
set(EXECUTORCH_INCLUDE_DIRS

0 commit comments

Comments
 (0)