Openvino extra module adding - refactored (#2754)

* Rename plugin to module

* Added openvino_contrib handling

* Moved NEON flags to common place

* Fixed -Werror=catch-value= gcc-9 error
This commit is contained in:
Ilya Lavrenov authored and GitHub committed 2020-10-23 08:54:48 +03:00
1 parent 82ea01b7ff
commit 258c51bd1f
5 files changed
+70 -45

No files matched your search

+22
View File
@@ -126,6 +126,28 @@ function(ie_avx512_optimization_flags flags)
endif()
endfunction()
function(ie_arm_neon_optimization_flags flags)
if(WIN32 OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
elseif(ANDROID)
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(${flags} "-mfpu=neon" PARENT_SCOPE)
elseif(ANDROID_ABI STREQUAL "armeabi-v7a-hard with NEON")
set(${flags} "-march=armv7-a -mfloat-abi=hard -mhard-float -D_NDK_MATH_NO_SOFTFP=1 -mfpu=neon" PARENT_SCOPE)
elseif((ANDROID_ABI STREQUAL "armeabi-v7a with NEON") OR
(ANDROID_ABI STREQUAL "armeabi-v7a" AND
DEFINED CMAKE_ANDROID_ARM_NEON AND CMAKE_ANDROID_ARM_NEON))
set(${flags} "-march=armv7-a -mfloat-abi=softfp -mfpu=neon" PARENT_SCOPE)
endif()
else()
if(AARCH64)
set(${flags} "-O2 -ftree-vectorize" PARENT_SCOPE)
elseif(ARM)
set(${flags} "-mfpu=neon" PARENT_SCOPE)
endif()
endif()
endfunction()
#
# Enables Link Time Optimization compilation
#
+45 -23
View File
@@ -10,8 +10,7 @@ include(features_ie)
# include developer package
include(developer_package_ie)
# These options are shared with 3rdparty plugins
# by means of developer package
# These options are shared with 3rdparty plugins by means of developer package
include(check_features_ie)
# resolving dependencies for the project
@@ -209,34 +208,57 @@ if(ENABLE_COVERAGE)
endif()
#
# Add plugins
# Add extra modules
#
function(register_extra_plugins)
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/build-plugins")
set(iedevconfig_file "${InferenceEngineDeveloperPackage_DIR}/InferenceEngineDeveloperPackageConfig.cmake")
file(REMOVE "${iedevconfig_file}")
function(register_extra_modules)
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/build-modules")
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")
function(generate_fake_dev_package)
set(iedevconfig_file "${InferenceEngineDeveloperPackage_DIR}/InferenceEngineDeveloperPackageConfig.cmake")
file(REMOVE "${iedevconfig_file}")
foreach(target IN LISTS OpenVINODeveloperPackageTargets IEDeveloperPackageTargets)
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")
foreach(target IN LISTS OpenVINODeveloperPackageTargets IEDeveloperPackageTargets)
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
endif()
endforeach()
endfunction()
generate_fake_dev_package()
# automatically import plugins from the 'plugins' folder
file(GLOB local_extra_modules "plugins/*")
if(NGRAPH_INTERPRETER_ENABLE)
list(APPEND local_extra_modules "${OpenVINO_MAIN_SOURCE_DIR}/docs/template_plugin")
endif()
# detect where IE_EXTRA_MODULES contains folders with CMakeLists.txt
# other folders are supposed to have sub-folders with CMakeLists.txt
foreach(module_path IN LISTS IE_EXTRA_MODULES)
if(EXISTS "${module_path}/CMakeLists.txt")
list(APPEND extra_modules "${module_path}")
elseif(module_path)
file(GLOB extra_modules ${extra_modules} "${module_path}/*")
endif()
endforeach()
# automatically import plugins from the 'plugins' folder
file(GLOB local_extra_plugins "plugins/*")
if(NGRAPH_INTERPRETER_ENABLE)
list(APPEND local_extra_plugins "${OpenVINO_MAIN_SOURCE_DIR}/docs/template_plugin")
endif()
foreach(plugin_path IN LISTS IE_EXTRA_PLUGINS local_extra_plugins)
get_filename_component(plugin_dir "${plugin_path}" NAME)
message(STATUS "Register ${plugin_dir} to be built in build-plugins/${plugin_dir}")
add_subdirectory("${plugin_path}" "build-plugins/${plugin_dir}")
# add each extra module
foreach(module_path IN LISTS extra_modules local_extra_modules)
if(module_path)
get_filename_component(module_name "${module_path}" NAME)
if(NOT DEFINED BUILD_${module_name})
set(BUILD_${module_name} ON CACHE BOOL "Build ${module_name} extra module" FORCE)
endif()
if(BUILD_${module_name})
message(STATUS "Register ${module_name} to be built in build-modules/${module_name}")
add_subdirectory("${module_path}" "build-modules/${module_name}")
endif()
endif()
endforeach()
endfunction()
register_extra_plugins()
register_extra_modules()
+1 -1
View File
@@ -106,7 +106,7 @@ ie_dependent_option(ENABLE_CPPLINT_REPORT "Build cpplint report instead of faili
ie_option(ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON)
set(IE_EXTRA_PLUGINS "" CACHE STRING "Extra paths for plugins to include into DLDT build tree")
set(IE_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to include into OpenVINO build")
ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the Inference Engine binaries" ON "THREADING MATCHES TBB;LINUX" OFF)
@@ -702,7 +702,7 @@ int main(int argc, char *argv[]) {
outputs.push_back(outBlobName.substr(0, pos_layer));
try {
ports.push_back(std::stoi(outBlobName.substr(pos_layer + 1)));
} catch (std::exception) {
} catch (const std::exception &) {
throw std::logic_error("Ports should have integer type");
}
}
@@ -85,26 +85,7 @@ if(ENABLE_AVX512F AND NOT GNU_5_DEBUG_CASE)
endif()
if(ARM OR AARCH64)
set(neon_flags "")
if(WIN32 OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
elseif(ANDROID)
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(neon_flags "-mfpu=neon")
elseif(ANDROID_ABI STREQUAL "armeabi-v7a-hard with NEON")
set(neon_flags "-march=armv7-a -mfloat-abi=hard -mhard-float -D_NDK_MATH_NO_SOFTFP=1 -mfpu=neon")
elseif((ANDROID_ABI STREQUAL "armeabi-v7a with NEON") OR
(ANDROID_ABI STREQUAL "armeabi-v7a" AND
DEFINED CMAKE_ANDROID_ARM_NEON AND CMAKE_ANDROID_ARM_NEON))
set(neon_flags "-march=armv7-a -mfloat-abi=softfp -mfpu=neon")
endif()
else()
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(neon_flags "-O2 -ftree-vectorize")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a")
set(neon_flags "-mfpu=neon")
endif()
endif()
ie_arm_neon_optimization_flags(neon_flags)
if(neon_flags)
file(GLOB NEON_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/arm_neon/*.hpp)