1 # Copyright (C) 2018-2020 Intel Corporation
2 # SPDX-License-Identifier: Apache-2.0
5 cmake_policy(SET CMP0054 NEW)
7 # TODO: for make instal / package we need to use 3.13.3 version because
8 # it allows to install targets created outside of current projects
9 # See https://blog.kitware.com/cmake-3-13-0-available-for-download/
12 # due to https://cmake.org/cmake/help/v3.12/policy/CMP0068.html
13 cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
15 cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
21 set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22 set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine)
23 set(CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
28 # include developer package
29 include(developer_package NO_POLICY_SCOPE)
31 # These options are shared with 3rdparty plugins
32 # by means of developer package
33 include(check_features)
36 # resolving dependencies for the project
37 message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
38 message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
39 message (STATUS "OpenVINO_MAIN_SOURCE_DIR .............. " ${OpenVINO_MAIN_SOURCE_DIR})
40 message (STATUS "IE_MAIN_SOURCE_DIR .............. " ${IE_MAIN_SOURCE_DIR})
41 message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
42 message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
43 message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})
45 # remove file with exported developer targets to force its regeneration
46 file(REMOVE "${CMAKE_BINARY_DIR}/targets_developer.cmake")
47 file(REMOVE "${CMAKE_BINARY_DIR}/targets.cmake")
49 function(build_ngraph)
50 function(ngraph_set option value)
51 if(NOT DEFINED ${option})
52 set(${option} ${value} CACHE BOOL "" FORCE)
56 set(NGRAPH_BUILD_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "" FORCE)
57 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenVINO_MAIN_SOURCE_DIR}/ngraph/cmake/Modules/")
60 ngraph_set(NGRAPH_ADDRESS_SANITIZER TRUE)
62 ngraph_set(NGRAPH_ADDRESS_SANITIZER FALSE)
64 ngraph_set(NGRAPH_TOOLS_ENABLE FALSE)
65 ngraph_set(NGRAPH_CPU_ENABLE FALSE)
66 ngraph_set(NGRAPH_INTERPRETER_ENABLE TRUE)
67 ngraph_set(NGRAPH_NOP_ENABLE FALSE)
68 ngraph_set(NGRAPH_GPUH_ENABLE FALSE)
69 ngraph_set(NGRAPH_GENERIC_CPU_ENABLE FALSE)
70 ngraph_set(NGRAPH_ENABLE_CPU_CONV_AUTO FALSE)
71 ngraph_set(NGRAPH_PYTHON_BUILD_ENABLE FALSE)
72 ngraph_set(NGRAPH_PLAIDML_ENABLE FALSE)
73 ngraph_set(NGRAPH_FAST_MATH_ENABLE FALSE)
74 ngraph_set(NGRAPH_JSON_ENABLE FALSE)
75 ngraph_set(NGRAPH_NATIVE_ARCH_ENABLE FALSE)
78 ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE)
79 ngraph_set(NGRAPH_UNIT_TEST_OPENVINO_ENABLE TRUE)
80 ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE)
82 ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
83 ngraph_set(NGRAPH_TEST_UTIL_ENABLE FALSE)
84 ngraph_set(NGRAPH_IE_ENABLE FALSE)
85 ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE FALSE)
88 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
89 ie_add_compiler_flags(-Wno-error=uninitialized -Wno-error=literal-conversion)
91 ie_add_compiler_flags(-Wno-error=maybe-uninitialized -Wno-error=return-type -fPIC)
94 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=defaulted-function-deleted -Wno-error=unused-command-line-argument")
99 ie_add_compiler_flags(-Wno-error=return-type -Wno-undef)
101 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4308 /wd4146 /wd4703 /wd4244")
108 ie_cpack_add_component(ngraph)
110 set(SDL_cmake_included ON)
111 # set(NGRAPH_COMPONENT_PREFIX "deployment_tools/ngraph/")
112 add_subdirectory(ngraph)
117 add_subdirectory(inference-engine)
123 ie_cpack_add_component(setupvars REQUIRED)
126 install(PROGRAMS scripts/setupvars/setupvars.sh
130 install(PROGRAMS scripts/setupvars/setupvars.bat
135 # install install_dependencies
138 ie_cpack_add_component(install_dependencies REQUIRED)
139 install(DIRECTORY scripts/install_dependencies/
140 DESTINATION install_dependencies
141 COMPONENT install_dependencies)
144 # install files for demo
146 ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core)
149 install(DIRECTORY scripts/demo/
150 DESTINATION deployment_tools/demo
151 COMPONENT demo_scripts
152 USE_SOURCE_PERMISSIONS
153 PATTERN *.bat EXCLUDE)
155 install(DIRECTORY scripts/demo/
156 DESTINATION deployment_tools/demo
157 COMPONENT demo_scripts
158 USE_SOURCE_PERMISSIONS
159 PATTERN *.sh EXCLUDE)
162 ie_cpack(${IE_CPACK_COMPONENTS_ALL})