From 944c88a3edbe05b4743f9f38834a66b68c632734 Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Fri, 14 Feb 2025 16:29:48 +0400 Subject: [PATCH] Fixes for static build Signed-off-by: Vladimir Paramuzov --- .../intel_gpu/src/graph/CMakeLists.txt | 23 +++++++++++++++++++ .../src/graph/impls/cm/CMakeLists.txt | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/plugins/intel_gpu/src/graph/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/CMakeLists.txt index 890c87b74929a7..71c828db6e6a82 100644 --- a/src/plugins/intel_gpu/src/graph/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/graph/CMakeLists.txt @@ -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 ) @@ -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 $) + list(APPEND TARGET_DEFINITIONS $) + endforeach() foreach(lib IN LISTS TARGET_LINK_LIBRARIES) list(APPEND TARGET_INCLUDES $) @@ -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 $) + add_dependencies(openvino_intel_gpu_${IMPL_TYPE}_obj onednn_gpu_tgt) + endif() endfunction() foreach(IMPL_TYPE IN LISTS AVAILABLE_IMPL_TYPES) @@ -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 @@ -85,6 +107,7 @@ ov_add_target( LINK_LIBRARIES PUBLIC ${COMMON_LINK_LIBRARIES} + ${EXTRA_LINK_LIBRARIES} openvino::reference # for loop primitive subroutines ADD_CPPLINT ) diff --git a/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt index bf21bfc237a2c5..a0cdbb8781675d 100644 --- a/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #