Generate openvino.pc pkg-config file (#12779)
* Generate openvino.pc pkg-config file * Added libva-dev as a dependency * Fixed typo in install_build_dependencies.sh * samples on CI * Revert changes in samples; use pkg-config in tests * Debug print * Revert changes in fuzz tests * Fixed TBB usage * Fixed pkg-config usage for cross-compilation * Fixed pkg_config_tbb_lib_dir * Don't use PKG_CONFIG_EXECUTABLE unconditionally * Fixed copy-patse * Fixe * Generate pkg-config file for Apple as well * Fixes for ubuntu 22.04 * Disable apple
This commit is contained in:
@@ -305,25 +305,27 @@ jobs:
|
||||
condition: ne(variables['CMAKE_CPACK_GENERATOR'], 'DEB')
|
||||
displayName: 'List install files'
|
||||
|
||||
- script: rm -fr $(BUILD_DIR)
|
||||
displayName: 'Clean build dir'
|
||||
continueOnError: false
|
||||
|
||||
- script: $(SAMPLES_INSTALL_DIR)/cpp/build_samples.sh -i $(INSTALL_DIR)
|
||||
- script: $(SAMPLES_INSTALL_DIR)/cpp/build_samples.sh -i $(INSTALL_DIR) -b $(BUILD_DIR)/cpp_samples
|
||||
displayName: 'Build cpp samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: |
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
$(SAMPLES_INSTALL_DIR)/cpp/build_samples.sh -i $(INSTALL_DIR)
|
||||
$(SAMPLES_INSTALL_DIR)/cpp/build_samples.sh -b $(BUILD_DIR)/cpp_samples_clang
|
||||
displayName: 'Build cpp samples - clang'
|
||||
continueOnError: false
|
||||
|
||||
- script: $(SAMPLES_INSTALL_DIR)/c/build_samples.sh -i $(INSTALL_DIR)
|
||||
- script: |
|
||||
export VERBOSE=1
|
||||
$(SAMPLES_INSTALL_DIR)/c/build_samples.sh -i $(INSTALL_DIR) -b $(BUILD_DIR)/c_samples
|
||||
displayName: 'Build c samples'
|
||||
continueOnError: false
|
||||
|
||||
- script: rm -fr $(BUILD_DIR)
|
||||
displayName: 'Clean build dir'
|
||||
continueOnError: false
|
||||
|
||||
- script: $(RUN_PREFIX) $(INSTALL_TEST_DIR)/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-NGraphUT.xml
|
||||
displayName: 'OV Core UT'
|
||||
continueOnError: false
|
||||
|
||||
23
cmake/templates/openvino.pc.in
Normal file
23
cmake/templates/openvino.pc.in
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
pc_path=${pcfiledir}
|
||||
prefix=${pc_path}/@PKGCONFIG_OpenVINO_PREFIX@
|
||||
|
||||
exec_prefix=${prefix}/@OV_CPACK_RUNTIMEDIR@
|
||||
libdir=${exec_prefix}/@PKGCONFIG_OpenVINO_TRIPLET@
|
||||
|
||||
include_prefix=${prefix}/@OV_CPACK_INCLUDEDIR@
|
||||
includedir_old=${include_prefix}/ie
|
||||
includedir_new=${include_prefix}
|
||||
|
||||
Name: OpenVINO
|
||||
Description: OpenVINO™ Toolkit
|
||||
URL: https://docs.openvino.ai/latest/index.html
|
||||
Version: @OpenVINO_VERSION@
|
||||
Requires.private: @PKGCONFIG_OpenVINO_REQUIRES_PRIVATE@
|
||||
Conflicts: openvino < @OpenVINO_VERSION@
|
||||
Cflags: -I${includedir_old} -I${includedir_new}
|
||||
Libs: -L${libdir} @PKGCONFIG_OpenVINO_FRONTENDS@ -lopenvino_c -lopenvino @PKGCONFIG_OpenVINO_PRIVATE_DEPS@
|
||||
Libs.private: -ldl -lm -lpthread -lrt
|
||||
@@ -54,6 +54,8 @@ if [ -f /etc/lsb-release ]; then
|
||||
`# openvino` \
|
||||
libtbb-dev \
|
||||
libpugixml-dev \
|
||||
`# gpu plugin extensions` \
|
||||
libva-dev \
|
||||
`# python` \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
|
||||
@@ -32,6 +32,8 @@ if [ -e "$INSTALLDIR/runtime" ]; then
|
||||
system_type=$(ls "$INSTALLDIR/runtime/lib/")
|
||||
IE_PLUGINS_PATH=$INSTALLDIR/runtime/lib/$system_type
|
||||
|
||||
export PKG_CONFIG_PATH=$IE_PLUGINS_PATH/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
|
||||
|
||||
export HDDL_INSTALL_DIR=$INSTALLDIR/runtime/3rdparty/hddl
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
export DYLD_LIBRARY_PATH=${IE_PLUGINS_PATH}/Release:${IE_PLUGINS_PATH}/Debug${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
|
||||
|
||||
@@ -12,19 +12,16 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# i.e. yocto case
|
||||
get_target_property(_tbb_lib_location ${tbb_target} INTERFACE_LINK_LIBRARIES)
|
||||
if(_tbb_lib_location)
|
||||
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# usual imported library
|
||||
get_target_property(_tbb_lib_location ${tbb_target} IMPORTED_LOCATION_RELEASE)
|
||||
if(_tbb_lib_location)
|
||||
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
foreach(properties INTERFACE_LINK_LIBRARIES
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
IMPORTED_LOCATION_NONE
|
||||
IMPORTED_LOCATION)
|
||||
get_target_property(_tbb_lib_location ${tbb_target} ${properties})
|
||||
if(_tbb_lib_location)
|
||||
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message(FATAL_ERROR "Failed to detect TBB library location")
|
||||
endfunction()
|
||||
@@ -146,6 +143,8 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set(pkg_config_tbb_lib_dir "runtime/3rdparty/tbb/lib")
|
||||
elseif(tbb_custom)
|
||||
# for custom TBB we need to install it to our package
|
||||
# to simplify life for our customers
|
||||
@@ -190,6 +189,8 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
COMPONENT tbb)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(pkg_config_tbb_lib_dir "${IE_TBBROOT_INSTALL}/${tbb_libs_dir}")
|
||||
elseif(tbb_downloaded)
|
||||
set(IE_TBB_DIR_INSTALL "runtime/3rdparty/tbb/")
|
||||
|
||||
@@ -228,6 +229,8 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
DESTINATION "${IE_TBB_DIR_INSTALL}"
|
||||
COMPONENT tbb_dev)
|
||||
endif()
|
||||
|
||||
set(pkg_config_tbb_lib_dir "${IE_TBB_DIR_INSTALL}/lib")
|
||||
else()
|
||||
message(WARNING "TBB of unknown origin. TBB files are not installed")
|
||||
endif()
|
||||
|
||||
@@ -180,3 +180,100 @@ install(FILES "${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake"
|
||||
"${CMAKE_BINARY_DIR}/OpenVINOConfig-version.cmake"
|
||||
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
|
||||
COMPONENT ${OV_CPACK_COMP_CORE_DEV})
|
||||
|
||||
# Generate and install openvino.pc pkg-config file
|
||||
|
||||
# TODO: fix apple later
|
||||
if(LINUX)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
set(generate_pkgconfig ON)
|
||||
endif()
|
||||
|
||||
# temporary skip generator of pkg-config file for static libraries
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set(generate_pkgconfig OFF)
|
||||
endif()
|
||||
|
||||
# fill in PKGCONFIG_OpenVINO_FRONTENDS
|
||||
get_target_property(PKGCONFIG_OpenVINO_FRONTENDS_LIST ov_frontends MANUALLY_ADDED_DEPENDENCIES)
|
||||
if(ENABLE_OV_IR_FRONTEND)
|
||||
list(REMOVE_ITEM PKGCONFIG_OpenVINO_FRONTENDS_LIST openvino_ir_frontend)
|
||||
endif()
|
||||
if(ENABLE_OV_TF_FRONTEND)
|
||||
list(REMOVE_ITEM PKGCONFIG_OpenVINO_FRONTENDS_LIST openvino_tensorflow_frontend)
|
||||
endif()
|
||||
|
||||
foreach(frontend IN LISTS PKGCONFIG_OpenVINO_FRONTENDS_LIST)
|
||||
if(PKGCONFIG_OpenVINO_FRONTENDS)
|
||||
set(PKGCONFIG_OpenVINO_FRONTENDS "${PKGCONFIG_OpenVINO_FRONTENDS} -l${frontend}")
|
||||
else()
|
||||
set(PKGCONFIG_OpenVINO_FRONTENDS "-l${frontend}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# fill in PKGCONFIG_OpenVINO_REQUIRES_PRIVATE and PKGCONFIG_OpenVINO_PRIVATE_DEPS
|
||||
|
||||
if(ENABLE_SYSTEM_TBB)
|
||||
set(PKGCONFIG_OpenVINO_REQUIRES_PRIVATE "tbb")
|
||||
elseif(TBB_FOUND)
|
||||
if(NOT pkg_config_tbb_lib_dir)
|
||||
message(FATAL_ERROR "Internal error: variable 'pkg_config_tbb_lib_dir' is not defined")
|
||||
endif()
|
||||
|
||||
set(PKGCONFIG_OpenVINO_PRIVATE_DEPS "-L\${prefix}/${pkg_config_tbb_lib_dir} -ltbb")
|
||||
endif()
|
||||
|
||||
if(ENABLE_SYSTEM_PUGIXML AND PkgConfig_FOUND)
|
||||
pkg_check_modules(PKGCONFIG_pugixml QUIET
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
pugixml)
|
||||
set(pugixml_dep "pugixml = ${PKGCONFIG_pugixml_VERSION}")
|
||||
|
||||
if(PKGCONFIG_OpenVINO_REQUIRES_PRIVATE)
|
||||
set(PKGCONFIG_OpenVINO_REQUIRES_PRIVATE "${PKGCONFIG_OpenVINO_REQUIRES_PRIVATE}, ${pugixml_dep}")
|
||||
else()
|
||||
set(PKGCONFIG_OpenVINO_REQUIRES_PRIVATE "${pugixml_dep}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# detect <multiarch-triplet>
|
||||
if(CPACK_GENERATOR STREQUAL "DEB" AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
# TODO: find a better way to detect <multiarch-triplet>
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# note: clang provides different output like 'x86_64-pc-linux-gnu', so it's not used
|
||||
execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpmachine
|
||||
OUTPUT_VARIABLE PKGCONFIG_OpenVINO_TRIPLET
|
||||
ERROR_VARIABLE error_message
|
||||
RESULT_VARIABLE exit_code
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT exit_code EQUAL 0)
|
||||
message(WARNING "Internal error: failed to detect library <multiarch-triplet> ${error_message}")
|
||||
set(generate_pkgconfig OFF)
|
||||
endif()
|
||||
else()
|
||||
# cannot detect <multiarch-triplet>
|
||||
set(generate_pkgconfig OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# define relative paths
|
||||
file(RELATIVE_PATH PKGCONFIG_OpenVINO_PREFIX "/${OV_CPACK_RUNTIMEDIR}/pkgconfig" "/")
|
||||
|
||||
if(generate_pkgconfig)
|
||||
set(pkgconfig_in "${OpenVINO_SOURCE_DIR}/cmake/templates/openvino.pc.in")
|
||||
set(pkgconfig_out "${OpenVINO_BINARY_DIR}/share/openvino.pc")
|
||||
configure_file("${pkgconfig_in}" "${pkgconfig_out}" @ONLY)
|
||||
|
||||
install(FILES "${pkgconfig_out}"
|
||||
DESTINATION "${OV_CPACK_RUNTIMEDIR}/pkgconfig"
|
||||
COMPONENT ${OV_CPACK_COMP_CORE_DEV})
|
||||
|
||||
add_custom_command(TARGET openvino PRE_BUILD
|
||||
COMMAND "${PKG_CONFIG_EXECUTABLE}" --validate "${pkgconfig_out}"
|
||||
COMMAND cat "${pkgconfig_out}"
|
||||
COMMENT "[pkg-config] validating openvino.pc"
|
||||
VERBATIM)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -37,8 +37,8 @@ struct OPENVINO_API DiscreteTypeInfo {
|
||||
// exact type identification
|
||||
const DiscreteTypeInfo* parent;
|
||||
|
||||
DiscreteTypeInfo() = default;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
DiscreteTypeInfo() = default;
|
||||
DiscreteTypeInfo(const DiscreteTypeInfo&) = default;
|
||||
DiscreteTypeInfo(DiscreteTypeInfo&&) = default;
|
||||
DiscreteTypeInfo& operator=(const DiscreteTypeInfo&) = default;
|
||||
|
||||
@@ -159,7 +159,14 @@ function(ie_headers_compilation_with_custom_flags)
|
||||
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_dx.hpp"
|
||||
"openvino/runtime/intel_gpu/ocl/dx.hpp")
|
||||
endif()
|
||||
if(NOT LIBVA_FOUND)
|
||||
# try to find VA libraries
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
find_host_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_search_module(libva QUIET IMPORTED_TARGET libva)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT libva_FOUND)
|
||||
list(APPEND IE_TEST_HEADERS_TO_SKIP "gpu/gpu_context_api_va.hpp"
|
||||
"openvino/runtime/intel_gpu/ocl/va.hpp")
|
||||
endif()
|
||||
|
||||
@@ -2,4 +2,17 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Search OpenVINO Runtime installed
|
||||
find_package(PkgConfig QUIET)
|
||||
# TODO: fix apple and cross-compilation later
|
||||
if(PkgConfig_FOUND AND NOT CMAKE_CROSSCOMPILING AND NOT APPLE)
|
||||
pkg_search_module(openvino REQUIRED
|
||||
IMPORTED_TARGET
|
||||
openvino)
|
||||
set(ov_link_libraries PkgConfig::openvino)
|
||||
else()
|
||||
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
|
||||
set(ov_link_libraries openvino::runtime)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
@@ -9,7 +9,4 @@ add_library(${TARGET_NAME} STATIC ${SRC})
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Search OpenVINO Runtime installed
|
||||
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC ${ov_link_libraries})
|
||||
|
||||
@@ -21,9 +21,6 @@ set(OUTPUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
||||
|
||||
# Search OpenVINO Inference Engine installed
|
||||
find_package(OpenVINO REQUIRED)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
install(DIRECTORY test_runner/ DESTINATION tests/memory_tests/test_runner COMPONENT tests EXCLUDE_FROM_ALL)
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
add_subdirectory("${OpenVINO_SOURCE_DIR}/tests/lib" tests_shared_lib)
|
||||
|
||||
add_subdirectory(memory_tests)
|
||||
add_subdirectory(memory_tests_helper)
|
||||
|
||||
@@ -9,8 +9,6 @@ add_custom_target(memory_tests)
|
||||
# Test target name is source file name without extension.
|
||||
FILE(GLOB tests "*.cpp")
|
||||
|
||||
add_subdirectory("${OpenVINO_SOURCE_DIR}/tests/lib" tests_shared_lib)
|
||||
|
||||
foreach(test_source ${tests})
|
||||
get_filename_component(test_name ${test_source} NAME_WE)
|
||||
add_executable(${test_name} ${test_source})
|
||||
|
||||
@@ -17,9 +17,6 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithD
|
||||
# Define directory where artifacts will be placed
|
||||
set(OUTPUT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Search OpenVINO Inference Engine installed
|
||||
find_package(OpenVINO REQUIRED)
|
||||
|
||||
set(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
||||
|
||||
add_subdirectory(common)
|
||||
|
||||
@@ -17,9 +17,6 @@ project(time_tests)
|
||||
|
||||
set(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")
|
||||
|
||||
# Search OpenVINO Inference Engine installed
|
||||
find_package(OpenVINO REQUIRED)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
install(DIRECTORY test_runner/ DESTINATION tests/time_tests/test_runner COMPONENT tests EXCLUDE_FROM_ALL)
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
add_subdirectory("${OpenVINO_SOURCE_DIR}/tests/lib" tests_shared_lib)
|
||||
|
||||
add_subdirectory(timetests)
|
||||
add_subdirectory(timetests_helper)
|
||||
@@ -9,8 +9,6 @@ add_custom_target(time_tests)
|
||||
# Test target name is source file name without extension.
|
||||
FILE(GLOB tests "*.cpp")
|
||||
|
||||
add_subdirectory("${OpenVINO_SOURCE_DIR}/tests/lib" tests_shared_lib)
|
||||
|
||||
foreach(test_source ${tests})
|
||||
get_filename_component(test_name ${test_source} NAME_WE)
|
||||
add_executable(${test_name} ${test_source})
|
||||
|
||||
Reference in New Issue
Block a user