代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.2)
include(common/cmakes/bolt.cmake)
project(cheetah C CXX)
set_policy()
set(BOLT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOLT_ROOT}/common/cmakes")
if (USE_CAFFE OR USE_ONNX OR USE_FLOW)
find_package(Protobuf)
endif()
if (USE_TFLITE)
find_package(TFLite)
endif (USE_TFLITE)
if (USE_TENSORFLOW)
find_package(jsoncpp)
endif (USE_TENSORFLOW)
if (USE_GPU)
find_package(Gcl)
endif(USE_GPU)
if (NOT "$ENV{JNI_ROOT}" STREQUAL "")
find_package(JNI)
if (JNI_FOUND)
set(USE_JNI ON)
endif(JNI_FOUND)
endif ()
if (USE_SECURE_C)
find_package(SecureC)
endif ()
if (BUILD_TEST)
find_package(jpeg)
if (EXISTS ${OpenCV_CMAKE_PATH})
include(${OpenCV_CMAKE_PATH})
endif()
endif (BUILD_TEST)
add_subdirectory(common)
if (USE_CAFFE OR USE_ONNX OR USE_TFLITE OR USE_TENSORFLOW OR USE_MINDSPORE)
add_subdirectory(model_tools)
endif()
add_subdirectory(compute)
add_subdirectory(inference)
set_c_cxx_flags()
set_test_c_cxx_flags()
message(STATUS "CFLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CXXFLAGS: ${CMAKE_CXX_FLAGS}")
add_custom_target(bolt_library ALL
COMMAND bash ./scripts/build_light_bolt.sh ${CMAKE_SYSTEM_NAME} ${CMAKE_CXX_COMPILER} ${CMAKE_AR} ${CMAKE_STRIP} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_OUTPUT_EXTENSION} ${CMAKE_SHARED_LIBRARY_PREFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${BOLT_ROOT})
if (USE_TRAINING)
set(TRAINING_BUILD_C_API ON)
set(TRAINING_BUILD_DEMO ON)
add_subdirectory(training)
add_dependencies(Raul blas_enhance uni)
add_dependencies(Raul blas_enhance_static uni_static)
endif (USE_TRAINING)
add_dependencies(bolt_library engine model_spec tensor image blas_enhance uni)
add_dependencies(bolt_library engine_static model_spec_static tensor_static image_static blas_enhance_static uni_static)
# install section
install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}bolt${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}bolt${CMAKE_STATIC_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}BoltModel${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION lib)
# generate *.lib library for Microsoft VS
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
install(FILES ${CMAKE_BINARY_DIR}/BoltModel.lib ${CMAKE_BINARY_DIR}/bolt.lib
DESTINATION lib)
endif ()
#find_program (DOXYGEN_PROGRAM doxygen)
#if (DOXYGEN_PROGRAM)
# execute_process(COMMAND doxygen .Doxyfile WORKING_DIRECTORY ${BOLT_ROOT})
#else ()
# message(WARNING "Can not find doxygen tools to generate code documents in docs/API/html/index.html!\
# If you dont't want to use these documents, you can skip this warning message.")
#endif ()
enable_testing()
find_program (BASH_PROGRAM bash)
if (BASH_PROGRAM AND USE_GENERAL)
file(GLOB CPUINFO_CMAKE_FILE $ENV{BOLT_ROOT}/common/cmakes/cpuinfo.cmake ${BOLT_ROOT}/common/cmakes/cpuinfo.cmake)
include(${CPUINFO_CMAKE_FILE})
set(parameters --host_dir=${CMAKE_INSTALL_PREFIX})
if (ANDROID)
set(parameters ${parameters} -d android --device_dir=/data/local/tmp/uldra)
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_SYSTEM_PROCESSOR}" AND "${CMAKE_HOST_SYSTEM}" MATCHES "${CMAKE_SYSTEM_NAME}*")
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "armv7")
set(parameters ${parameters} -d host)
elseif (USE_X86)
set(x86_test ${cpuinfo_avx2})
if (USE_INT8)
set(x86_test ${cpuinfo_avx512})
endif ()
if (USE_AVX512_VNNI)
set(x86_test ${cpuinfo_avx512_vnni})
endif()
if (x86_test)
set(parameters ${parameters} -d host)
else ()
set(parameters ${parameters} -d unknown)
endif ()
else ()
set(parameters ${parameters} -d unknown)
endif()
else()
set(parameters ${parameters} -d unknown)
endif()
if (USE_GPU)
set(parameters ${parameters} -g)
endif(USE_GPU)
if (USE_DYNAMIC_LIBRARY)
set(parameters ${parameters} --shared)
endif(USE_DYNAMIC_LIBRARY)
add_test (NAME quick_benchmark COMMAND bash ${BOLT_ROOT}/scripts/quick_benchmark.sh ${parameters})
endif (BASH_PROGRAM AND USE_GENERAL)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。