Skip to content

Commit

Permalink
[GraphCompiler] Use find_package() for CMake < 3.24
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Aug 1, 2024
1 parent 463210d commit f7a8e60
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions cmake/graph-compiler.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f7a8e60

Please sign in to comment.