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)
20 set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
21 set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine)
22 list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake")
27 # include developer package
28 include(developer_package)
30 # These options are shared with 3rdparty plugins
31 # by means of developer package
32 include(check_features)
35 # resolving dependencies for the project
36 message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
37 message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
38 message (STATUS "OpenVINO_MAIN_SOURCE_DIR .............. " ${OpenVINO_MAIN_SOURCE_DIR})
39 message (STATUS "IE_MAIN_SOURCE_DIR .................... " ${IE_MAIN_SOURCE_DIR})
40 message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
41 message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
42 message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})
44 # remove file with exported developer targets to force its regeneration
45 file(REMOVE "${CMAKE_BINARY_DIR}/targets_developer.cmake")
46 file(REMOVE "${CMAKE_BINARY_DIR}/targets.cmake")
48 function(build_ngraph)
49 function(ngraph_set option value)
50 if(NOT DEFINED ${option})
51 set(${option} ${value} CACHE BOOL "" FORCE)
55 set(NGRAPH_BUILD_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "" FORCE)
56 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenVINO_MAIN_SOURCE_DIR}/ngraph/cmake/Modules/")
59 ngraph_set(NGRAPH_ADDRESS_SANITIZER TRUE)
61 ngraph_set(NGRAPH_ADDRESS_SANITIZER FALSE)
63 ngraph_set(NGRAPH_PYTHON_BUILD_ENABLE FALSE)
65 ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE)
66 ngraph_set(NGRAPH_IE_ENABLE TRUE)
67 ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE)
69 ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE)
70 ngraph_set(NGRAPH_TEST_UTIL_ENABLE FALSE)
71 ngraph_set(NGRAPH_IE_ENABLE FALSE)
72 ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE FALSE)
74 ngraph_set(NGRAPH_INTERPRETER_ENABLE TRUE)
76 if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
77 ie_add_compiler_flags(-Wno-error=uninitialized -Wno-error=literal-conversion)
79 ie_add_compiler_flags(-Wno-error=maybe-uninitialized -Wno-error=return-type -fPIC)
82 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=defaulted-function-deleted -Wno-error=unused-command-line-argument")
87 ie_add_compiler_flags(-Wno-error=return-type -Wno-undef)
89 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4308 /wd4146 /wd4703 /wd4244")
96 ie_cpack_add_component(ngraph)
98 set(SDL_cmake_included ON)
99 # set(NGRAPH_COMPONENT_PREFIX "deployment_tools/ngraph/")
100 add_subdirectory(ngraph)
101 set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE)
106 add_subdirectory(inference-engine)
112 ie_cpack_add_component(setupvars REQUIRED)
115 install(PROGRAMS scripts/setupvars/setupvars.sh
119 install(PROGRAMS scripts/setupvars/setupvars.bat
124 # install install_dependencies
127 ie_cpack_add_component(install_dependencies REQUIRED)
128 install(DIRECTORY scripts/install_dependencies/
129 DESTINATION install_dependencies
130 COMPONENT install_dependencies)
133 # install files for demo
135 ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core)
138 install(DIRECTORY scripts/demo/
139 DESTINATION deployment_tools/demo
140 COMPONENT demo_scripts
141 USE_SOURCE_PERMISSIONS
142 PATTERN *.bat EXCLUDE)
144 install(DIRECTORY scripts/demo/
145 DESTINATION deployment_tools/demo
146 COMPONENT demo_scripts
147 USE_SOURCE_PERMISSIONS
148 PATTERN *.sh EXCLUDE)
151 ie_cpack(${IE_CPACK_COMPONENTS_ALL})