forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (54 loc) · 2.35 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if (NOT ENABLE_INTEL_GPU)
return()
endif()
set (TARGET_NAME "openvino_intel_gpu_plugin")
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-strict-aliasing)
ie_add_compiler_flags(-msse4.1 -msse4.2)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# 4267 4244 conversion from 'XXX' to 'YYY', possible loss of data
ie_add_compiler_flags(/wd4244)
ie_add_compiler_flags(/wd4267)
# '<': signed/unsigned mismatch
ie_add_compiler_flags(/wd4018)
endif()
if(ENABLE_GPU_DEBUG_CAPS)
add_definitions(-DGPU_DEBUG_CONFIG=1)
endif()
set(INTEL_GPU_TARGET_OCL_VERSION "200" CACHE STRING "Target version of OpenCL which should be used by GPU plugin")
add_definitions(-DCL_TARGET_OPENCL_VERSION=${INTEL_GPU_TARGET_OCL_VERSION})
set(MAIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
add_subdirectory(thirdparty)
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Werror)
endif()
add_subdirectory(src/runtime)
add_subdirectory(src/kernel_selector)
add_subdirectory(src/graph)
file(GLOB_RECURSE PLUGIN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/intel_gpu/plugin/*.hpp)
addVersionDefines(src/plugin/plugin.cpp CI_BUILD_NUMBER)
ie_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "GPU"
SOURCES ${PLUGIN_SOURCES}
VERSION_DEFINES_FOR src/plugin/plugin.cpp)
target_compile_options(${TARGET_NAME} PRIVATE
$<$<CONFIG:Release>:$<IF:$<CXX_COMPILER_ID:MSVC>,/Os,-Os>>)
target_link_libraries(${TARGET_NAME} PRIVATE openvino_intel_gpu_graph openvino::pugixml)
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/)
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
# Workaround to avoid warnings during LTO build
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS_RELEASE "-Wno-error=maybe-uninitialized -Wno-maybe-uninitialized"
LINK_FLAGS_RELWITHDEBINFO "-Wno-error=maybe-uninitialized -Wno-maybe-uninitialized")
endif()
if(ENABLE_TESTS)
add_subdirectory(tests)
endif()
# Failed because of OpenCL
# ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})