Browse Source

2024.5.16 测试整体构建

master
Administrator 1 year ago
parent
commit
14e19682e2
15 changed files with 1 additions and 437 deletions
  1. +1
    -0
      .gitignore
  2. +0
    -10
      tmp_cmake/helloworld/boost.cmake
  3. +0
    -30
      tmp_cmake/helloworld/bpu.cmake
  4. +0
    -6
      tmp_cmake/helloworld/gflags.cmake
  5. +0
    -6
      tmp_cmake/helloworld/glog.cmake
  6. +0
    -9
      tmp_cmake/helloworld/grpc.cmake
  7. +0
    -8
      tmp_cmake/helloworld/gtest.cmake
  8. +0
    -40
      tmp_cmake/helloworld/ipex.cmake
  9. +0
    -80
      tmp_cmake/helloworld/libtorch.cmake
  10. +0
    -40
      tmp_cmake/helloworld/onnx.cmake
  11. +0
    -47
      tmp_cmake/helloworld/openfst.cmake
  12. +0
    -84
      tmp_cmake/helloworld/openvino.cmake
  13. +0
    -5
      tmp_cmake/helloworld/pybind11.cmake
  14. +0
    -35
      tmp_cmake/helloworld/wetextprocessing.cmake
  15. +0
    -37
      tmp_cmake/helloworld/xpu.cmake

+ 1
- 0
.gitignore

@ -0,0 +1 @@
/tmp_cmake/

+ 0
- 10
tmp_cmake/helloworld/boost.cmake

@ -1,10 +0,0 @@
FetchContent_Declare(boost
URL https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
)
FetchContent_MakeAvailable(boost)
include_directories(${boost_SOURCE_DIR})
if(MSVC)
add_definitions(-DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB)
endif()

+ 0
- 30
tmp_cmake/helloworld/bpu.cmake

@ -1,30 +0,0 @@
if(BPU)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(EASY_DNN_URL "https://github.com/xingchensong/toolchain_pkg/releases/download/easy_dnn/easy_dnn.0.4.11.tar.gz")
set(URL_HASH "SHA256=a1a6f77d1baae7181d75ec5d37a2ee529ac4e1c4400babd6ceb1c007392a4904")
else()
message(FATAL_ERROR "Unsupported CMake System Processor '${CMAKE_SYSTEM_PROCESSOR}' (expected 'aarch64')")
endif()
else()
message(FATAL_ERROR "Unsupported CMake System Name '${CMAKE_SYSTEM_NAME}' (expected 'Linux')")
endif()
FetchContent_Declare(easy_dnn
URL ${EASY_DNN_URL}
URL_HASH ${URL_HASH}
)
FetchContent_MakeAvailable(easy_dnn)
include_directories(${easy_dnn_SOURCE_DIR}/easy_dnn/0.4.11_linux_aarch64-j3_hobot_gcc6.5.0/files/easy_dnn/include)
include_directories(${easy_dnn_SOURCE_DIR}/dnn/1.7.0_linux_aarch64-j3_hobot_gcc6.5.0/files/dnn/include)
include_directories(${easy_dnn_SOURCE_DIR}/hlog/0.4.7_linux_aarch64-j3_hobot_gcc6.5.0/files/hlog/include)
link_directories(${easy_dnn_SOURCE_DIR}/easy_dnn/0.4.11_linux_aarch64-j3_hobot_gcc6.5.0/files/easy_dnn/lib)
link_directories(${easy_dnn_SOURCE_DIR}/dnn/1.7.0_linux_aarch64-j3_hobot_gcc6.5.0/files/dnn/lib)
link_directories(${easy_dnn_SOURCE_DIR}/hlog/0.4.7_linux_aarch64-j3_hobot_gcc6.5.0/files/hlog/lib)
add_definitions(-DUSE_BPU)
# NOTE(xcsong): Reasons for adding flag `-fuse-ld=gold`:
# https://stackoverflow.com/questions/59915966/unknown-gcc-linker-error-but-builds-sucessfully/59916438#59916438
# https://github.com/tensorflow/tensorflow/issues/47849
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif()

+ 0
- 6
tmp_cmake/helloworld/gflags.cmake

