Files
openvino/cmake/features.cmake
Ilya Lavrenov 5cc7314f75 Ngraph static lib (#3193)
* Fix: ITT_INCLUDE_DIR was not correctly detected

* Added NGRAPH_STATIC_LIBRARY CMake flag to optionnaly compile ngraph and link it as a static library instead of a dynamic one
- Definition of NGRAPH_STATIC_LIBRARY macro in callee and caller code to avoid dllexport/dllimport decoration
- Adding missing definitions of the explicit instantiation of FactoryRegistry<>::get
- Removed message about a non existent variable: NGRAPH_IE_STATIC_LIB_ENABLE
- Removed install export directive for ngraph in case of static library

* * Code style fix

* Added NGRAPH_STATIC_LIBRARY CMake flag to optionnaly compile ngraph and link it as a static library instead of a dynamic one
- Definition of NGRAPH_STATIC_LIBRARY macro in callee and caller code to avoid dllexport/dllimport decoration
- Adding missing definitions of the explicit instantiation of FactoryRegistry<>::get
- Removed message about a non existent variable: NGRAPH_IE_STATIC_LIB_ENABLE
- Removed install export directive for ngraph in case of static library

* - Removed redundant symbol definition
- Indented properly some comments

* - Making sure onnx is always compiled as a static library no matter what is the value of BUILD_SHARED_LIBS

* - Making sure onnx is always compiled as a static library no matter what is the value of BUILD_SHARED_LIBS

* Fixed incorrect suppression of directive

* Using BUILD_SHARED_LIBS (defaulted to ON) instead of a custom CMake option NGRAPH_STATIC_LIBRARY

* Removed useless comma

* Forcing pugixml to be static event when BUILD_SHARED_LIBS=ON globally.

* Forcing gtest for ie tests to be compiled as a static library.

* Made protobuf and gtest from ngraph always static.
Factorized all the force static logic for ngraph's externals in ngraph's CMakeLists.txt instead of external_*.cmake

* gflags is always static

* Solving cross compilation from Debian 9

* using the same pattern for other ngraph externals

Co-authored-by: emmanuelattia-philips <66060489+emmanuelattia-philips@users.noreply.github.com>
Co-authored-by: Emmanuel Attia <emmanuel.attia@philips.com>
2020-11-18 18:09:41 +03:00

57 lines
2.4 KiB
CMake

# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include (target_flags)
include (options)
# these options are aimed to optimize build time on development system
if(X86_64)
set(ENABLE_MKL_DNN_DEFAULT ON)
else()
set(ENABLE_MKL_DNN_DEFAULT OFF)
endif()
ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF)
ie_option (ENABLE_MKL_DNN "MKL-DNN plugin for inference engine" ${ENABLE_MKL_DNN_DEFAULT})
ie_dependent_option (ENABLE_CLDNN "clDnn based plugin for inference engine" ON "X86_64;NOT APPLE;NOT MINGW;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF)
# FIXME: there are compiler failures with LTO and Cross-Compile toolchains. Disabling for now, but
# this must be addressed in a proper way
ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF "LINUX;NOT CMAKE_CROSSCOMPILING; CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF)
ie_option (OS_FOLDER "create OS dedicated folder in output" OFF)
# FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow
ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF)
ie_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF)
ie_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF)
ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF)
ie_dependent_option (COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPILER_ID STREQUAL GNU" OFF)
# Define CPU capabilities
ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X86" OFF)
ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF)
ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF)
ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF)
# Documentation build
ie_option (ENABLE_DOCS "build docs using Doxygen" OFF)
ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF)
# Type of build, we add this as an explicit option to default it to ON
# FIXME: Ah this moment setting this to OFF will only build ngraph a static library
ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON)