代码拉取完成,页面将自动刷新
# 这个是cmake最小版本要求
cmake_minimum_required(VERSION 3.1)
# Enable C++11,这一段是源码里的
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# 填写你的项目名称Project
project( NcnnFaceTrack )
# 填写target
set(TARGET "NcnnFaceTrack")
# 这一句是寻找你的OpenCV位置
find_package( OpenCV REQUIRED )
# 可以选择将一些信息打印出来,也可以不打印
# 依次为OpenCV位置,版本,库,包含路径
message(STATUS "OpenCV library status:")
message(STATUS "config: ${OpenCV_DIR}")
message(STATUS "version: ${OpenCV_VERSION}")
message(STATUS "librarier: ${OpenCV_LIBS}")
message(STATUS "include path: ${OpenCV_INCLUDE_DIRS}")
# 添加包含目录
aux_source_directory(${CMAKE_SOURCE_DIR}/src DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/face DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/mtcnn DIR_SRCS)
# 头文件
include_directories(
${OpenCV_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/face
${CMAKE_SOURCE_DIR}/src/mtcnn
${CMAKE_SOURCE_DIR}/src/third_party/ncnn/include
)
# libs
link_directories(
${CMAKE_SOURCE_DIR}/src/third_party/ncnn/lib
)
add_executable(${TARGET} ${DIR_SRCS})
# 填项目名
message(STATUS "OpenCV_LIBS path: ${OpenCV_LIBS}")
target_link_libraries(
${TARGET}
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio opencv_video
ncnn pthread
)
# Build commands
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TARGET} "../release/${TARGET}"
COMMAND ${CMAKE_COMMAND} -E copy "../data/*" "../release/"
COMMAND ${CMAKE_COMMAND} -E copy "../models/ncnn/*" "../release/"
COMMENT "copy ${TARGET} to ../release/${PLATFORM}/${TARGET}"
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。