Skip to content

Commit ca2104f

Browse files
authored
Add LTO support check if genai is built without openvino dev package (openvinotoolkit#3712)
<!-- Keep your pull requests (PRs) as atomic as possible. That increases the likelihood that an individual PR won't be stuck because of adjacent problems, merge conflicts, or code review. Your merged PR is going to appear in the automatically generated release notes on GitHub. So the clearer the title the better. --> ## Description <!-- Please include a summary of the change. Also include relevant motivation and context. --> Add LTO support check if genai is built without openvino dev package. If OpenVINODeveloperPackage_FOUND, such check is performed in OpenVINODeveloperScriptsConfig.cmake ## Checklist: - [x] This PR follows [GenAI Contributing guidelines](https://github.com/openvinotoolkit/openvino.genai?tab=contributing-ov-file#contributing). <!-- Always follow them. If there are deviations, explain what and why. --> - [x] This PR fully addresses the ticket. <!--- If not, explain clearly what is covered and what is not. If follow-up pull requests are needed, specify in the description. -->
1 parent 6922238 commit ca2104f

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

cmake/features.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ option(ENABLE_TESTS "Enable tests build" ON)
1010
option(ENABLE_TOOLS "Enable tools build" ON)
1111
option(ENABLE_GGUF "Enable support for GGUF format" ON)
1212
option(ENABLE_XGRAMMAR "Enable support for structured output generation with xgrammar backend" ON)
13+
option(ENABLE_LTO "Enable Link Time Optimization" OFF)
14+
15+
# When building without OpenVINODeveloperPackage, verify IPO/LTO support
16+
if(ENABLE_LTO AND NOT OpenVINODeveloperPackage_FOUND)
17+
include(CheckIPOSupported)
18+
check_ipo_supported(RESULT IPO_SUPPORTED
19+
OUTPUT OUTPUT_MESSAGE
20+
LANGUAGES C CXX)
21+
if(NOT IPO_SUPPORTED)
22+
message(FATAL_ERROR "ENABLE_LTO is ON but IPO / LTO is not supported: ${OUTPUT_MESSAGE}")
23+
endif()
24+
endif()
1325

1426
# Disable building samples for NPM package
1527
if(CPACK_GENERATOR STREQUAL "NPM")

src/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ else()
6161
set(RUNTIME_DESTINATION runtime/bin/${ARCH_DIR})
6262
endif()
6363

64-
if(NOT DEFINED ENABLE_LTO)
65-
set(ENABLE_LTO OFF)
66-
endif()
67-
6864
#
6965
# Include source dirs
7066
#

0 commit comments

Comments
 (0)