Skip to content

Commit 25dc8c4

Browse files
committed
Allow to build GenAI with OpenVINO via extra modules
1 parent 49623a6 commit 25dc8c4

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ add_subdirectory(text_generation/causal_lm/cpp/continuous_batching)
4040

4141
install(FILES LICENSE DESTINATION licensing COMPONENT licensing_genai RENAME LICENSE-GENAI)
4242
install(FILES third-party-programs.txt DESTINATION licensing COMPONENT licensing_genai RENAME third-party-programs-genai.txt)
43-
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
43+
if(NOT DEFINED CPACK_ARCHIVE_COMPONENT_INSTALL)
44+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
45+
endif()
4446
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
4547
include(CPack)

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_PROJECT_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_PROJECT_VERSION}
7173
SOVERSION ${MAJOR_SUFFIX}${OpenVINOGenAI_VERSION_MINOR}${OpenVINOGenAI_VERSION_PATCH})
7274
endif()
7375

text_generation/causal_lm/cpp/continuous_batching/apps/CMakeLists.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ include(FetchContent)
88
FetchContent_Declare(cxxopts
99
URL https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz
1010
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-
1611
FetchContent_MakeAvailable(cxxopts)
17-
FetchContent_MakeAvailable(nlohmann_json)
12+
13+
if(NOT TARGET nlohmann_json)
14+
FetchContent_Declare(nlohmann_json
15+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
16+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
17+
FetchContent_MakeAvailable(nlohmann_json)
18+
endif()
1819

1920
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
2021
find_package(Threads REQUIRED)

text_generation/causal_lm/cpp/continuous_batching/library/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ cmake_minimum_required(VERSION 3.15)
77

88
include(FetchContent)
99

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-
14-
FetchContent_MakeAvailable(nlohmann_json)
10+
if(NOT TARGET nlohmann_json)
11+
FetchContent_Declare(nlohmann_json
12+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
13+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
14+
FetchContent_MakeAvailable(nlohmann_json)
15+
endif()
1516

1617
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
1718

0 commit comments

Comments
 (0)