forked from openvinotoolkit/npu_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
161 lines (118 loc) · 3.92 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#
# Copyright (C) 2022 Intel Corporation.
# SPDX-License-Identifier: Apache 2.0
#
#
# Project properties
#
set(CMAKE_POLICY_DEFAULT_CMP0115 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0116 OLD)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
# Honor <LANG>_VISIBILITY_PRESET for all target types (including static libraries).
cmake_policy(SET CMP0063 NEW)
# Set PROJECT_VERSION* variables by project command only.
cmake_policy(SET CMP0048 NEW)
project(InferenceEngineVPUXPlugin)
#
# Build properties
#
set(VPUX_DEVICE_NAME "VPUX")
string(TOLOWER "${VPUX_DEVICE_NAME}" VPUX_PLUGIN_COMPONENT)
set(VPUX_TESTS_COMPONENT "${VPUX_PLUGIN_COMPONENT}_tests")
set(IE_MAIN_VPUX_PLUGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(THIRDPARTY_SERVER_PATH "https://af01p-ir.devtools.intel.com/artifactory/vpu_openvino-ir-local/dl_score_engine/")
include(FetchContent)
find_package(InferenceEngineDeveloperPackage REQUIRED)
include(cmake/features.cmake)
include(cmake/compile_options.cmake)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake")
include(cmake/dependencies.cmake)
endif()
include(cmake/cross_compilation.cmake)
include(cmake/flatbuffers.cmake)
include(cmake/bundle_static_library.cmake)
include(cmake/embed_bin_file.cmake)
include(cmake/add_tool_target.cmake)
if(ENABLE_TESTS)
enable_testing()
endif()
print_enabled_kmb_features()
#
# Build configuration
#
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(UNIX)
ie_add_compiler_flags(-Wno-undef)
endif()
if(ENABLE_EXPORT_SYMBOLS)
replace_compile_visibility_options()
endif()
#
# Sub-directories
#
add_subdirectory(thirdparty EXCLUDE_FROM_ALL)
set(LLVM_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/llvm-project/llvm")
set(LLVM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/llvm-project/llvm")
set(MLIR_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/llvm-project/mlir")
set(MLIR_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/llvm-project/llvm/tools/mlir")
set(LLVM_INCLUDE_DIRS
"${LLVM_SOURCE_DIR}/include"
"${LLVM_BINARY_DIR}/include"
)
set(MLIR_INCLUDE_DIRS
"${MLIR_SOURCE_DIR}/include"
"${MLIR_BINARY_DIR}/include"
)
list(APPEND CMAKE_MODULE_PATH
"${LLVM_SOURCE_DIR}/cmake/modules"
)
set(VPUNN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/vpucostmodel")
set(VPUNN_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/vpucostmodel")
set(VPUNN_INCLUDE_DIRS
"${VPUNN_SOURCE_DIR}/include"
"${VPUNN_BINARY_DIR}/include"
)
include(cmake/tblgen.cmake)
if(ENABLE_DEVELOPER_BUILD)
add_compile_definitions(VPUX_DEVELOPER_BUILD)
endif()
add_subdirectory(src)
if(ENABLE_TESTS)
include(cmake/lit_tests.cmake)
add_subdirectory(tests)
add_subdirectory(tests_deprecated)
endif()
if(ENABLE_KMB_SAMPLES)
add_subdirectory(samples)
endif()
if(BUILD_SHARED_LIBS)
add_subdirectory(tools)
endif()
#
# targets install
#
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/source_package.cmake")
include(cmake/source_package.cmake)
endif()
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION "runtime/include/ie"
COMPONENT ${VPUX_PLUGIN_COMPONENT})
if(NOT BUILD_SHARED_LIBS)
if(TARGET ze_loader)
install(TARGETS ze_loader EXPORT OpenVINOTargets
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT}
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT}
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT})
endif()
if(TARGET flatbuffers)
install(TARGETS flatbuffers EXPORT OpenVINOTargets
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT}
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT}
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ${VPUX_PLUGIN_COMPONENT})
endif()
endif()
#
# CPack
#
ie_cpack(${VPUX_PLUGIN_COMPONENT})