Skip to content

Commit

Permalink
Fixes for static build
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Paramuzov <[email protected]>
  • Loading branch information
vladimir-paramuzov committed Feb 14, 2025
1 parent 721d571 commit ce86299
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions src/plugins/intel_gpu/src/graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ set(COMMON_LINK_LIBRARIES openvino::shape_inference # for tensor accessor
openvino::runtime
)

define_property(GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL)
set_property(GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL "")

function(ov_gpu_add_backend_target)
set(options
)
Expand All @@ -45,6 +48,12 @@ function(ov_gpu_add_backend_target)

set(TARGET_INCLUDES ${COMMON_INCLUDE_DIRS} ${ARG_INCLUDES})
set(TARGET_LINK_LIBRARIES ${COMMON_LINK_LIBRARIES} ${ARG_LINK_LIBRARIES})
set(TARGET_DEFINITIONS "")

foreach(lib IN LISTS TARGET_LINK_LIBRARIES)
list(APPEND TARGET_INCLUDES $<TARGET_PROPERTY:${lib},INTERFACE_INCLUDE_DIRECTORIES>)
list(APPEND TARGET_DEFINITIONS $<TARGET_PROPERTY:${lib},INTERFACE_COMPILE_DEFINITIONS>)
endforeach()

foreach(lib IN LISTS TARGET_LINK_LIBRARIES)
list(APPEND TARGET_INCLUDES $<TARGET_PROPERTY:${lib},INTERFACE_INCLUDE_DIRECTORIES>)
Expand All @@ -60,8 +69,19 @@ function(ov_gpu_add_backend_target)
${ARG_UNPARSED_ARGUMENTS}
)

get_property(CURRENT_LIBS GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL)
list(APPEND CURRENT_LIBS ${ARG_LINK_LIBRARIES})
set_property(GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL ${CURRENT_LIBS})

target_compile_options(${TARGET_NAME} PRIVATE ${COMMON_COMPILE_OPTIONS})
target_compile_definitions(${TARGET_NAME} PRIVATE ${TARGET_DEFINITIONS})
ov_set_threading_interface_for(${TARGET_NAME})

# We use onednn headers all over the graph module, so we have to append includes to all backends and add a dependency between targets
if (ENABLE_ONEDNN_FOR_GPU)
target_include_directories(${ARG_NAME} PRIVATE $<TARGET_PROPERTY:onednn_gpu_tgt,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>)
add_dependencies(openvino_intel_gpu_${IMPL_TYPE}_obj onednn_gpu_tgt)
endif()
endfunction()

foreach(IMPL_TYPE IN LISTS AVAILABLE_IMPL_TYPES)
Expand All @@ -71,6 +91,8 @@ foreach(IMPL_TYPE IN LISTS AVAILABLE_IMPL_TYPES)
endif()
endforeach()

get_property(EXTRA_LINK_LIBRARIES GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL)

ov_add_target(
NAME ${TARGET_NAME}
TYPE STATIC
Expand All @@ -80,11 +102,12 @@ ov_add_target(
OBJECT_FILES
${OBJ_FILES}
INCLUDES
PUBLIC
PRIVATE
${COMMON_INCLUDE_DIRS}
LINK_LIBRARIES
PUBLIC
PRIVATE
${COMMON_LINK_LIBRARIES}
${EXTRA_LINK_LIBRARIES}
openvino::reference # for loop primitive subroutines
ADD_CPPLINT
)
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2024-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

Expand Down

0 comments on commit ce86299

Please sign in to comment.