-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (43 loc) · 1.43 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
#1.cmake verson
cmake_minimum_required(VERSION 2.8)
set (NCNN_DIR /home/wangy/3rdParty/ncnn/build_linux/install)
#2.project name
project(facesdk)
#3.set environment variable
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#4. dependence
## ncnn include
include_directories(${NCNN_DIR}/include/ncnn)
## ncnn lib
add_library( libncnn STATIC IMPORTED )
set_target_properties(
libncnn
PROPERTIES IMPORTED_LOCATION
${NCNN_DIR}/lib/libncnn.a
)
## opencv
find_package(OpenCV REQUIRED)
## OpenMP
#find_package(OpenMP REQUIRED)
#if(OPENMP_FOUND)
# message(STATUS "OpenMP found")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# message(STATUS "CMAKE_CXX_FLAGS=${OpenMP_CXX_FLAGS}")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
#endif()
#5. source include
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
message(STATUS "CMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_LIST_DIR}")
#6.source directory
file(GLOB SRC_CODE ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
#7. set so output path
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/)
message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
#8. generate so
add_library(facesdk SHARED ${SRC_CODE})
#9. add dependence
target_link_libraries(facesdk
libncnn
${OpenCV_LIBS}
)