Commit bd25cc97 authored by Alexey Suhov's avatar Alexey Suhov Committed by Alexander Zhogov

CMAKE: moved GNA var setting to proper place; removed find_package when build…

CMAKE: moved GNA var setting to proper place; removed find_package when build python in sources; fixed output path for python in case of Developer package (#269)

Added multi device plugn config
parent ea9193e8
...@@ -13,10 +13,6 @@ find_package(OpenCV COMPONENTS imgcodecs) ...@@ -13,10 +13,6 @@ find_package(OpenCV COMPONENTS imgcodecs)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(gflags REQUIRED PATHS "@InferenceEngine_BINARY_DIR@/samples/thirdparty/gflags") find_package(gflags REQUIRED PATHS "@InferenceEngine_BINARY_DIR@/samples/thirdparty/gflags")
if(ENABLE_GNA)
set(GNA "@GNA@")
endif()
# Targets # Targets
include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake") include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake")
...@@ -48,6 +44,10 @@ foreach(option IN LISTS ie_options) ...@@ -48,6 +44,10 @@ foreach(option IN LISTS ie_options)
endforeach() endforeach()
message("") message("")
if(ENABLE_GNA)
set(GNA "@GNA@")
endif()
# #
# Common cmake includes # Common cmake includes
# #
......
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Defines the CMake commands/policies # Defines the CMake commands/policies
cmake_minimum_required (VERSION 3.3) cmake_minimum_required (VERSION 3.3)
# Set the project name # Set the project name
project (ie_python_api) project (ie_python_api)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/cmake) set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH) string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH)
if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64 if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
...@@ -12,43 +15,29 @@ elseif(ARCH STREQUAL "i386") ...@@ -12,43 +15,29 @@ elseif(ARCH STREQUAL "i386")
set(ARCH ia32) set(ARCH ia32)
endif() endif()
# in case of independent python api build (out of Inference Engine root Cmake) if(DEFINED IE_MAIN_SOURCE_DIR)
if (NOT DEFINED IE_MAIN_SOURCE_DIR) set(InferenceEngine_LIBRARIES inference_engine)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used")
set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "BUILD_CONFIGURATION: ${CMAKE_BUILD_TYPE}")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${ARCH})
if(NOT(WIN32))
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
endif()
else() else()
if (UNIX OR APPLE) find_package(InferenceEngineDeveloperPackage REQUIRED)
endif()
if(UNIX)
# cython generated files requires public visibility. Force visibility required. # cython generated files requires public visibility. Force visibility required.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=default") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=default")
endif()
endif() endif()
include (UseCython) include (UseCython)
if (PYTHONINTERP_FOUND) if(PYTHONINTERP_FOUND)
set (PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
else() else()
message(FATAL_ERROR "Python Interpretator was not found!") message(FATAL_ERROR "Python Interpretator was not found!")
endif() endif()
if(WIN32) if(WIN32)
set (PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>/python_api/${PYTHON_VERSION}/openvino) set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>/python_api/${PYTHON_VERSION}/openvino)
else() else()
set (PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python_api/${PYTHON_VERSION}/openvino) set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python_api/${PYTHON_VERSION}/openvino)
endif()
if(DEFINED IE_MAIN_SOURCE_DIR)
find_package(InferenceEngine REQUIRED)
else()
find_package(InferenceEngineDeveloperPackage REQUIRED)
endif() endif()
set (PYTHON_BRIDGE_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) set (PYTHON_BRIDGE_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
......
# If the pyx file is a C++ file, we should specify that here. # Copyright (C) 2019 Intel Corporation
set (CMAKE_INCLUDE_CURRENT_DIR ON) # SPDX-License-Identifier: Apache-2.0
set (TARGET_NAME "ie_api")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/inference_engine) set(TARGET_NAME "ie_api")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/inference_engine)
file(GLOB SOURCE file(GLOB SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/*.pyx ${CMAKE_CURRENT_SOURCE_DIR}/*.pyx
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
)
set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX TRUE set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX ON)
)
## Compatibility with python 2.7 which has deprecated "register" specifier # create target
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions("-Wno-register")
endif()
cython_add_module (${TARGET_NAME} ${SOURCE}) cython_add_module(${TARGET_NAME} ${SOURCE})
set_target_properties (${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries (${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX)
target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES})
# Compatibility with python 2.7 which has deprecated "register" specifier
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${TARGET_NAME} PRIVATE "-Wno-register")
endif()
# perform copy # perform copy
ADD_CUSTOM_COMMAND (TARGET ${TARGET_NAME} add_custom_command(TARGET ${TARGET_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/inference_engine/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/inference_engine/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/requirements.txt ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../requirements.txt COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/requirements.txt ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../requirements.txt
......
# If the pyx file is a C++ file, we should specify that here. # Copyright (C) 2019 Intel Corporation
set (CMAKE_INCLUDE_CURRENT_DIR ON) # SPDX-License-Identifier: Apache-2.0
set (TARGET_NAME "statistics_collector_api")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/statistics_collector) set(TARGET_NAME "statistics_collector_api")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
file(GLOB SOURCE set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/statistics_collector)
${CMAKE_CURRENT_SOURCE_DIR}/*.pyx
)
set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX TRUE file(GLOB SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/*.pyx)
)
include_directories (
${IE_MAIN_SOURCE_DIR}/samples/common
)
## Compatibility with python 2.7 which has deprecated "register" specifier set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX ON)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions("-Wno-register") # create target
endif()
cython_add_module (${TARGET_NAME} ${SOURCE}) cython_add_module(${TARGET_NAME} ${SOURCE})
set_target_properties (${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX) set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX)
target_link_libraries (${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES})
# Compatibility with python 2.7 which has deprecated "register" specifier
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${TARGET_NAME} PRIVATE "-Wno-register")
endif()
if(TARGET IE::statistics_collector_s) if(TARGET IE::statistics_collector_s)
target_link_libraries(${TARGET_NAME} PRIVATE IE::statistics_collector_s) target_link_libraries(${TARGET_NAME} PRIVATE IE::statistics_collector_s)
...@@ -32,7 +27,7 @@ else() ...@@ -32,7 +27,7 @@ else()
endif() endif()
# perform copy # perform copy
ADD_CUSTOM_COMMAND (TARGET ${TARGET_NAME} add_custom_command(TARGET ${TARGET_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/tools/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../__init__.py COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/tools/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../__init__.py
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/tools/statistics_collector/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/tools/statistics_collector/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py
......
// Copyright (C) 2018-2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief A header that defines advanced related properties for Multi_Device plugin.
* These properties should be used in SetConfig() and LoadNetwork() methods
*
* @file multi_device_config.hpp
*/
#pragma once
#include <string>
#include "ie_plugin_config.hpp"
namespace InferenceEngine {
namespace MultiDeviceConfigParams {
/**
* @def MULTI_CONFIG_KEY(name)
* @brief A macro which provides a MULTI-mangled name for configuration key with name `name`
*/
#define MULTI_CONFIG_KEY(name) InferenceEngine::MultiDeviceConfigParams::_CONFIG_KEY(MULTI_##name)
#define DECLARE_MULTI_CONFIG_KEY(name) DECLARE_CONFIG_KEY(MULTI_##name)
#define DECLARE_MULTI_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(MULTI_##name)
/**
* @brief Device Priorities config option, with comma-separated devices listed in the desired priority
*/
DECLARE_MULTI_CONFIG_KEY(DEVICE_PRIORITIES);
} // namespace MultiDeviceConfigParams
} // namespace InferenceEngine
...@@ -27,31 +27,28 @@ file (GLOB PUBLIC_HEADERS_LIB ...@@ -27,31 +27,28 @@ file (GLOB PUBLIC_HEADERS_LIB
source_group("src" FILES ${SRC_LIB}) source_group("src" FILES ${SRC_LIB})
source_group("include" FILES ${PUBLIC_HEADERS_LIB}) source_group("include" FILES ${PUBLIC_HEADERS_LIB})
include_directories (
${IE_MAIN_SOURCE_DIR}/samples
${IE_MAIN_SOURCE_DIR}/samples/common
${IE_MAIN_SOURCE_DIR}/thirdparty
${IE_MAIN_SOURCE_DIR}/include
${IE_MAIN_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/samples/thirdparty/gflags/include
)
# Create library file from sources. # Create library file from sources.
add_library(${TARGET_NAME_LIB} STATIC ${SRC_LIB} ${PUBLIC_HEADERS_LIB}) add_library(${TARGET_NAME_LIB} STATIC ${SRC_LIB} ${PUBLIC_HEADERS_LIB})
add_executable(${TARGET_NAME} main.cpp) add_executable(${TARGET_NAME} main.cpp)
target_include_directories (${TARGET_NAME_LIB} PUBLIC
${IE_MAIN_SOURCE_DIR}/samples/common
${IE_MAIN_SOURCE_DIR}/src
)
add_dependencies(${TARGET_NAME} gflags) add_dependencies(${TARGET_NAME} gflags)
set_target_properties(${TARGET_NAME} PROPERTIES if(WIN32)
POSITION_INDEPENDENT_CODE ON set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME})
COMPILE_PDB_NAME ${TARGET_NAME}) endif()
target_include_directories(${TARGET_NAME_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${TARGET_NAME_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${TARGET_NAME_LIB} PUBLIC inference_engine ${OpenCV_LIBRARIES}) target_link_libraries(${TARGET_NAME_LIB} PUBLIC inference_engine ${OpenCV_LIBRARIES})
target_link_libraries(${TARGET_NAME} ${TARGET_NAME_LIB} gflags) target_link_libraries(${TARGET_NAME} PRIVATE ${TARGET_NAME_LIB} gflags)
if(UNIX) if(UNIX)
target_link_libraries(${TARGET_NAME} ${LIB_DL} pthread) find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads)
endif() endif()
set_ie_threading_interface_for(${TARGET_NAME_LIB}) set_ie_threading_interface_for(${TARGET_NAME_LIB})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment