# 指定 cmake 版本,跟安装的版本保持一致
cmake_minimum_required(VERSION 3.5.1)
project(heartrate)
# 指定 c++ 标准
set(CMAKE_CXX_STANDARD 11)
# find opencv
FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
# find dlib package
add_subdirectory(./dlib-19.19/dlib dlib_build)
# 设置源码根路径,即 cpp 目录
set(SRC_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
message(${SRC_ROOT_PATH})
# 定义要编译的文件列表变量,一般为需要用到的函数
file(GLOB CPP_FILES_IN_UTILS "${SRC_ROOT_PATH}/res/*.cpp")
# 设置要编译的源文件,包括主函数和所有cpp文件
set(
SOURCE_FILES
${CPP_FILES_IN_UTILS}
)
# include 头文件目录
include_directories(${SRC_ROOT_PATH}/res/)
# 编译成可执行文件,如果编译动态库可以用target_link_libraries,这里需要加上dlib,itpp和opencv
add_executable(main ${SOURCE_FILES})
target_link_libraries(main dlib::dlib ${OpenCV_LIBS} itpp gsl gslcblas)
#aux_source_directory(. ${SOURCE_FILES})
#add_library(hr-lib SHARED ${SOURCE_FILES})