Skip to content

Commit

Permalink
Fixed compilation when building out of OV source tree (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Oct 10, 2023
1 parent 000bb22 commit 15a840f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
12 changes: 5 additions & 7 deletions modules/nvidia_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

cmake_minimum_required(VERSION 3.13)
project(InferenceEngineNVIDIAGpuPlugin CXX CUDA)
project(OpenVINONVIDIAGpuPlugin CXX CUDA)

# Initialize CMAKE_CUDA_ARCHITECTURES when CMAKE_CUDA_COMPILER_ID is NVIDIA.
# Raise an error if CUDA_ARCHITECTURES is empty.
Expand All @@ -26,16 +26,14 @@ if (ENABLE_CUDNN_BACKEND_API)
add_definitions(-DENABLE_CUDNN_BACKEND_API)
endif()

set(IE_MAIN_CUDA_PLUGIN_SOURCE_DIR ${InferenceEngineNVIDIAGpuPlugin_SOURCE_DIR})

find_package(OpenVINODeveloperPackage REQUIRED
PATHS "${InferenceEngineDeveloperPackage_DIR}")

include(cmake/features.cmake)

set(HAS_REQUIRED REQUIRED)

if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
if(CMAKE_VERSION VERSION_LESS 3.17.0)
set(HAS_REQUIRED)
find_package(CUDA REQUIRED)
set(CUDAToolkit_VERSION_MAJOR ${CUDA_VERSION_MAJOR})
Expand Down Expand Up @@ -149,7 +147,7 @@ include(FetchContent)
FetchContent_Declare(GSL
GIT_REPOSITORY "https://github.com/microsoft/GSL"
GIT_TAG "v3.1.0")
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
if(CMAKE_VERSION VERSION_LESS 3.14.0)
FetchContent_GetProperties(GSL)
if(NOT GSL_POPULATED)
FetchContent_Populate(GSL)
Expand All @@ -165,7 +163,7 @@ set_property(TARGET GSL PROPERTY INTERFACE_COMPILE_FEATURES)
FetchContent_Declare(fmt-header-only
GIT_REPOSITORY "https://github.com/fmtlib/fmt"
GIT_TAG "7.1.3")
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
if(CMAKE_VERSION VERSION_LESS 3.14.0)
FetchContent_GetProperties(fmt-header-only)
if(NOT fmt-header-only_POPULATED)
FetchContent_Populate(fmt-header-only)
Expand Down Expand Up @@ -194,4 +192,4 @@ endif()
# install

# ATTENTION: uncomment to install component
# ie_cpack(template)
# ov_cpack(template)
4 changes: 2 additions & 2 deletions modules/nvidia_plugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ov_mark_target_as_cc(${TARGET_NAME})

set_property(TARGET ${OBJ_NAME} PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})

ieTargetLinkWholeArchive(${TARGET_NAME} ${OBJ_NAME})
ov_target_link_whole_archive(${TARGET_NAME} ${OBJ_NAME})

target_include_directories(${OBJ_NAME}
SYSTEM PUBLIC
Expand All @@ -53,7 +53,7 @@ target_include_directories(${OBJ_NAME}
PUBLIC
"${CUTENSOR_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${IE_MAIN_CUDA_PLUGIN_SOURCE_DIR}/include"
"${OpenVINONVIDIAGpuPlugin_SOURCE_DIR}/include"
PRIVATE $<TARGET_PROPERTY:openvino::conditional_compilation,INTERFACE_INCLUDE_DIRECTORIES>
)

Expand Down
9 changes: 3 additions & 6 deletions modules/nvidia_plugin/tests/functional/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
#

# [cmake:functional_tests]
set(TARGET_NAME ov_nvidia_func_tests)

if (ENABLE_INTEL_CPU)
# TODO: remove dependency on CPU plugin after migration to tests for API 2.0
if(CMAKE_SOURCE_DIR STREQUAL OpenVINO_SOURCE_DIR AND ENABLE_INTEL_CPU)
set(OPENVINO_ADDITIONAL_DEPENDENCIES openvino_intel_cpu_plugin)
else(ENABLE_INTEL_CPU)
set(OPENVINO_ADDITIONAL_DEPENDENCIES)
endif (ENABLE_INTEL_CPU)
endif()

ov_add_test_target(
NAME
Expand All @@ -34,4 +32,3 @@ ov_add_test_target(
if(ENABLE_PROXY)
target_compile_definitions(${TARGET_NAME} PUBLIC PROXY_PLUGIN_ENABLED)
endif()
# [cmake:functional_tests]

0 comments on commit 15a840f

Please sign in to comment.