forked from fly4312/dev-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (57 loc) · 2.5 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
cmake_minimum_required(VERSION 3.5)
project(ji)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INSTALL_PREFIX "/usr/local/ev_sdk")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# 使用pkg-config查找必要的依赖包
find_package(OpenCV REQUIRED)
find_library(glog REQUIRED)
set(ENV{PKG_CONFIG_PATH} "/usr/local/ev_sdk/3rd/ev_encrypt_module/lib/pkgconfig:/usr/local/ev_sdk/3rd/license/lib/pkgconfig:ENV{PKG_CONFIG_PATH}")
find_package(PkgConfig REQUIRED)
pkg_search_module(EV_ENCRYPT_MODULE REQUIRED ev_encrypt_module)
pkg_search_module(JI_LICENSE REQUIRED ji_license)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rd/cJSON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rd/wkt_parser)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:/usr/local/ev_sdk/lib")
# 编译libji.so
list(APPEND libji_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/ji.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/SampleDetector.cpp)
add_library (${PROJECT_NAME} SHARED ${libji_SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC ${OpenCV_INCLUDE_DIR}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PUBLIC ${JI_LICENSE_INCLUDE_DIRS}
PUBLIC ${EV_ENCRYPT_MODULE_INCLUDE_DIRS}
PUBLIC "/usr/local/ev_sdk/3rd/darknet/include")
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
glog
${JI_LICENSE_LDFLAGS}
${EV_ENCRYPT_MODULE_LDFLAGS}
cjson
WKTParser
"/usr/local/ev_sdk/3rd/darknet/lib/libdarknet.so"
)
# 安装SampleDetector所依赖的libdarknet.so, 请在此处将自己依赖的库安装到/usr/local/ev_sdk/lib下
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rd/darknet/lib/libdarknet.so DESTINATION lib)
# 以下是EV_SDK所依赖和需要测试接口的程序&库,请勿修改!!!
# --- BEGIN EV_SDK DEPENDENCIES ---
# 编译 JI API 测试程序
add_executable(test-ji-api ${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp)
target_link_libraries(test-ji-api
${OpenCV_LIBS}
cjson
glog
${PROJECT_NAME}
)
# Install libji_license_impl.so
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rd/license/lib/libji_license_impl.so DESTINATION lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rd/license/lib/license_lib.sig DESTINATION lib)
# Install libev_encrypt_module
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rd/ev_encrypt_module/lib/libev_encrypt_module.so DESTINATION lib)
# Install libji.so
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
# Install test-ji-api
install(TARGETS test-ji-api DESTINATION bin)
# --- END EV_SDK DEPENDENCIES ---