Cross-compilation of debian packages (#12919)
* Debian arm cross-compilation * Pugixml::shared as system library * Removed debug print of openvino.pc * Set debian package arch for cross-compilation manually
This commit is contained in:
parent
ab1da94f1d
commit
10f2cf40eb
@ -7,6 +7,7 @@ set(CMAKE_SYSTEM_PROCESSOR armv7l)
|
|||||||
|
|
||||||
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
||||||
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
|
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
|
||||||
|
set(CMAKE_STRIP arm-linux-gnueabihf-strip)
|
||||||
set(PKG_CONFIG_EXECUTABLE arm-linux-gnueabihf-pkg-config CACHE PATH "Path to ARM pkg-config")
|
set(PKG_CONFIG_EXECUTABLE arm-linux-gnueabihf-pkg-config CACHE PATH "Path to ARM pkg-config")
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
@ -7,6 +7,7 @@ set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
|||||||
|
|
||||||
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
||||||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
||||||
|
set(CMAKE_STRIP aarch64-linux-gnu-strip)
|
||||||
set(PKG_CONFIG_EXECUTABLE aarch64-linux-gnu-pkg-config CACHE PATH "Path to ARM64 pkg-config")
|
set(PKG_CONFIG_EXECUTABLE aarch64-linux-gnu-pkg-config CACHE PATH "Path to ARM64 pkg-config")
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
@ -169,7 +169,7 @@ ov_set_if_not_defined(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FO
|
|||||||
ov_set_if_not_defined(CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
ov_set_if_not_defined(CMAKE_PDB_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||||
ov_set_if_not_defined(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
ov_set_if_not_defined(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER})
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CPACK_GENERATOR STREQUAL "DEB")
|
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||||
# to make sure that lib/<multiarch-tuple> is created on Debian
|
# to make sure that lib/<multiarch-tuple> is created on Debian
|
||||||
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Cmake install prefix" FORCE)
|
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Cmake install prefix" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -108,6 +108,18 @@ macro(ov_debian_specific_settings)
|
|||||||
# set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
|
# set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
|
||||||
# enable this if someday we change the version scheme
|
# enable this if someday we change the version scheme
|
||||||
# set(CPACK_DEBIAN_PACKAGE_EPOCH "2")
|
# set(CPACK_DEBIAN_PACKAGE_EPOCH "2")
|
||||||
|
|
||||||
|
# temporary WA for debian package architecture for cross-compilation
|
||||||
|
# proper solution: to force cmake auto-detect this
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
if(AARCH64)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
|
||||||
|
elseif(ARM)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf)
|
||||||
|
elseif(x86)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
ov_debian_specific_settings()
|
ov_debian_specific_settings()
|
||||||
|
@ -50,6 +50,7 @@ if [ -f /etc/lsb-release ]; then
|
|||||||
shellcheck \
|
shellcheck \
|
||||||
patchelf \
|
patchelf \
|
||||||
lintian \
|
lintian \
|
||||||
|
file \
|
||||||
gzip \
|
gzip \
|
||||||
`# openvino` \
|
`# openvino` \
|
||||||
libtbb-dev \
|
libtbb-dev \
|
||||||
|
@ -239,7 +239,7 @@ if(LINUX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# detect <multiarch-triplet>
|
# detect <multiarch-triplet>
|
||||||
if(CPACK_GENERATOR STREQUAL "DEB" AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||||
# TODO: find a better way to detect <multiarch-triplet>
|
# TODO: find a better way to detect <multiarch-triplet>
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# note: clang provides different output like 'x86_64-pc-linux-gnu', so it's not used
|
# note: clang provides different output like 'x86_64-pc-linux-gnu', so it's not used
|
||||||
@ -272,7 +272,6 @@ if(LINUX)
|
|||||||
|
|
||||||
add_custom_command(TARGET openvino PRE_BUILD
|
add_custom_command(TARGET openvino PRE_BUILD
|
||||||
COMMAND "${PKG_CONFIG_EXECUTABLE}" --validate "${pkgconfig_out}"
|
COMMAND "${PKG_CONFIG_EXECUTABLE}" --validate "${pkgconfig_out}"
|
||||||
COMMAND cat "${pkgconfig_out}"
|
|
||||||
COMMENT "[pkg-config] validating openvino.pc"
|
COMMENT "[pkg-config] validating openvino.pc"
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
endif()
|
endif()
|
||||||
|
@ -24,8 +24,6 @@ endif()
|
|||||||
|
|
||||||
# Create object library
|
# Create object library
|
||||||
|
|
||||||
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
|
|
||||||
|
|
||||||
add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
|
add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL
|
||||||
${LIBRARY_SRC}
|
${LIBRARY_SRC}
|
||||||
${PUBLIC_HEADERS})
|
${PUBLIC_HEADERS})
|
||||||
@ -49,7 +47,6 @@ add_cpplint_target(${TARGET_NAME}_obj_cpplint FOR_TARGETS ${TARGET_NAME}_obj)
|
|||||||
# Create static library
|
# Create static library
|
||||||
|
|
||||||
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL
|
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
|
|
||||||
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
|
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime
|
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime
|
||||||
|
11
thirdparty/CMakeLists.txt
vendored
11
thirdparty/CMakeLists.txt
vendored
@ -50,7 +50,10 @@ if(ENABLE_SYSTEM_PUGIXML)
|
|||||||
# try system pugixml first
|
# try system pugixml first
|
||||||
find_package(PugiXML QUIET)
|
find_package(PugiXML QUIET)
|
||||||
if(PugiXML_FOUND)
|
if(PugiXML_FOUND)
|
||||||
if(TARGET pugixml::static)
|
if(TARGET pugixml::shared)
|
||||||
|
# example: cross-compilation on debian
|
||||||
|
set(pugixml_target pugixml::shared)
|
||||||
|
elseif(TARGET pugixml::static)
|
||||||
# sometimes pugixml::static target already exists, just need to make it global
|
# sometimes pugixml::static target already exists, just need to make it global
|
||||||
# example: building using conda environment
|
# example: building using conda environment
|
||||||
set(pugixml_target pugixml::static)
|
set(pugixml_target pugixml::static)
|
||||||
@ -243,7 +246,11 @@ else()
|
|||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/json/nlohmann_json
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/json/nlohmann_json
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
||||||
REGEX .*json/nlohmann_json/test/.* EXCLUDE)
|
REGEX .*json/nlohmann_json/.github/.* EXCLUDE
|
||||||
|
REGEX .*json/nlohmann_json/benchmarks/.* EXCLUDE
|
||||||
|
REGEX .*json/nlohmann_json/doc/.* EXCLUDE
|
||||||
|
REGEX .*json/nlohmann_json/test/.* EXCLUDE
|
||||||
|
REGEX .*json/nlohmann_json/cpplint/.* EXCLUDE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cnpy
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cnpy
|
||||||
|
Loading…
Reference in New Issue
Block a user