forked from KhronosGroup/OpenVX-sample-impl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
242 lines (217 loc) · 8.06 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#
# Copyright (c) 2011-2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Global setup file for OpenVX CMake
#
cmake_minimum_required(VERSION 2.8.9)
file(READ "${CMAKE_SOURCE_DIR}/VERSION" OPENVX_VERSION)
string(STRIP "${OPENVX_VERSION}" OPENVX_VERSION)
set(OPENVX_VERSION ${OPENVX_VERSION} CACHE INTERNAL "" FORCE)
message(STATUS "===== OpenVX version: ${OPENVX_VERSION} =====")
# CMAKE variables
set( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake_utils/"
)
include( cmake_utils/CMakeFuncs.txt )
if (WIN32)
include( CMake_windows_tools )
elseif (ANDROID)
include( CMake_android_tools )
else ()
include( CMake_linux_tools )
endif ()
project (OpenVX)
# Supported configurations
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
)
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} CACHE STRING "Available build configurations." FORCE)
# Default options for the CMake GUI
option( OPENVX_USE_IX ON )
option( OPENVX_USE_NN ON )
option( OPENVX_USE_USER_DATA_OBJECT ON )
option( OPENVX_USE_PIPELINING OFF )
option( OPENVX_USE_STREAMING OFF )
option( OPENVX_USE_OPENCL_INTEROP OFF )
option( OPENVX_USE_S16 OFF )
option( OPENVX_USE_TILING OFF )
option( OPENVX_USE_XML OFF )
option( OPENVX_CONFORMANCE_VISION ON )
option( OPENVX_CONFORMANCE_NEURAL_NETWORKS ON )
option( OPENVX_CONFORMANCE_NNEF_IMPORT ON)
option( OPENVX_USE_ENHANCED_VISION ON )
option( EXPERIMENTAL_USE_DOT OFF )
option( EXPERIMENTAL_PLATFORM_SUPPORTS_16_FLOAT OFF )
option( EXPERIMENTAL_USE_VENUM OFF)
option( EXPERIMENTAL_USE_OPENCL OFF )
if (UNIX OR ANDROID)
add_definitions( -D_XOPEN_SOURCE=700 -D_GNU_SOURCE=1 )
# set( EXPERIMENTAL_USE_DOT ON )
endif (UNIX OR ANDROID)
# Feature sets
message( "" )
message( "** ** ** Selected Feature Sets ** ** **")
if (OPENVX_CONFORMANCE_VISION)
add_definitions( -DOPENVX_CONFORMANCE_VISION )
message( "-- 'Vision' conformance feature set")
endif (OPENVX_CONFORMANCE_VISION)
if (OPENVX_CONFORMANCE_NEURAL_NETWORKS)
add_definitions( -DOPENVX_CONFORMANCE_NEURAL_NETWORKS -DOPENVX_USE_NN )
message( "-- 'Neural Networks' conformance feature set")
endif (OPENVX_CONFORMANCE_NEURAL_NETWORKS)
if (OPENVX_CONFORMANCE_NNEF_IMPORT)
add_definitions( -DOPENVX_CONFORMANCE_NNEF_IMPORT )
message( "-- 'NNEF Import' conformance feature set")
endif (OPENVX_CONFORMANCE_NNEF_IMPORT)
if (OPENVX_USE_ENHANCED_VISION)
add_definitions( -DOPENVX_USE_ENHANCED_VISION )
message( "-- 'Enhanced Vision' feature set")
endif (OPENVX_USE_ENHANCED_VISION)
message( "" )
message( "** ** ** Selected Extensions ** ** **")
add_definitions( -DOPENVX_BUILDING )
# Official extensions
if (OPENVX_USE_IX)
add_definitions( -DOPENVX_USE_IX )
message( "-- Offical Import-Export extension")
endif (OPENVX_USE_IX)
if (OPENVX_USE_NN)
add_definitions( -DOPENVX_USE_NN -DOPENVX_CONFORMANCE_NEURAL_NETWORKS )
message( "-- Offical NeuralNet extension")
endif (OPENVX_USE_NN)
if (OPENVX_USE_PIPELINING)
add_definitions( -DOPENVX_USE_PIPELINING )
message( "-- Offical Pipelining extension")
endif (OPENVX_USE_PIPELINING)
if (OPENVX_USE_STREAMING)
add_definitions( -DOPENVX_USE_STREAMING )
message( "-- Offical Streaming extension")
endif (OPENVX_USE_STREAMING)
if (OPENVX_USE_USER_DATA_OBJECT)
add_definitions( -DOPENVX_USE_USER_DATA_OBJECT )
message( "-- Offical User Data Object extension")
endif (OPENVX_USE_USER_DATA_OBJECT)
if (OPENVX_USE_OPENCL_INTEROP)
add_definitions( -DOPENVX_USE_OPENCL_INTEROP )
message( "-- Official OpenVX OpenCL Interop")
find_package(OpenCL REQUIRED)
endif (OPENVX_USE_OPENCL_INTEROP)
# Provisional extensions
if (OPENVX_USE_TILING)
add_definitions( -DOPENVX_USE_TILING )
message( "-- Provisional tiling extension")
endif (OPENVX_USE_TILING)
if (OPENVX_USE_S16)
add_definitions( -DOPENVX_USE_S16 )
message( "-- Provisional S16 extension")
endif (OPENVX_USE_S16)
if (OPENVX_USE_XML)
add_definitions( -DOPENVX_USE_XML )
message( "-- Provisional 'xml' extension")
endif (OPENVX_USE_XML)
# Experimental extensions
if (OPENVX_USE_SMP)
add_definitions( -DOPENVX_USE_SMP )
message( "-- Experimental smp extension")
endif (OPENVX_USE_SMP)
if (EXPERIMENTAL_USE_DOT)
add_definitions( -DEXPERIMENTAL_USE_DOT )
message( "-- Experimental 'dot' extension")
endif (EXPERIMENTAL_USE_DOT)
if (EXPERIMENTAL_PLATFORM_SUPPORTS_16_FLOAT)
add_definitions( -DEXPERIMENTAL_PLATFORM_SUPPORTS_16_FLOAT )
message( "-- Experimental F16 extension")
endif (EXPERIMENTAL_PLATFORM_SUPPORTS_16_FLOAT)
if (EXPERIMENTAL_USE_VENUM)
add_definitions( -DEXPERIMENTAL_USE_VENUM )
message( "-- Experimental raspberrypi 3B+ neon extension")
endif (EXPERIMENTAL_USE_VENUM)
if (EXPERIMENTAL_USE_OPENCL)
add_definitions( -DEXPERIMENTAL_USE_OPENCL )
message( "-- Experimental opencl extension")
endif (EXPERIMENTAL_USE_OPENCL)
message( "" )
if (BUILD_X64)
add_definitions( -DARCH_64 )
else (BUILD_X64)
add_definitions( -DARCH_32 )
endif (BUILD_X64)
if ( EXPERIMENTAL_USE_OPENCL )
message( "-- OpenCL")
set( OPENCL_INCLUDE_PATH $ENV{VX_OPENCL_INCLUDE_PATH} CACHE PATH "Directory containing OpenCL headers." )
set( OPENCL_LIB_PATH $ENV{VX_OPENCL_LIB_PATH} CACHE PATH "Directory containing OpenCL libs." )
message( "-- Use OpenCL headers from: " ${OPENCL_INCLUDE_PATH} )
message( "-- Use OpenCL libs from: " ${OPENCL_LIB_PATH} )
endif ( EXPERIMENTAL_USE_OPENCL )
if (CMAKE_BUILD_TYPE EQUAL Debug)
add_definitions( -DOPENVX_DEBUGGING )
endif (CMAKE_BUILD_TYPE EQUAL Debug)
if (OPENVX_USE_XML)
find_package(LibXml2)
if (LIBXML2_FOUND)
message( "-- Found the required XML library")
message( "-- XML includes = ${LIBXML2_INCLUDE_DIR}")
message( "-- XML library = ${LIBXML2_LIBRARIES}")
message( "-- XML link directories = ${LIBXML2_LINK_DIRECTORIES}")
else (LIBXML2_FOUND)
message( FATAL_ERROR "Could not find the XML library")
endif (LIBXML2_FOUND)
endif (OPENVX_USE_XML)
FIND_NUM_PROCESSORS()
if ( ${PROCESSOR_COUNT} LESS "1" )
message(FATAL_ERROR "Num processors found is " ${PROCESSOR_COUNT})
endif ( ${PROCESSOR_COUNT} LESS "1" )
add_definitions( -DTARGET_NUM_CORES=${PROCESSOR_COUNT} )
# Check submodules have been checked out.
find_path(API_DOCS_PATH "include/VX/vx.h" HINTS "api-docs")
find_path(CTS_PATH "openvx_cts_version.inc" HINTS "cts")
find_path(NNEF_TOOLS_PATH "nnef_tools/__init__.py" HINTS "kernels/NNEF-Tools")
if(
"${API_DOCS_PATH}" STREQUAL "API_DOCS_PATH-NOTFOUND"
OR "${CTS_PATH}" STREQUAL "CTS_PATH-NOTFOUND"
OR "${NNEF_TOOLS_PATH}" STREQUAL "NNEF_TOOLS_PATH-NOTFOUND"
)
message(
FATAL_ERROR
"Repsoitory submodules, required for a correct build, could not be found or are empty. \
Have you checked out the repository's Git submodules (`git submodule update --init --recursive`)?"
)
endif()
# Framework IDE Folders Names
set_property( GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "" )
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
set( DEBUG_FOLDER Debug )
set( EXAMPLES_FOLDER Examples )
set( HELPER_FOLDER Helper )
set( KERNELS_FOLDER Kernels )
set( LIBRARIES_FOLDER Libraries )
set( LIBRARIES_DEBUG_FOLDER ${LIBRARIES_FOLDER}/Debug )
set( LIBRARIES_EXTRAS_FOLDER ${LIBRARIES_FOLDER}/Extras )
set( SAMPLE_FOLDER Sample )
set( SAMPLE_TARGETS_FOLDER ${SAMPLE_FOLDER}/Targets )
set( SAMPLE_CPP_FOLDER SampleCPP )
set( TOOLS_FOLDER Tools )
add_subdirectory( include )
add_subdirectory( debug )
add_subdirectory( examples )
add_subdirectory( helper )
add_subdirectory( kernels )
add_subdirectory( libraries )
add_subdirectory( sample )
add_subdirectory( tools )
add_subdirectory( utils )