Skip to content

Commit

Permalink
Update openvino url
Browse files Browse the repository at this point in the history
  • Loading branch information
joey12300 committed Sep 22, 2022
1 parent 9671005 commit 523610d
Showing 1 changed file with 37 additions and 57 deletions.
94 changes: 37 additions & 57 deletions cmake/openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,74 +21,77 @@ set(OPENVINO_INSTALL_INC_DIR
"${OPENVINO_INSTALL_DIR}/include"
CACHE PATH "openvino install include directory." FORCE)

if (WIN32)
set(OPENVINO_SOURCE_DIR
${THIRD_PARTY_PATH}/openvino/src/${OPENVINO_PROJECT}/openvino-win-x64-2022.1.0)
set(OPENVINO_INC_DIR
"${OPENVINO_INSTALL_DIR}/include"
"${OPENVINO_INSTALL_DIR}/include/ie"
CACHE PATH "openvino include directory." FORCE)
set(OPENVINO_LIB_DIR
"${OPENVINO_INSTALL_DIR}/lib/"
CACHE PATH "openvino lib directory." FORCE)
else()
set(OPENVINO_SOURCE_DIR
${THIRD_PARTY_PATH}/openvino/src/${OPENVINO_PROJECT})
set(OPENVINO_INC_DIR
"${OPENVINO_INSTALL_DIR}/include"
CACHE PATH "openvino include directory." FORCE)
set(OPENVINO_LIB_DIR
"${OPENVINO_INSTALL_DIR}/lib/"
CACHE PATH "openvino lib directory." FORCE)
endif()


set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH}" "${OPENVINO_LIB_DIR}")

set(OPENVINO_VERSION "2022.3.0")
set(OPENVINO_VERSION "2022.2.0.dev20220829")
set(OPENVINO_URL_PREFIX "https://bj.bcebos.com/fastdeploy/third_libs/")

set(COMPRESSED_SUFFIX ".tgz")
if(WIN32)
set(OPENVINO_FILENAME "openvino-win-x64-${OPENVINO_VERSION}.zip")
set(OPENVINO_FILENAME "w_openvino_toolkit_windows_${OPENVINO_VERSION}")
set(COMPRESSED_SUFFIX ".zip")
if(NOT CMAKE_CL_64)
message(FATAL_ERROR "FastDeploy cannot ENABLE_OPENVINO_BACKEND in win32 now.")
endif()
elseif(APPLE)
message(FATAL_ERROR "FastDeploy cannot ENABLE_OPENVINO_BACKEND in Mac OSX now.")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
message("Cannot compile with openvino while in osx arm64 platform right now")
set(OPENVINO_FILENAME "openvino-osx-arm64-${OPENVINO_VERSION}.tgz")
else()
set(OPENVINO_FILENAME "openvino-osx-x86_64-${OPENVINO_VERSION}.tgz")
set(OPENVINO_FILENAME "m_openvino_toolkit_osx_${OPENVINO_VERSION}")
endif()
else()
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
message("Cannot compile with openvino while in linux-aarch64 platform")
else()
set(OPENVINO_FILENAME "openvino-linux-x64-${OPENVINO_VERSION}.tgz")
set(OPENVINO_FILENAME "l_openvino_toolkit_ubuntu18_${OPENVINO_VERSION}")
endif()
endif()
set(OPENVINO_URL "${OPENVINO_URL_PREFIX}${OPENVINO_FILENAME}")
set(OPENVINO_URL "${OPENVINO_URL_PREFIX}${OPENVINO_FILENAME}${COMPRESSED_SUFFIX}")

include_directories(${OPENVINO_INC_DIR}
)# For OPENVINO code to include internal headers.
set(OPENVINO_SOURCE_DIR
${THIRD_PARTY_PATH}/openvino/src/${OPENVINO_PROJECT}/runtime)
set(OPENVINO_INC_DIR
"${OPENVINO_INSTALL_DIR}/include"
"${OPENVINO_INSTALL_DIR}/include/ie"
CACHE PATH "openvino include directory." FORCE)
set(OPENVINO_LIB_DIR
"${OPENVINO_INSTALL_DIR}/lib/"
CACHE PATH "openvino lib directory." FORCE)

# For OPENVINO code to include internal headers.
include_directories(${OPENVINO_INC_DIR})

if(WIN32)
set(OPENVINO_LIB
"${OPENVINO_INSTALL_DIR}/lib/openvino.lib"
CACHE FILEPATH "OPENVINO static library." FORCE)
set(INSTALL_CMD "${CMAKE_COMMAND} -E remove_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E make_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/lib/intel64/Release ${OPENVINO_INSTALL_DIR}/lib &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/bin/intel64/Release ${OPENVINO_INSTALL_DIR}/bin &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/include ${OPENVINO_INSTALL_INC_DIR} &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/3rdparty ${OPENVINO_INSTALL_DIR}/3rdparty")
elseif(APPLE)
set(OPENVINO_LIB
"${OPENVINO_INSTALL_DIR}/lib/libopenvino.dylib"
CACHE FILEPATH "OPENVINO static library." FORCE)
set(INSTALL_CMD "${CMAKE_COMMAND} -E remove_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E make_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E rename ${OPENVINO_SOURCE_DIR}/lib/intel64/Release ${OPENVINO_INSTALL_DIR}/lib &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/include ${OPENVINO_INSTALL_INC_DIR}")

else()
set(OPENVINO_LIB
"${OPENVINO_INSTALL_DIR}/lib/libopenvino.so"
CACHE FILEPATH "OPENVINO static library." FORCE)
set(INSTALL_CMD "${CMAKE_COMMAND} -E remove_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E make_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E rename ${OPENVINO_SOURCE_DIR}/lib/intel64 ${OPENVINO_INSTALL_DIR}/lib &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/include ${OPENVINO_INSTALL_INC_DIR}")
endif()

if (WIN32)
ExternalProject_Add(
ExternalProject_Add(
${OPENVINO_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
URL ${OPENVINO_URL}
Expand All @@ -97,32 +100,9 @@ if (WIN32)
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E remove_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E make_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/lib/intel64/Release ${OPENVINO_INSTALL_DIR}/lib &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/bin/intel64/Release ${OPENVINO_INSTALL_DIR}/bin &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/include ${OPENVINO_INSTALL_INC_DIR} &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/3rdparty ${OPENVINO_INSTALL_DIR}/3rdparty
BUILD_BYPRODUCTS ${OPENVINO_LIB})
else()
ExternalProject_Add(
${OPENVINO_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
URL ${OPENVINO_URL}
PREFIX ${OPENVINO_PREFIX_DIR}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E remove_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E make_directory ${OPENVINO_INSTALL_DIR} &&
${CMAKE_COMMAND} -E rename ${OPENVINO_SOURCE_DIR}/lib/intel64 ${OPENVINO_INSTALL_DIR}/lib &&
${CMAKE_COMMAND} -E copy_directory ${OPENVINO_SOURCE_DIR}/include
${OPENVINO_INSTALL_INC_DIR}
INSTALL_COMMAND ${INSTALL_CMD}
BUILD_BYPRODUCTS ${OPENVINO_LIB})
endif()


if(UNIX)
add_custom_target(patchelf_openvino ALL COMMAND bash -c "sh ${PROJECT_SOURCE_DIR}/scripts/patch_lib.sh ${OPENVINO_INSTALL_DIR}/lib" DEPENDS ${LIBRARY_NAME})
Expand Down

0 comments on commit 523610d

Please sign in to comment.