Files
openvino/cmake/developer_package/plugins/register_plugin_cmake.cmake
Ilya Lavrenov 9465073f58 Introduce IEDevScripts package (#3661)
* Refactored developer package

* Added fuzzing for CMAKE_MODULE_LINKER_FLAGS as well

* Added options for developer package

* More improvements

* Further improvements

* Removed global CMAKE_MODULE_PATH population

* Fixes

* Final fixes

* Fixed python build

* Fix for TBB

* Fixed Find TBB

* Fixed install

* Fixes for OV features

* Split developer targets per component

* Fixed IE build tree config

* Fixed ITT

* Fixed review comments

* Clean export dependencies

* Fixed export of pugixml

* Added IEDevScripts_DIR for Android

* Fixed Android #2

* Fixed Android #3

* Fixed python cc

* Disabled Core threading tests on GNA
2020-12-22 18:44:59 +03:00

66 lines
1.7 KiB
CMake

# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(file_content
"<ie>
<plugins>
</plugins>
</ie>")
if(NOT EXISTS "${IE_CONFIG_OUTPUT_FILE}")
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${file_content}")
endif()
# get list of plugin files
file(GLOB plugin_files "${IE_CONFIGS_DIR}/*.xml")
function(check_plugin_exists plugin_name outvar)
set(${outvar} OFF PARENT_SCOPE)
# check if config file already has this plugin
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content REGEX "plugin .*=\"")
foreach(line IN LISTS content)
string(REGEX MATCH "location=\"([^\"]*)\"" location "${line}")
get_filename_component(location "${CMAKE_MATCH_1}" NAME_WE)
if("${CMAKE_SHARED_LIBRARY_PREFIX}${plugin_name}" MATCHES "${location}")
# plugin has already registered
set(${outvar} ON PARENT_SCOPE)
endif()
endforeach()
endfunction()
set(plugin_files_to_add)
foreach(plugin_file IN LISTS plugin_files)
get_filename_component(plugin_name "${plugin_file}" NAME_WE)
check_plugin_exists("${plugin_name}" exists)
if(NOT exists)
list(APPEND plugin_files_to_add "${plugin_file}")
endif()
endforeach()
# add plugin
set(newContent "")
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content)
foreach(line IN LISTS content)
if("${line}" MATCHES "</plugins>")
foreach(plugin_file IN LISTS plugin_files_to_add)
file(READ "${plugin_file}" content)
set(newContent "${newContent}
${content}")
endforeach()
endif()
if(newContent)
set(newContent "${newContent}\n${line}")
else()
set(newContent "${line}")
endif()
endforeach()
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${newContent}")