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)
find_package(Threads REQUIRED)
find_package(gflags REQUIRED PATHS "@InferenceEngine_BINARY_DIR@/samples/thirdparty/gflags")
if(ENABLE_GNA)
set(GNA "@GNA@")
endif()
# Targets
include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake")
......@@ -48,6 +44,10 @@ foreach(option IN LISTS ie_options)
endforeach()
message("")
if(ENABLE_GNA)
set(GNA "@GNA@")
endif()
#
# Common cmake includes
#
......
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Defines the CMake commands/policies
cmake_minimum_required (VERSION 3.3)
# Set the project name
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)
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")
set(ARCH ia32)
endif()
# in case of independent python api build (out of Inference Engine root Cmake)
if (NOT DEFINED IE_MAIN_SOURCE_DIR)
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()
if(DEFINED IE_MAIN_SOURCE_DIR)
set(InferenceEngine_LIBRARIES inference_engine)
else()
if (UNIX OR APPLE)
# cython generated files requires public visibility. Force visibility required.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=default")
endif()
find_package(InferenceEngineDeveloperPackage REQUIRED)
endif()
if(UNIX)
# cython generated files requires public visibility. Force visibility required.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=default")
endif()
include (UseCython)
if (PYTHONINTERP_FOUND)
set (PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
if(PYTHONINTERP_FOUND)
set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
else()
message(FATAL_ERROR "Python Interpretator was not found!")
endif()
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()
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)
set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python_api/${PYTHON_VERSION}/openvino)
endif()
set (PYTHON_BRIDGE_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
......
# If the pyx file is a C++ file, we should specify that here.
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (TARGET_NAME "ie_api")
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/inference_engine)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(TARGET_NAME "ie_api")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/inference_engine)
file(GLOB SOURCE
${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
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions("-Wno-register")
endif()
# create target
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_link_libraries (${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES})
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
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
ADD_CUSTOM_COMMAND (TARGET ${TARGET_NAME}
add_custom_command(TARGET ${TARGET_NAME}
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}/requirements.txt ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../../requirements.txt
......
# If the pyx file is a C++ file, we should specify that here.
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (TARGET_NAME "statistics_collector_api")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/statistics_collector)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
file(GLOB SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/*.pyx
)
set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX TRUE
)
include_directories (
${IE_MAIN_SOURCE_DIR}/samples/common
)
## Compatibility with python 2.7 which has deprecated "register" specifier
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions("-Wno-register")
endif()
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
set(TARGET_NAME "statistics_collector_api")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/statistics_collector)
file(GLOB SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/*.pyx)
cython_add_module (${TARGET_NAME} ${SOURCE})
set_source_files_properties(${SOURCE} PROPERTIES CYTHON_IS_CXX ON)
set_target_properties (${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX)
target_link_libraries (${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES})
# create target
cython_add_module(${TARGET_NAME} ${SOURCE})
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 LINKER_LANGUAGE CXX)
# 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)
target_link_libraries(${TARGET_NAME} PRIVATE IE::statistics_collector_s)
......@@ -32,7 +27,7 @@ else()
endif()
# perform copy
ADD_CUSTOM_COMMAND (TARGET ${TARGET_NAME}
add_custom_command(TARGET ${TARGET_NAME}
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/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
source_group("src" FILES ${SRC_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.
add_library(${TARGET_NAME_LIB} STATIC ${SRC_LIB} ${PUBLIC_HEADERS_LIB})
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)
set_target_properties(${TARGET_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ON
COMPILE_PDB_NAME ${TARGET_NAME})
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME})
endif()
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} ${TARGET_NAME_LIB} gflags)
target_link_libraries(${TARGET_NAME} PRIVATE ${TARGET_NAME_LIB} gflags)
if(UNIX)
target_link_libraries(${TARGET_NAME} ${LIB_DL} pthread)
find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads)
endif()
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