-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
94 lines (70 loc) · 2.37 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# CMakeLists for pipeline
project(facedetection)
cmake_minimum_required(VERSION 2.8)
option(ENABLE_INT8 "use int8" ON)
option(ENABLE_AVX2 "use avx2" OFF)
option(ENABLE_NEON "whether use neon, if use arm please set it on" OFF)
option(DEMO "build the demo" ON)
option(ENABLE_FACEDETECT "face detect model" ON)
SET(base_dir ${PROJECT_SOURCE_DIR})
SET(src_dir ${base_dir}/src)
SET(inc_dir ${base_dir}/src)
if(ENABLE_FACEDETECT)
SET(fdt_lib_name facedetection)
FILE(GLOB_RECURSE fdt_source_files ${src_dir}/*.cpp )
endif()
SET(fdt_lib_static ${fdt_lib_name})
SET(fdt_lib_shared ${fdt_lib_name}_shared)
LIST(SORT fdt_source_files)
if(ENABLE_INT8)
message("using int8")
add_definitions(-D_ENABLE_INT8_CONV)
endif()
if(ENABLE_AVX2)
message("using avx2")
add_definitions(-D_ENABLE_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma")
endif()
if(ENABLE_NEON)
message("using arm")
add_definitions(-D_ENABLE_NEON)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
INCLUDE_DIRECTORIES(${inc_dir})
# Create a static library (.a)
ADD_LIBRARY(${fdt_lib_static} STATIC ${fdt_source_files} )
# Create a shared library (.so)
ADD_LIBRARY(${fdt_lib_shared} SHARED ${fdt_source_files})
SET_TARGET_PROPERTIES(${fdt_lib_shared} PROPERTIES OUTPUT_NAME "${fdt_lib_name}")
SET_TARGET_PROPERTIES(${fdt_lib_shared} PROPERTIES PREFIX "lib")
# Create demo. OpenCV is requred.
if (DEMO)
set(fdt_demo_files ${base_dir}/src/main.cpp)
add_executable(facedetect_demo ${fdt_demo_files})
target_link_libraries(facedetect_demo ${fdt_lib_static} ${OpenCV_LIBS})
endif()
#if (GSTREAMER)
# find_package(OpenCV REQUIRED)#
# include(FindPkgConfig)
# pkg_search_module(GSTREAMER REQUIRED gstreamer-1.0)
# pkg_search_module(GSTREAMER_BASE REQUIRED gstreamer-base-1.0)
# pkg_search_module(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)#
# add_library(gstfacedetect SHARED
# example/libfacedetect.cpp
# )#
# include_directories(gstfacedetect PRIVATE
# ${GSTREAMER_INCLUDE_DIRS}
# ${GSTREAMER_BASE_INCLUDE_DIRS}
# ${GSTREAMER_VIDEO_INCLUDE_DIRS}
# ${OpenCV_INCLUDE_DIRS}
# )#
# target_link_libraries(gstfacedetect
# ${GSTREAMER_LIBRARIES}
# ${GSTREAMER_BASE_LIBRARIES}
# ${GSTREAMER_VIDEO_LIBRARIES}
# ${OpenCV_LIBS}
# ${fdt_lib_shared}
# )
#endif()