From f7a8e60b88f546d26dafe6dd9050a69350d7d374 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Thu, 1 Aug 2024 21:15:05 +0200 Subject: [PATCH 1/2] [GraphCompiler] Use find_package() for CMake < 3.24 --- cmake/graph-compiler.cmake | 42 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/cmake/graph-compiler.cmake b/cmake/graph-compiler.cmake index e33f01125f756c..eb07039e886862 100644 --- a/cmake/graph-compiler.cmake +++ b/cmake/graph-compiler.cmake @@ -1,24 +1,32 @@ get_property(GRAPH_COMPILER_LIBS GLOBAL PROPERTY GRAPH_COMPILER_LIBS) if (NOT DEFINED GRAPH_COMPILER_LIBS) - include(FetchContent) + # The FetchContent_Declare(FIND_PACKAGE_ARGS) is supported since CMake 3.24. For the prior + # versions, using find_package() first. If the package is not found, then using FetchContent. + if (CMAKE_VERSION VERSION_LESS "3.24") + find_package(GraphCompiler QUIET) + endif () - #FIXME: Replace the repository URL with the https://github.com/intel/graph-compiler - FetchContent_Declare( - GC - GIT_REPOSITORY https://github.com/AndreyPavlenko/graph-compiler.git - GIT_TAG pkg - FIND_PACKAGE_ARGS NAMES GraphCompiler - ) + if (NOT GraphCompiler_FOUND) + include(FetchContent) + + #FIXME: Replace the repository URL with the https://github.com/intel/graph-compiler + FetchContent_Declare( + GC + GIT_REPOSITORY https://github.com/AndreyPavlenko/graph-compiler.git + GIT_TAG pkg + FIND_PACKAGE_ARGS NAMES GraphCompiler + ) - set(GC_ENABLE_OPT OFF) - set(GC_ENABLE_TEST OFF) - set(GC_ENABLE_DNNL OFF) - set(GC_ENABLE_LEGACY OFF) - set(GC_ENABLE_BINDINGS_PYTHON OFF) - set(OV_BUILD_SHARED_LIBS_TMP ${BUILD_SHARED_LIBS}) - set(BUILD_SHARED_LIBS OFF) - FetchContent_MakeAvailable(GC) - set(BUILD_SHARED_LIBS ${OV_BUILD_SHARED_LIBS_TMP}) + set(GC_ENABLE_OPT OFF) + set(GC_ENABLE_TEST OFF) + set(GC_ENABLE_DNNL OFF) + set(GC_ENABLE_LEGACY OFF) + set(GC_ENABLE_BINDINGS_PYTHON OFF) + set(OV_BUILD_SHARED_LIBS_TMP ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) + FetchContent_MakeAvailable(GC) + set(BUILD_SHARED_LIBS ${OV_BUILD_SHARED_LIBS_TMP}) + endif () set(GRAPH_COMPILER_LIBS GcInterface From c5b56eb152a11869aaf9010d38dde8bd84f0dff2 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Fri, 2 Aug 2024 15:56:29 +0200 Subject: [PATCH 2/2] Changed the Graph Compiler git url --- cmake/graph-compiler.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/graph-compiler.cmake b/cmake/graph-compiler.cmake index eb07039e886862..30b9e5b6913d14 100644 --- a/cmake/graph-compiler.cmake +++ b/cmake/graph-compiler.cmake @@ -9,11 +9,10 @@ if (NOT DEFINED GRAPH_COMPILER_LIBS) if (NOT GraphCompiler_FOUND) include(FetchContent) - #FIXME: Replace the repository URL with the https://github.com/intel/graph-compiler FetchContent_Declare( GC - GIT_REPOSITORY https://github.com/AndreyPavlenko/graph-compiler.git - GIT_TAG pkg + GIT_REPOSITORY https://github.com/intel/graph-compiler.git + GIT_TAG main FIND_PACKAGE_ARGS NAMES GraphCompiler )