if(CMAKE_TOOLCHAIN_FILE)
set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to")
# get absolute path, but get_filename_component ABSOLUTE only refer with source dir, so find_file here :(
get_filename_component(CMAKE_TOOLCHAIN_FILE_NAME ${CMAKE_TOOLCHAIN_FILE} NAME)
find_file(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE_NAME} PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
message(STATUS "CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
endif()
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
if(NOT DEFINED NCNN_VERSION)
string(TIMESTAMP NCNN_VERSION "%Y%m%d")
endif()
set(NCNN_VERSION_MAJOR 1)
set(NCNN_VERSION_MINOR 0)
set(NCNN_VERSION_PATCH ${NCNN_VERSION})
set(NCNN_VERSION_STRING ${NCNN_VERSION_MAJOR}.${NCNN_VERSION_MINOR}.${NCNN_VERSION_PATCH})
message(STATUS "NCNN_VERSION_STRING = ${NCNN_VERSION_STRING}")
cmake_minimum_required(VERSION 2.8.12)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE release CACHE STRING "Choose the type of build" FORCE)
endif()
if(NOT CMAKE_VERSION VERSION_LESS "3.15")
# enable CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
endif()
if(POLICY CMP0025)
# reference from https://cmake.org/cmake/help/latest/policy/CMP0025.html
cmake_policy(SET CMP0025 NEW)
endif()
project(ncnn)
if(MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.15")
option(NCNN_BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked ncnn" OFF)
if(NCNN_BUILD_WITH_STATIC_CRT)
# cmake before version 3.15 not work
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
option(NCNN_SHARED_LIB "shared library support" OFF)
option(NCNN_ENABLE_LTO "enable link-time optimization" OFF)
option(NCNN_OPENMP "openmp support" ON)
option(NCNN_STDIO "load model from external file" ON)
option(NCNN_STRING "plain and verbose string" ON)
option(NCNN_INSTALL_SDK "install ncnn library and headers" ON)
option(NCNN_SIMPLEOCV "minimal opencv structure emulation" OFF)
option(NCNN_SIMPLEOMP "minimal openmp runtime emulation" OFF)
option(NCNN_SIMPLESTL "minimal cpp stl structure emulation" OFF)
option(NCNN_SIMPLEMATH "minimal cmath" OFF)
option(NCNN_THREADS "build with threads" ON)
option(NCNN_BENCHMARK "print benchmark information for every layer" OFF)
option(NCNN_C_API "build with C api" ON)
option(NCNN_PLATFORM_API "build with platform api candy" ON)
option(NCNN_PIXEL "convert and resize from/to image pixel" ON)
option(NCNN_PIXEL_ROTATE "rotate image pixel orientation" ON)
option(NCNN_PIXEL_AFFINE "warp affine image pixel" ON)
option(NCNN_PIXEL_DRAWING "draw basic figure and text" ON)
option(NCNN_CMAKE_VERBOSE "print verbose cmake messages" OFF)
option(NCNN_VULKAN "vulkan compute support" OFF)
option(NCNN_SIMPLEVK "minimal in-house vulkan loader" ON)
option(NCNN_SYSTEM_GLSLANG "use system glslang library" OFF)
option(NCNN_RUNTIME_CPU "runtime dispatch cpu routines" ON)
option(NCNN_DISABLE_PIC "disable position-independent code" OFF)
option(NCNN_BUILD_TESTS "build tests" OFF)
option(NCNN_COVERAGE "build for coverage" OFF)
option(NCNN_ASAN "build for address sanitizer" OFF)
option(NCNN_BUILD_BENCHMARK "build benchmark" ON)
option(NCNN_PYTHON "build python api" OFF)
option(NCNN_INT8 "int8 inference" ON)
option(NCNN_BF16 "bf16 inference" ON)
option(NCNN_FORCE_INLINE "force inline some function" ON)
if(ANDROID OR IOS OR NCNN_SIMPLESTL)
option(NCNN_DISABLE_RTTI "disable rtti" ON)
option(NCNN_DISABLE_EXCEPTION "disable exception" ON)
else()
option(NCNN_DISABLE_RTTI "disable rtti" OFF)
option(NCNN_DISABLE_EXCEPTION "disable exception" OFF)
endif()
if(ANDROID OR IOS OR NCNN_SIMPLESTL OR CMAKE_CROSSCOMPILING)
option(NCNN_BUILD_TOOLS "build tools" OFF)
option(NCNN_BUILD_EXAMPLES "build examples" OFF)
else()
option(NCNN_BUILD_TOOLS "build tools" ON)
option(NCNN_BUILD_EXAMPLES "build examples" ON)
endif()
if(NCNN_SHARED_LIB)
if(NCNN_BUILD_TESTS)
message(WARNING "NCNN_SHARED_LIB must be OFF to build tests! NCNN_BUILD_TESTS will be turned off.")
set(NCNN_BUILD_TESTS OFF)
endif()
if(NCNN_ENABLE_LTO)
# enable global link time optimization
cmake_policy(SET CMP0069 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_supported_output)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(WARNING "IPO is not supported: ${ipo_supported_output}")
set(NCNN_ENABLE_LTO OFF)
endif()
endif()
endif()
if(NOT NCNN_STDIO OR NOT NCNN_STRING)
if(NCNN_BUILD_TOOLS)
message(WARNING "NCNN_STDIO or NCNN_STRING disabled, NCNN_BUILD_TOOLS will be turned off.")
set(NCNN_BUILD_TOOLS OFF)
endif()
if(NCNN_BUILD_EXAMPLES)
message(WARNING "NCNN_STDIO or NCNN_STRING disabled, NCNN_BUILD_EXAMPLES will be turned off.")
set(NCNN_BUILD_EXAMPLES OFF)
endif()
if(NCNN_BUILD_BENCHMARK)
message(WARNING "NCNN_STDIO or NCNN_STRING disabled, NCNN_BUILD_BENCHMARK will be turned off.")
set(NCNN_BUILD_BENCHMARK OFF)
endif()
if(NCNN_BUILD_TESTS)
message(WARNING "NCNN_STDIO or NCNN_STRING disabled, NCNN_BUILD_TESTS will be turned off.")
set(NCNN_BUILD_TESTS OFF)
endif()
endif()
##############################################
include(CheckCXXCompilerFlag)
check_cxx_source_compiles("int main() { int a = 0; asm volatile(\"\" : \"=r\"(a) : \"0\"(a) : \"memory\"); return 0; }" NCNN_COMPILER_SUPPORT_GNU_INLINE_ASM)
if(NCNN_COMPILER_SUPPORT_GNU_INLINE_ASM)
option(NCNN_GNU_INLINE_ASM "optimize platform with gnu style inline assembly" ON)
else()
message(WARNING "The compiler does not support gnu style inline assembly. NCNN_GNU_INLINE_ASM will be OFF.")
endif()
if((IOS AND CMAKE_OSX_ARCHITECTURES MATCHES "arm")
OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
OR (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|aarch64)")
OR (CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "(ARMV7|ARM64)")
OR ((CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) AND (${CMAKE_GENERATOR_PLATFORM} MATCHES "^(arm|arm64)")))
set(NCNN_TARGET_ARCH arm)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC"))
set(CMAKE_REQUIRED_FLAGS "/arch:VFPv4")
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { float32x4_t _a; float16x4_t _s = vcvt_f16_f32(_a); return 0; }" NCNN_COMPILER_SUPPORT_ARM_VFPV4)
unset(CMAKE_REQUIRED_FLAGS)
else()
set(CMAKE_REQUIRED_FLAGS "-mfpu=neon-vfpv4")
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { float32x4_t _a; float16x4_t _s = vcvt_f16_f32(_a); return 0; }" NCNN_COMPILER_SUPPORT_ARM_VFPV4)
if(NOT NCNN_COMPILER_SUPPORT_ARM_VFPV4)
set(CMAKE_REQUIRED_FLAGS "-mfpu=neon-vfpv4 -mfp16-format=ieee")
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { float32x4_t _a; float16x4_t _s = vcvt_f16_f32(_a); return 0; }" NCNN_COMPILER_SUPPORT_ARM_VFPV4_FP16)
endif()
unset(CMAKE_REQUIRED_FLAGS)
endif()
if(NCNN_COMPILER_SUPPORT_ARM_VFPV4 OR NCNN_COMPILER_SUPPORT_ARM_VFPV4_FP16)
option(NCNN_VFPV4 "optimize armv7 platform with vfpv4" ON)
else()
message(WARNING "The compiler does not support arm vfpv4. NCNN_VFPV4 will be OFF."
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本项目是一款基于C++的ncnn深度学习框架设计与实现源码,项目总文件量为3327个,包括1142个C++源文件、876个头文件、585个Python脚本、417个编译脚本、69个CMake配置文件、66个YAML配置文件、62个Markdown文档、38个参数配置文件、22个文本文件、9个输入文件。此外,还涉及C和Shell语言的使用。该框架旨在提供高效、灵活的深度学习解决方案,支持C++、C、Python等多种语言接口,适用于各类深度学习应用开发。
资源推荐
资源详情
资源评论
收起资源包目录
基于C++的ncnn深度学习框架设计与实现源码 (2000个子文件)
mat_pixel_rotate.cpp 230KB
onnx2ncnn.cpp 207KB
gpu.cpp 194KB
gemm_arm.cpp 172KB
gemm_riscv.cpp 152KB
command.cpp 135KB
gemm_arm_asimdhp.cpp 99KB
ir.cpp 91KB
mat_pixel.cpp 87KB
ncnnoptimize.cpp 84KB
mxnet2ncnn.cpp 81KB
net.cpp 80KB
mat_pixel_affine.cpp 78KB
cpu.cpp 76KB
allocator.cpp 73KB
requantize_loongarch.cpp 71KB
requantize_mips.cpp 70KB
fuse_multiheadattention.cpp 69KB
requantize_arm.cpp 68KB
innerproduct_arm.cpp 64KB
packing_arm.cpp 61KB
dequantize_arm.cpp 60KB
packing_riscv.cpp 60KB
innerproduct_loongarch.cpp 59KB
innerproduct_mips.cpp 58KB
mlir2ncnn.cpp 58KB
gru_arm.cpp 57KB
eltwise_arm_asimdhp.cpp 55KB
ncnn2table.cpp 55KB
convolutiondepthwise_arm.cpp 54KB
convolution_arm.cpp 54KB
dequantize_arm_asimdhp.cpp 53KB
deconvolution_arm_asimdhp.cpp 51KB
softmax_arm.cpp 50KB
eltwise_arm.cpp 47KB
caffe2ncnn.cpp 45KB
deconvolution_arm.cpp 45KB
gru_arm_asimdhp.cpp 43KB
c_api.cpp 43KB
lstm_arm_asimdhp.cpp 42KB
F_interpolate.cpp 42KB
binaryop_riscv.cpp 42KB
softmax_arm_asimdhp.cpp 40KB
binaryop_arm.cpp 39KB
mat_pixel_drawing.cpp 39KB
mat.cpp 38KB
interp_riscv.cpp 38KB
lstm_arm.cpp 38KB
slice_arm.cpp 38KB
convolution_loongarch.cpp 37KB
convolution_mips.cpp 37KB
reduction.cpp 36KB
deconvolutiondepthwise_riscv.cpp 35KB
quantize_arm.cpp 35KB
pass_level2.cpp 35KB
gru_riscv.cpp 34KB
dequantize_mips.cpp 32KB
darknet2ncnn.cpp 32KB
dequantize_loongarch.cpp 32KB
innerproduct_riscv.cpp 32KB
convolutiondepthwise_loongarch.cpp 32KB
quantize_arm_asimdhp.cpp 32KB
convolutiondepthwise_mips.cpp 32KB
pooling_riscv.cpp 31KB
interp_arm_asimdhp.cpp 31KB
innerproduct_arm_asimdhp.cpp 31KB
concat_arm.cpp 31KB
rnn_arm.cpp 29KB
simpleomp.cpp 29KB
rnn_arm_asimdhp.cpp 29KB
interp_arm.cpp 29KB
pooling_arm_asimdhp.cpp 28KB
pixelshuffle_arm.cpp 28KB
convolution1d_riscv.cpp 28KB
fuse_dynamic_adaptive_pool.cpp 27KB
shufflechannel_arm.cpp 27KB
padding_arm.cpp 26KB
reshape_arm.cpp 26KB
deconvolutiondepthwise_arm.cpp 26KB
crop_arm.cpp 26KB
convolution_arm_asimdhp.cpp 26KB
pooling_arm.cpp 26KB
fuse_expression.cpp 25KB
F_local_response_norm.cpp 24KB
deconvolutiondepthwise_arm_asimdhp.cpp 23KB
binaryop_arm_asimdhp.cpp 23KB
padding_riscv.cpp 22KB
relu_arm.cpp 22KB
gemm_arm_vfpv4.cpp 22KB
gridsample.cpp 22KB
convolutiondepthwise_arm_asimdhp.cpp 22KB
flatten_arm.cpp 21KB
deconvolution_riscv.cpp 21KB
convolutiondepthwise.cpp 21KB
binaryop_loongarch.cpp 20KB
nn_MultiheadAttention.cpp 20KB
binaryop_mips.cpp 20KB
packing_mips.cpp 19KB
unaryop_riscv.cpp 19KB
quantize_loongarch.cpp 19KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
wjs2024
- 粉丝: 2371
- 资源: 5547
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 电子版账户历史明细.zip
- Visio 2019 64位版本安装包
- 汽车损坏识别检测数据集,使用yolov11格式标注,6696张图片,可识别11种损坏类型 标签和图片参考:https://backend.blog.csdn.net/article/details/1
- 不同形状物体检测25-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 数据分析-57-爬取KFC早餐,搭配出你的营养早餐(包含代码和数据)
- 程序员日常小工具,包含截图,接口调用,日期处理,json转换,翻译等
- 如何在Microsoft Visual Studio 2013 编写的程序的详细步骤
- IMG20241229160637.jpg
- java医药管理系统设计源代码.zip
- 汽车损坏识别检测数据集,使用yolov9格式标注,6696张图片,可识别11种损坏类型 标签和图片参考:https://backend.blog.csdn.net/article/details/1
- 汽车损坏识别检测数据集,使用yolov8格式标注,6696张图片,可识别11种损坏类型 标签和图片参考:https://backend.blog.csdn.net/article/details/1
- 远端桌面工具 2024最新版Setup.RemoteDesktopManager.2024.3.22.0
- 基于python的疫情数据爬虫+微博关键词爬虫(数据库)+数据预处理及可视化数据情感分析源码+文档说明
- 基于ssm的大学生心理健康系统设计与开发源码(java毕业设计完整源码+LW).zip
- idea 用了多年的settings
- RationalDMIS64全套教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功