CMAKE: moved GNA var setting to proper place; removed find_package when build python...
[platform/upstream/dldt.git] / inference-engine / cmake / check_features_ie.cmake
1 # Copyright (C) 2018-2019 Intel Corporation
2 # SPDX-License-Identifier: Apache-2.0
3 #
4
5 #64 bits platform
6 if (CMAKE_SIZEOF_VOID_P EQUAL 8)
7     message(STATUS "Detected 64 bit architecture")
8     SET(ARCH_64 ON)
9 else()
10     message(STATUS "Detected 32 bit architecture")
11     SET(ARCH_64 OFF)
12 endif()
13
14 # 32 bits
15 if(NOT ARCH_64)
16     if(UNIX)
17         set(ENABLE_CLDNN OFF)
18     endif()
19     set(ENABLE_MKL_DNN OFF)
20     set(ENABLE_ICV_TESTS OFF)
21 endif()
22
23 # Apple specific
24 if (APPLE)
25     set(ENABLE_GNA OFF)
26     set(ENABLE_ROCKHOPER OFF)
27     set(ENABLE_CLDNN OFF)
28 endif()
29
30 # ARM specific
31 if (ARM OR AARCH64)
32     # disable all base plugins but Myriad
33     set(ENABLE_GNA OFF)
34     set(ENABLE_CLDNN OFF)
35     set(ENABLE_MKL_DNN OFF)
36     set(ENABLE_HDDL OFF)
37 endif()
38
39 #minGW specific - under wine no support for downloading file and applying them using git
40 if (WIN32)
41     if (MINGW)
42         SET(ENABLE_CLDNN OFF) # dont have mingw dll for linking
43         set(ENABLE_SAMPLES OFF)
44     endif()
45 endif()
46
47 # disable SSE
48 if(NOT(X86_64 OR X86))
49     set(ENABLE_SSE42 OFF)
50 endif()
51
52 if (NOT ENABLE_MKL_DNN)
53     set(ENABLE_MKL OFF)
54 endif()
55
56 if (NOT ENABLE_VPU)
57     set(ENABLE_MYRIAD OFF)
58 endif()
59
60 if(CMAKE_CROSSCOMPILING)
61     set(ENABLE_PROFILING_ITT OFF)
62     set(ENABLE_ROCKHOPER OFF)
63 endif()
64
65 #next section set defines to be accesible in c++/c code for certain feature
66 if (ENABLE_PROFILING_RAW)
67     add_definitions(-DENABLE_PROFILING_RAW=1)
68 endif()
69
70 if (ENABLE_CLDNN)
71     add_definitions(-DENABLE_CLDNN=1)
72 endif()
73
74 if (ENABLE_MYRIAD)
75     add_definitions(-DENABLE_MYRIAD=1)
76 endif()
77
78 if (ENABLE_MYRIAD_NO_BOOT AND ENABLE_MYRIAD )
79     add_definitions(-DENABLE_MYRIAD_NO_BOOT=1)
80 endif()
81
82 if (ENABLE_MKL_DNN)
83     add_definitions(-DENABLE_MKL_DNN=1)
84 endif()
85
86 if (ENABLE_GNA)
87     add_definitions(-DENABLE_GNA)
88
89     set (DEFAULT_GNA_LIB GNA1_1401)
90
91     # "GNA library version: GNA1|GNA1_1401|GNA2" - default is 1401
92     if (NOT GNA_LIBRARY_VERSION STREQUAL "GNA1"
93             AND NOT GNA_LIBRARY_VERSION STREQUAL "GNA1_1401"
94             AND NOT GNA_LIBRARY_VERSION STREQUAL "GNA2")
95         set (GNA_LIBRARY_VERSION ${DEFAULT_GNA_LIB})
96         message(STATUS "GNA_LIBRARY_VERSION not set. Can be GNA1, GNA1_1401 or GNA2. Default is ${GNA_LIBRARY_VERSION}")
97     endif()
98
99     if (GNA_LIBRARY_VERSION STREQUAL "GNA2")
100         message(WARNING "GNA2 is not currently supported. Fallback to ${DEFAULT_GNA_LIB}")
101         set(GNA_LIBRARY_VERSION ${DEFAULT_GNA_LIB})
102     endif()
103
104     if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
105         message(WARNING "${GNA_LIBRARY_VERSION} no supported on GCC version ${CMAKE_CXX_COMPILER_VERSION}. Fallback to GNA1")
106         set(GNA_LIBRARY_VERSION GNA1)
107     endif()
108
109     set(GNA_LIBRARY_VERSION "${GNA_LIBRARY_VERSION}" CACHE STRING "GNAVersion" FORCE)
110     list (APPEND IE_OPTIONS GNA_LIBRARY_VERSION)
111 endif()
112
113 if (ENABLE_SAMPLES)
114     set (ENABLE_SAMPLES_CORE ON)
115 endif()
116
117 if (DEVELOPMENT_PLUGIN_MODE)
118     message (STATUS "Enabled development plugin mode")
119
120     set (ENABLE_MKL_DNN OFF)
121     set (ENABLE_TESTS OFF)
122
123     message (STATUS "Initialising submodules")
124     execute_process (COMMAND git submodule update --init ${IE_MAIN_SOURCE_DIR}/thirdparty/pugixml
125                      RESULT_VARIABLE git_res)
126
127     if (NOT ${git_res})
128         message (STATUS "Initialising submodules - done")
129     endif()
130 endif()
131
132 if (LINUX AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3)
133     set(ENABLE_UNICODE_PATH_SUPPORT OFF)
134 endif()
135
136 if (ENABLE_UNICODE_PATH_SUPPORT)
137     add_definitions(-DENABLE_UNICODE_PATH_SUPPORT=1)
138 endif()
139
140 print_enabled_features()