@ -1,6 +0,0 @@
FetchContent_Declare(gflags
URL https://github.com/gflags/gflags/archive/v2.2.2.zip
URL_HASH SHA256=19713a36c9f32b33df59d1c79b4958434cb005b5b47dc5400a7a4b078111d9b5
)
FetchContent_MakeAvailable(gflags)
include_directories(${gflags_BINARY_DIR}/include)

+ 0
- 6
tmp_cmake/helloworld/glog.cmake

@ -1,6 +0,0 @@
FetchContent_Declare(glog
URL https://github.com/google/glog/archive/v0.4.0.zip
URL_HASH SHA256=9e1b54eb2782f53cd8af107ecf08d2ab64b8d0dc2b7f5594472f3bd63ca85cdc
)
FetchContent_MakeAvailable(glog)
include_directories(${glog_SOURCE_DIR}/src ${glog_BINARY_DIR})

+ 0
- 9
tmp_cmake/helloworld/grpc.cmake

@ -1,9 +0,0 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/grpc)
# third_party: grpc
# On how to build grpc, you may refer to https://github.com/grpc/grpc
# We recommend manually recursive clone the repo to avoid internet connection problem
FetchContent_Declare(gRPC
GIT_REPOSITORY https://github.com/grpc/grpc
GIT_TAG v1.37.1
)
FetchContent_MakeAvailable(gRPC)

+ 0
- 8
tmp_cmake/helloworld/gtest.cmake

@ -1,8 +0,0 @@
FetchContent_Declare(googletest
URL https://github.com/google/googletest/archive/release-1.11.0.zip
URL_HASH SHA256=353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a
)
if(MSVC)
set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)
endif()
FetchContent_MakeAvailable(googletest)

+ 0
- 40
tmp_cmake/helloworld/ipex.cmake

@ -1,40 +0,0 @@
add_definitions(-DUSE_TORCH)
add_definitions(-DUSE_IPEX)
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(FATAL_ERROR "Intel Extension For PyTorch supports only Linux for now")
endif()
if(CXX11_ABI)
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip")
set(URL_HASH "SHA256=137a842d1cf1e9196b419390133a1623ef92f8f84dc7a072f95ada684f394afd")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.0.1%2Bcpu.zip")
set(URL_HASH "SHA256=90d50350fd24ce5cf9dfbf47888d0cfd9f943eb677f481b86fe1b8e90f7fda5d")
endif()
FetchContent_Declare(libtorch
URL ${LIBTORCH_URL}
URL_HASH ${URL_HASH}
)
FetchContent_MakeAvailable(libtorch)
find_package(Torch REQUIRED PATHS ${libtorch_SOURCE_DIR} NO_DEFAULT_PATH)
if(CXX11_ABI)
set(LIBIPEX_URL "https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/libipex/cpu/libintel-ext-pt-cxx11-abi-2.0.100%2Bcpu.run")
set(URL_HASH "SHA256=f172d9ebc2ca0c39cc93bb395721194f79767e1bc3f82b13e1edc07d1530a600")
set(LIBIPEX_SCRIPT_NAME "libintel-ext-pt-cxx11-abi-2.0.100%2Bcpu.run")
else()
set(LIBIPEX_URL "https://intel-optimized-pytorch.s3.cn-north-1.amazonaws.com.cn/libipex/cpu/libintel-ext-pt-2.0.100%2Bcpu.run")
set(URL_HASH "SHA256=8392f965dd9b8f6c0712acbb805c7e560e4965a0ade279b47a5f5a8363888268")
set(LIBIPEX_SCRIPT_NAME "libintel-ext-pt-2.0.100%2Bcpu.run")
endif()
FetchContent_Declare(intel_ext_pt
URL ${LIBIPEX_URL}
URL_HASH ${URL_HASH}
DOWNLOAD_DIR ${FETCHCONTENT_BASE_DIR}
DOWNLOAD_NO_EXTRACT TRUE
PATCH_COMMAND bash ${FETCHCONTENT_BASE_DIR}/${LIBIPEX_SCRIPT_NAME} install ${libtorch_SOURCE_DIR}
)
FetchContent_MakeAvailable(intel_ext_pt)
find_package(IPEX REQUIRED PATHS ${libtorch_SOURCE_DIR} NO_DEFAULT_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS} -DC10_USE_GLOG")

+ 0
- 80
tmp_cmake/helloworld/libtorch.cmake

