Skip to content

Commit b9c14d7

Browse files
committed
Allow to build GenAI with OpenVINO via extra modules
1 parent 4e66950 commit b9c14d7

File tree

8 files changed

+54
-29
lines changed

8 files changed

+54
-29
lines changed

CMakeLists.txt

+11-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ elseif(NOT GENERATOR_IS_MULTI_CONFIG_VAR AND NOT DEFINED CMAKE_BUILD_TYPE)
1717
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...")
1818
endif()
1919

20+
if(POLICY CMP0135)
21+
cmake_policy(SET CMP0135 NEW)
22+
endif()
23+
24+
if(POLICY CMP0169)
25+
cmake_policy(SET CMP0169 OLD)
26+
endif()
27+
2028
project(OpenVINOGenAI
2129
VERSION 2024.4.0.0
2230
DESCRIPTION "OpenVINO GenAI"
@@ -33,14 +41,6 @@ if(NOT OpenVINODeveloperPackage_FOUND)
3341
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
3442
endif()
3543

36-
# check that SDPA to PA transformtion exists
37-
get_target_property(ov_include_dirs openvino::runtime INTERFACE_INCLUDE_DIRECTORIES)
38-
find_file(spda_to_pa_header sdpa_to_paged_attention.hpp
39-
PATHS ${ov_include_dirs}
40-
PATH_SUFFIXES openvino/pass
41-
DOC "Path to sdpa_to_paged_attention.hpp header"
42-
NO_CACHE REQUIRED NO_DEFAULT_PATH)
43-
4444
include(cmake/features.cmake)
4545

4646
if(ENABLE_PYTHON)
@@ -64,7 +64,9 @@ add_subdirectory(tests/cpp)
6464

6565
install(FILES LICENSE DESTINATION docs/licensing COMPONENT licensing_genai RENAME LICENSE-GENAI)
6666
install(FILES third-party-programs.txt DESTINATION docs/licensing COMPONENT licensing_genai RENAME third-party-programs-genai.txt)
67-
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
67+
if(NOT DEFINED CPACK_ARCHIVE_COMPONENT_INSTALL)
68+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
69+
endif()
6870
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
6971
# Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/2614
7072
set(CPACK_COMPONENTS_ALL core_genai core_genai_dev cpp_samples_genai licensing_genai openvino_tokenizers openvino_tokenizers_docs)

image_generation/common/diffusers/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ target_link_libraries(diffusers PUBLIC openvino::runtime)
2121

2222
include(FetchContent)
2323

24+
if(POLICY CMP0169)
25+
cmake_policy(SET CMP0169 OLD)
26+
endif()
27+
2428
FetchContent_Declare(eigen3)
2529
FetchContent_GetProperties(eigen3)
2630
if(NOT eigen3_POPULATED)

samples/cpp/benchmark_genai/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Copyright (C) 2023-2024 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4-
54
find_package(OpenVINOGenAI REQUIRED PATHS
65
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
76
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
87
)
98

9+
include(FetchContent)
10+
11+
if(POLICY CMP0135)
12+
cmake_policy(SET CMP0135 NEW)
13+
endif()
14+
1015
FetchContent_Declare(cxxopts
1116
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz
1217
URL_HASH SHA256=523175f792eb0ff04f9e653c90746c12655f10cb70f1d5e6d6d9491420298a08)
@@ -18,6 +23,7 @@ set_target_properties(benchmark_genai PROPERTIES
1823
COMPILE_PDB_NAME benchmark_genai
1924
# Ensure out of box LC_RPATH on macOS with SIP
2025
INSTALL_RPATH_USE_LINK_PATH ON)
26+
2127
install(TARGETS benchmark_genai
2228
RUNTIME DESTINATION samples_bin/
2329
COMPONENT samples_bin

samples/cpp/continuous_batching_accuracy/CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

66
include(FetchContent)
77

8+
if(POLICY CMP0135)
9+
cmake_policy(SET CMP0135 NEW)
10+
endif()
11+
812
FetchContent_Declare(cxxopts
913
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz
1014
URL_HASH SHA256=523175f792eb0ff04f9e653c90746c12655f10cb70f1d5e6d6d9491420298a08)
11-
12-
FetchContent_Declare(nlohmann_json
13-
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
14-
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
15-
1615
FetchContent_MakeAvailable(cxxopts)
17-
FetchContent_MakeAvailable(nlohmann_json)
16+
17+
if(NOT TARGET nlohmann_json)
18+
FetchContent_Declare(nlohmann_json
19+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
20+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
21+
FetchContent_MakeAvailable(nlohmann_json)
22+
endif()
1823

1924
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
2025

samples/cpp/continuous_batching_benchmark/CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

66
include(FetchContent)
77

8+
if(POLICY CMP0135)
9+
cmake_policy(SET CMP0135 NEW)
10+
endif()
11+
812
FetchContent_Declare(cxxopts
913
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz
1014
URL_HASH SHA256=523175f792eb0ff04f9e653c90746c12655f10cb70f1d5e6d6d9491420298a08)
11-
12-
FetchContent_Declare(nlohmann_json
13-
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
14-
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
15-
1615
FetchContent_MakeAvailable(cxxopts)
17-
FetchContent_MakeAvailable(nlohmann_json)
16+
17+
if(NOT TARGET nlohmann_json)
18+
FetchContent_Declare(nlohmann_json
19+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
20+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
21+
FetchContent_MakeAvailable(nlohmann_json)
22+
endif()
1823

1924
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
2025
find_package(Threads REQUIRED)

src/cpp/CMakeLists.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
include(FetchContent)
88

9-
FetchContent_Declare(nlohmann_json
10-
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
11-
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
12-
FetchContent_MakeAvailable(nlohmann_json)
9+
if(NOT TARGET nlohmann_json)
10+
FetchContent_Declare(nlohmann_json
11+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
12+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
13+
FetchContent_MakeAvailable(nlohmann_json)
14+
endif()
1315

1416
function(ov_genai_build_jinja2cpp)
1517
FetchContent_Declare(jinja2cpp
@@ -56,7 +58,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES
5658
LIBRARY_OUTPUT_DIRECTORY "$<1:${CMAKE_BINARY_DIR}/openvino_genai/>"
5759
RUNTIME_OUTPUT_DIRECTORY "$<1:${CMAKE_BINARY_DIR}/openvino_genai/>"
5860
)
59-
# Extract two last digits from CMAKE_PROJECT_VERSION_MAJOR because SOVERSION can only contain up to 4 symbols.
61+
# Extract two last digits from OpenVINOGenAI_VERSION_MAJOR because SOVERSION can only contain up to 4 symbols.
6062
string(REGEX MATCH [=[[0-9][0-9]$]=] MAJOR_SUFFIX ${OpenVINOGenAI_VERSION_MAJOR})
6163
if(DEFINED PY_BUILD_CMAKE_PACKAGE_NAME AND LINUX)
6264
# Don't pack symlinks but append version hash to the name for wheel
@@ -67,7 +69,7 @@ elseif(DEFINED PY_BUILD_CMAKE_PACKAGE_NAME AND APPELE)
6769
SUFFIX .${MAJOR_SUFFIX}${OpenVINOGenAI_VERSION_MINOR}${OpenVINOGenAI_VERSION_PATCH}${CMAKE_SHARED_LIBRARY_SUFFIX})
6870
else()
6971
set_target_properties(${TARGET_NAME} PROPERTIES
70-
VERSION ${CMAKE_PROJECT_VERSION}
72+
VERSION ${OpenVINOGenAI_VERSION}
7173
SOVERSION ${MAJOR_SUFFIX}${OpenVINOGenAI_VERSION_MINOR}${OpenVINOGenAI_VERSION_PATCH})
7274
endif()
7375

src/python/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44

55
include(FetchContent)
6+
67
FetchContent_Declare(
78
pybind11
89
URL https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.tar.gz

0 commit comments

Comments
 (0)