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()
if(POLICY CMP0057)
# reference from https://cmake.org/cmake/help/latest/policy/CMP0057.html
cmake_policy(SET CMP0057 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_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)
# gnu inline assembly in clang msvc does not work actually
if(NOT (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")))
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()
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(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64_32")
set(NCNN_TARGET_ILP32 TRUE)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT NCNN_TARGET_ILP32)
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_C
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该框架为ncnn,由腾讯优图实验室推出,是一款专为手机端优化的高性能神经网络前向计算框架。项目源码以C++为主,辅以C、Python和Shell等多种语言编写,总计包含3390个文件,涵盖了1183个C++源文件、898个头文件、605个Python脚本、417个编译文件等,适用于移动端高性能计算需求。
资源推荐
资源详情
资源评论
收起资源包目录
基于C++的高性能手机端神经网络前向计算框架ncnn设计源码 (2000个子文件)
mat_pixel_rotate.cpp 230KB
onnx2ncnn.cpp 208KB
gpu.cpp 197KB
gemm_arm.cpp 172KB
command.cpp 135KB
fuse_multiheadattention.cpp 109KB
gemm_arm_asimdhp.cpp 100KB
ir.cpp 89KB
mat_pixel.cpp 87KB
net.cpp 86KB
ncnnoptimize.cpp 84KB
mxnet2ncnn.cpp 81KB
mat_pixel_affine.cpp 78KB
allocator.cpp 73KB
cpu.cpp 72KB
requantize_mips.cpp 70KB
requantize_arm.cpp 68KB
gru_arm.cpp 66KB
innerproduct_arm.cpp 64KB
packing_arm.cpp 61KB
dequantize_arm.cpp 60KB
innerproduct_mips.cpp 58KB
mlir2ncnn.cpp 58KB
eltwise_arm_asimdhp.cpp 55KB
convolutiondepthwise_arm.cpp 55KB
ncnn2table.cpp 55KB
convolution_arm.cpp 54KB
mat_pixel_drawing.cpp 54KB
dequantize_arm_asimdhp.cpp 53KB
F_interpolate.cpp 51KB
deconvolution_arm_asimdhp.cpp 51KB
softmax_arm.cpp 50KB
lstm_arm.cpp 49KB
c_api.cpp 47KB
caffe2ncnn.cpp 45KB
deconvolution_arm.cpp 45KB
pass_level2.cpp 43KB
fold_constants.cpp 40KB
softmax_arm_asimdhp.cpp 40KB
rnn_arm.cpp 40KB
gru_arm_asimdhp.cpp 39KB
binaryop_arm.cpp 39KB
mat.cpp 39KB
slice_arm.cpp 38KB
convolution_mips.cpp 37KB
pass_onnx.cpp 36KB
reduction.cpp 36KB
lstm_arm_asimdhp.cpp 35KB
dequantize_mips.cpp 32KB
darknet2ncnn.cpp 32KB
quantize_arm_asimdhp.cpp 32KB
convolutiondepthwise_mips.cpp 32KB
innerproduct_arm_asimdhp.cpp 31KB
interp_arm_asimdhp.cpp 31KB
concat_arm.cpp 31KB
fuse_expression.cpp 30KB
ncnn2int8.cpp 29KB
simpleomp.cpp 29KB
interp_arm.cpp 29KB
pooling_arm_asimdhp.cpp 28KB
pixelshuffle_arm.cpp 28KB
shufflechannel_arm.cpp 27KB
fuse_dynamic_adaptive_pool.cpp 27KB
deconvolutiondepthwise_arm.cpp 27KB
padding_arm.cpp 27KB
reshape_arm.cpp 26KB
crop_arm.cpp 26KB
convolution_arm_asimdhp.cpp 26KB
pooling_arm.cpp 26KB
rnn_arm_asimdhp.cpp 25KB
shape_inference.cpp 25KB
F_local_response_norm.cpp 24KB
nn_LSTM.cpp 24KB
binaryop_arm_asimdhp.cpp 23KB
gemm_arm_vfpv4.cpp 22KB
relu_arm.cpp 22KB
convolutiondepthwise_arm_asimdhp.cpp 22KB
model_stat.cpp 21KB
nn_GRU.cpp 21KB
flatten_arm.cpp 21KB
convolutiondepthwise.cpp 21KB
fuse_slice_indices.cpp 20KB
binaryop_mips.cpp 20KB
packing_mips.cpp 19KB
eval_expression.cpp 19KB
quantize_mips.cpp 19KB
load_onnx.cpp 19KB
nn_MultiheadAttention.cpp 19KB
prelu_arm_asimdhp.cpp 18KB
simplevk.cpp 17KB
load_torchscript.cpp 17KB
pass_level1.cpp 17KB
unaryop_arm.cpp 17KB
slice_mips.cpp 16KB
prelu_arm.cpp 16KB
nn_RNN.cpp 16KB
deconvolutiondepthwise_mips.cpp 16KB
pipelinecache.cpp 16KB
nn_LSTM.cpp 16KB
fuse_pad_conv2d.cpp 16KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
xyq2024
- 粉丝: 2799
- 资源: 5538
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Revel,Jquery, Xorm开发的内容管理系统详细文档+优秀项目+全部资料.zip
- 基于websocket单台机器支持百万连接分布式聊天(IM)系统详细文档+优秀项目+全部资料.zip
- 基于原生Fabric-SDK-Go 实现一个简单的学历征信系统(web项目),状态数据库使用 CouchDB 来实现详细文档+优秀项目+全部资料.zip
- 基于开源CDN系统GoEdge制作的模版UI、插件、脚本合集详细文档+优秀项目+全部资料.zip
- 2022机器人SLAM知识星球答疑手册
- DSP28335 PMSM电机控制程序
- DSP28335 BLDC电机控制程序
- MiniBalance PC上位机开发资料
- 中大型三相异步电机电磁设计软件
- PLSQL程序设计Word文档doc格式最新版本
- 一、MySQL的介绍与安装
- 25个团队建设小游戏.ppt
- 管理团队拓展游戏.doc
- 几个经典团队游戏.doc
- 企业团队建设游戏活动经典收藏.doc
- 十个团队建设游戏.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功