@ -1,80 +0,0 @@
if(TORCH)
set(TORCH_VERSION "2.1.0")
add_definitions(-DUSE_TORCH)
if(NOT ANDROID)
if(GPU)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(FATAL_ERROR "GPU is supported only Linux, you can use CPU version")
else()
add_definitions(-DUSE_GPU)
endif()
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-${TORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=77815aa799f15e91b6fbb0216ac78cc0479adb5cd0ca662072241484cf23f667")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-${TORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=5f887c02d9abf805c8b53fef89bf5a4dab9dd78771754344e73c98d9c484aa9d")
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(CXX11_ABI)
if(NOT GPU)
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${TORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=04f699d5181048b0062ef52de1df44b46859b8fbeeee12abdbcb9aac63e2a14b")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-${TORCH_VERSION}%2Bcu118.zip")
set(URL_HASH "SHA256=7796249faa9828a53b72d3f616fc97a1d9e87e6a35ac72b392ca1ddc7b125188")
endif()
else()
if(NOT GPU)
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-${TORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=0e86d364d05b83c6c66c3bb32e7eee932847843e4085487eefd9b3bbde4e2c58")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-${TORCH_VERSION}%2Bcu118.zip")
set(URL_HASH "SHA256=f70cfae25b02ff419e1d51ad137a746941773d2c4b0155a44b4b6b50702d661a")
endif()
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-macos-${TORCH_VERSION}.zip")
set(URL_HASH "SHA256=ce744d2d27a96df8f34d4227e8b1179dad5a76612dc7230b61db65affce6e7bd")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
add_definitions(-DIOS)
else()
message(FATAL_ERROR "Unsupported System '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux', 'Darwin' or 'iOS')")
endif()
# iOS use LibTorch from pod install
if(NOT IOS)
FetchContent_Declare(libtorch
URL ${LIBTORCH_URL}
URL_HASH ${URL_HASH}
)
FetchContent_MakeAvailable(libtorch)
find_package(Torch REQUIRED PATHS ${libtorch_SOURCE_DIR} NO_DEFAULT_PATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS} -DC10_USE_GLOG")
endif()
if(MSVC)
file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
file(COPY ${TORCH_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif()
else()
# Change version in runtime/android/app/build.gradle.
file(GLOB PYTORCH_INCLUDE_DIRS "${build_DIR}/pytorch_android*.aar/headers")
file(GLOB PYTORCH_LINK_DIRS "${build_DIR}/pytorch_android*.aar/jni/${ANDROID_ABI}")
find_library(PYTORCH_LIBRARY pytorch_jni
PATHS ${PYTORCH_LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH
)
find_library(FBJNI_LIBRARY fbjni
PATHS ${PYTORCH_LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH
)
include_directories(
${PYTORCH_INCLUDE_DIRS}
${PYTORCH_INCLUDE_DIRS}/torch/csrc/api/include
)
endif()
endif()

+ 0
- 40
tmp_cmake/helloworld/onnx.cmake

@ -1,40 +0,0 @@
if(ONNX)
set(ONNX_VERSION "1.12.0")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-win-x64-${ONNX_VERSION}.zip")
set(URL_HASH "SHA256=8b5d61204989350b7904ac277f5fbccd3e6736ddbb6ec001e412723d71c9c176")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-aarch64-${ONNX_VERSION}.tgz")
set(URL_HASH "SHA256=5820d9f343df73c63b6b2b174a1ff62575032e171c9564bcf92060f46827d0ac")
else()
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-x64-${ONNX_VERSION}.tgz")
set(URL_HASH "SHA256=5d503ce8540358b59be26c675e42081be14a3e833a5301926f555451046929c5")
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-osx-arm64-${ONNX_VERSION}.tgz")
set(URL_HASH "SHA256=23117b6f5d7324d4a7c51184e5f808dd952aec411a6b99a1b6fd1011de06e300")
else()
set(ONNX_URL "https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-osx-x86_64-${ONNX_VERSION}.tgz")
set(URL_HASH "SHA256=09b17f712f8c6f19bb63da35d508815b443cbb473e16c6192abfaa297c02f600")
endif()
else()
message(FATAL_ERROR "Unsupported CMake System Name '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux' or 'Darwin')")
endif()
FetchContent_Declare(onnxruntime
URL ${ONNX_URL}
URL_HASH ${URL_HASH}
)
FetchContent_MakeAvailable(onnxruntime)
include_directories(${onnxruntime_SOURCE_DIR}/include)
link_directories(${onnxruntime_SOURCE_DIR}/lib)
if(MSVC)
file(GLOB ONNX_DLLS "${onnxruntime_SOURCE_DIR}/lib/*.dll")
file(COPY ${ONNX_DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE})
endif()
add_definitions(-DUSE_ONNX)
endif()

+ 0
- 47
tmp_cmake/helloworld/openfst.cmake

@ -1,47 +0,0 @@
if(NOT ANDROID)
include(gflags)
# We can't build glog with gflags, unless gflags is pre-installed.
# If build glog with pre-installed gflags, there will be conflict.
set(WITH_GFLAGS OFF CACHE BOOL "whether build glog with gflags" FORCE)
include(glog)
if(NOT GRAPH_TOOLS)
set(HAVE_BIN OFF CACHE BOOL "Build the fst binaries" FORCE)
set(HAVE_SCRIPT OFF CACHE BOOL "Build the fstscript" FORCE)
endif()
set(HAVE_COMPACT OFF CACHE BOOL "Build compact" FORCE)
set(HAVE_CONST OFF CACHE BOOL "Build const" FORCE)
set(HAVE_GRM OFF CACHE BOOL "Build grm" FORCE)
set(HAVE_FAR OFF CACHE BOOL "Build far" FORCE)
set(HAVE_PDT OFF CACHE BOOL "Build pdt" FORCE)
set(HAVE_MPDT OFF CACHE BOOL "Build mpdt" FORCE)
set(HAVE_LINEAR OFF CACHE BOOL "Build linear" FORCE)
set(HAVE_LOOKAHEAD OFF CACHE BOOL "Build lookahead" FORCE)
set(HAVE_NGRAM OFF CACHE BOOL "Build ngram" FORCE)
set(HAVE_SPECIAL OFF CACHE BOOL "Build special" FORCE)
if(MSVC)
add_compile_options(/W0 /wd4244 /wd4267)
endif()
# "OpenFST port for Windows" builds openfst with cmake for multiple platforms.
# Openfst is compiled with glog/gflags to avoid log and flag conflicts with log and flags in wenet/libtorch.
# To build openfst with gflags and glog, we comment out some vars of {flags, log}.h and flags.cc.
set(openfst_SOURCE_DIR ${fc_base}/openfst-src CACHE PATH "OpenFST source directory")
FetchContent_Declare(openfst
URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.7.2.1.tar.gz
URL_HASH SHA256=e04e1dabcecf3a687ace699ccb43a8a27da385777a56e69da6e103344cc66bca
#URL https://github.com/kkm000/openfst/archive/refs/tags/win/1.6.5.1.tar.gz
#URL_HASH SHA256=02c49b559c3976a536876063369efc0e41ab374be1035918036474343877046e
PATCH_COMMAND
)
FetchContent_MakeAvailable(openfst)
add_dependencies(fst gflags glog)
target_link_libraries(fst PUBLIC gflags_nothreads_static glog)
include_directories(${openfst_SOURCE_DIR}/src/include)
else()
set(openfst_BINARY_DIR ${build_DIR}/wenet-openfst-android-1.0.2.aar/jni)
include_directories(${openfst_BINARY_DIR}/include)
link_directories(${openfst_BINARY_DIR}/${ANDROID_ABI})
link_libraries(log gflags_nothreads glog fst)
endif()

+ 0
- 84
tmp_cmake/helloworld/openvino.cmake

@ -1,84 +0,0 @@
function(get_linux_lsb_release_information)
find_program(LSB_RELEASE_EXEC lsb_release)
if(NOT LSB_RELEASE_EXEC)
message(FATAL_ERROR "Could not detect lsb_release executable, can not gather required information")
endif()
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --id OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --release OUTPUT_VARIABLE LSB_RELEASE_VERSION_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --codename OUTPUT_VARIABLE LSB_RELEASE_CODENAME_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LSB_RELEASE_ID_SHORT "${LSB_RELEASE_ID_SHORT}" PARENT_SCOPE)
set(LSB_RELEASE_VERSION_SHORT "${LSB_RELEASE_VERSION_SHORT}" PARENT_SCOPE)
set(LSB_RELEASE_CODENAME_SHORT "${LSB_RELEASE_CODENAME_SHORT}" PARENT_SCOPE)
endfunction()
if(OPENVINO)
include(gflags)
set(VINO_VERSION "2022.3.0")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
set (X86 TRUE)
else ()
set (X86 FALSE)
endif ()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/windows/w_openvino_toolkit_windows_${VINO_VERSION}.9052.9752fafe8eb_x86_64.zip")
set(URL_HASH "SHA256=adf42b4ffe4d8a39ffebcb476ea8b84e51eefbb5b900db70510412beed2cc722")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
get_linux_lsb_release_information()
if(LSB_RELEASE_ID_SHORT STREQUAL "Ubuntu" AND LSB_RELEASE_VERSION_SHORT VERSION_GREATER_EQUAL 20 AND LSB_RELEASE_VERSION_SHORT VERSION_LESS 22)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/linux/l_openvino_toolkit_ubuntu20_${VINO_VERSION}.9052.9752fafe8eb_x86_64.tgz")
set(URL_HASH "SHA256=e421fc1d9c7e6cce4089aaf344c7f84dcfd8f81ebf4ef2130b145aeca48c4e71")
elseif(LSB_RELEASE_ID_SHORT STREQUAL "Ubuntu" AND LSB_RELEASE_VERSION_SHORT VERSION_GREATER_EQUAL 18 AND LSB_RELEASE_VERSION_SHORT VERSION_LESS 20)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/linux/l_openvino_toolkit_ubuntu18_${VINO_VERSION}.9052.9752fafe8eb_x86_64.tgz")
set(URL_HASH "SHA256=8337579883d216336572e35066b6c8de52ea5a41f6771a3344ee41c019d27372")
elseif(LSB_RELEASE_ID_SHORT STREQUAL "CentOS" AND LSB_RELEASE_VERSION_SHORT VERSION_LESS 7.10)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/linux/l_openvino_toolkit_centos7_${VINO_VERSION}.9052.9752fafe8eb_x86_64.tgz")
set(URL_HASH "SHA256=93d6bd23d5e8306384bdc8f3746fe56baad1a0f87b97d0b384b4c0b158227d76")
elseif(LSB_RELEASE_ID_SHORT STREQUAL "CentOS" AND LSB_RELEASE_VERSION_SHORT VERSION_LESS 8.10)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/linux/l_openvino_toolkit_rhel8_${VINO_VERSION}.9052.9752fafe8eb_x86_64.tgz")
set(URL_HASH "SHA256=519cbdf95d73489c771357f27dbc5829057fcc3b23fd89be06e290b41a8ff934")
elseif(LSB_RELEASE_ID_SHORT STREQUAL "Debian" AND LSB_RELEASE_VERSION_SHORT VERSION_LESS_EQUAL 9.13 AND X86)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/linux/l_openvino_toolkit_debian9_${VINO_VERSION}.9052.9752fafe8eb_arm64.tgz")
set(URL_HASH "SHA256=4099bb9a257af46fbf7d5c30414ec4e308542704eac666b4b213362208bf8b16")
else()
message(STATUS "Linux OS without exist binary, compile OpenVINO source.")
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND X86)
set(VINO_URL "https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.3/macos/m_openvino_toolkit_macos_10_15_${VINO_VERSION}.9052.9752fafe8eb_x86_64.tgz")
set(URL_HASH "SHA256=235221536ddde7937db9ba6cd3c262d6220d2e7c7a24438d046fcd3ca0c73bed")
else()
message(FATAL_ERROR "Unsupported CMake System Name '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux' or 'Darwin')")
set(VINO_URL "")
set(URL_HASH "")
endif()
if(${VINO_URL} STREQUAL "")
set(ENABLE_INTEL_GPU OFF CACHE BOOL "Build OV with GPU" FORCE)
set(ENABLE_INTEL_MYRIAD OFF CACHE BOOL "Build OV with MYRIAD" FORCE)
set(ENABLE_INTEL_GNA OFF CACHE BOOL "Build OV with GNA" FORCE)
set(ENABLE_INTEL_CPU ON CACHE BOOL "Build OV with CPU" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build OV in shared library" FORCE)
set(ENABLE_SAMPLES OFF CACHE BOOL "Build OV with Example" FORCE)
set(ENABLE_TESTS OFF CACHE BOOL "Build OV with Tests" FORCE)
set(ENABLE_COMPILE_TOOL OFF CACHE BOOL "Build OV with COMPILE_TOOL" FORCE)
set(ENABLE_PYTHON OFF CACHE BOOL "Build python" FORCE)
set(THREADING "TBB")
#set(CMAKE_BUILD_TYPE "Debug")
FetchContent_Declare(openvino
GIT_REPOSITORY https://github.com/openvinotoolkit/openvino.git
GIT_TAG 9752fafe8ebf7e30dfea7edd447ff3bf0ac1d01d) # 2022.3.0 on Dec 20, 2022
FetchContent_MakeAvailable(openvino)
else()
FetchContent_Declare(openvino
URL ${VINO_URL}
URL_HASH ${URL_HASH}
)
FetchContent_MakeAvailable(openvino)
include_directories(${openvino_SOURCE_DIR}/include)
link_directories(${openvino_SOURCE_DIR}/lib)
endif()
add_definitions(-DUSE_OPENVINO)
endif()

+ 0
- 5
tmp_cmake/helloworld/pybind11.cmake

@ -1,5 +0,0 @@
FetchContent_Declare(pybind11
URL https://github.com/pybind/pybind11/archive/refs/tags/v2.9.2.zip
URL_HASH SHA256=d1646e6f70d8a3acb2ddd85ce1ed543b5dd579c68b8fb8e9638282af20edead8
)
FetchContent_MakeAvailable(pybind11)

+ 0
- 35
tmp_cmake/helloworld/wetextprocessing.cmake

@ -1,35 +0,0 @@
if(NOT ANDROID)
FetchContent_Declare(wetextprocessing
GIT_REPOSITORY https://github.com/wenet-e2e/WeTextProcessing.git
GIT_TAG origin/master
)
FetchContent_MakeAvailable(wetextprocessing)
include_directories(${wetextprocessing_SOURCE_DIR}/runtime)
add_subdirectory(${wetextprocessing_SOURCE_DIR}/runtime/utils)
add_subdirectory(${wetextprocessing_SOURCE_DIR}/runtime/processor)
else()
include(ExternalProject)
set(ANDROID_CMAKE_ARGS
-DBUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}
-DCMAKE_CXX_FLAGS=-I${openfst_BINARY_DIR}/include
-DCMAKE_EXE_LINKER_FLAGS=-L${openfst_BINARY_DIR}/${ANDROID_ABI}
)
ExternalProject_Add(wetextprocessing
GIT_REPOSITORY https://github.com/wenet-e2e/WeTextProcessing.git
GIT_TAG origin/master
SOURCE_SUBDIR runtime
CMAKE_ARGS ${ANDROID_CMAKE_ARGS}
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(wetextprocessing SOURCE_DIR BINARY_DIR)
include_directories(${SOURCE_DIR}/runtime)
link_directories(${BINARY_DIR}/processor ${BINARY_DIR}/utils)
link_libraries(wetext_utils)
endif()

+ 0
- 37
tmp_cmake/helloworld/xpu.cmake

@ -1,37 +0,0 @@
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(ColourBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()
if(XPU)
set(RUNTIME_KUNLUN_PATH ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "RUNTIME_KUNLUN_PATH is ${RUNTIME_KUNLUN_PATH} .\n")
set(KUNLUN_XPU_PATH ${RUNTIME_KUNLUN_PATH}/xpu)
if(NOT DEFINED ENV{XPU_API_PATH})
message(FATAL_ERROR "${BoldRed}NO ENV{XPU_API_PATH} in your env. Please set XPU_API_PATH.${ColourReset}\n")
else()
set(XPU_API_PATH $ENV{XPU_API_PATH})
message("set XPU_API_PATH from env_var. Val is $ENV{XPU_API_PATH}.")
endif()
include_directories(${RUNTIME_KUNLUN_PATH} ${KUNLUN_XPU_PATH}/
${XPU_API_PATH}/output/include ${XPU_API_PATH}/../runtime/include)
link_directories(${XPU_API_PATH}/output/so/ ${XPU_API_PATH}/../runtime/output/so/)
add_definitions(-DUSE_XPU)
endif()

Loading…
Cancel
Save