Skip to content

Commit d23381a

Browse files
Arm backend: Use VGF CMake package (pytorch#23148)
Use the CMake package shipped with the VGF wheel to select the archive and include directory. Keep the existing imported target for explicit and legacy VGF layouts. Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com> Co-authored-by: Davide Grohmann <davide.grohmann@arm.com>
1 parent bca2ffc commit d23381a

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

‎backends/arm/CMakeLists.txt‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ if(EXECUTORCH_BUILD_VGF)
239239
set(LIBVGF_PATH "${_vgf_site_pure}")
240240
endif()
241241

242+
find_package(
243+
VGF
244+
CONFIG
245+
REQUIRED
246+
HINTS
247+
"${LIBVGF_PATH}"
248+
PATH_SUFFIXES
249+
lib64/cmake/VGF
250+
lib/cmake/VGF
251+
NO_DEFAULT_PATH
252+
)
253+
242254
if(EXECUTORCH_BUILD_TESTS)
243255
add_executable(
244256
vgf_neural_statistics_test
@@ -268,15 +280,15 @@ if(EXECUTORCH_BUILD_VGF)
268280
COMMAND vgf_neural_statistics_test
269281
)
270282
endif()
271-
272-
set(LIBVGF_STATIC "${LIBVGF_PATH}/lib/libvgf.a")
273283
endif()
274284

275-
set(LIBVGF_INCLUDE "${LIBVGF_PATH}/include/")
276-
277-
add_library(vgf STATIC IMPORTED)
278-
set_property(TARGET vgf PROPERTY IMPORTED_LOCATION "${LIBVGF_STATIC}")
279-
target_include_directories(vgf INTERFACE "${LIBVGF_INCLUDE}")
285+
if(TARGET VGF::vgf)
286+
add_library(vgf ALIAS VGF::vgf)
287+
else()
288+
add_library(vgf STATIC IMPORTED)
289+
set_property(TARGET vgf PROPERTY IMPORTED_LOCATION "${LIBVGF_STATIC}")
290+
target_include_directories(vgf INTERFACE "${LIBVGF_PATH}/include/")
291+
endif()
280292

281293
# Add backend delegate for VGF
282294
set(_vgf_backend_sources

0 commit comments

Comments
 (0)