-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (82 loc) · 2.68 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
cmake_minimum_required (VERSION 2.6)
project (Test)
message(STATUS "CMAKE_SOURCE_DIR->" ${CMAKE_SOURCE_DIR})
message(STATUS "PROJECT_SOURCE_DIR->)" ${PROJECT_SOURCE_DIR})
set (Test_VERSION_MAJOR 1)
set (Test_VERSION_MINOR 0)
set(PATH_LIBS ${CMAKE_SOURCE_DIR}/sources/libs)
set(PATH_CORE ${PROJECT_SOURCE_DIR}/sources/core)
set(ALL_LIBS CACHE INTERNAL "All libs to be linked in this project" )
configure_file (
"${PROJECT_SOURCE_DIR}/TestConfig.h.in"
"${PROJECT_BINARY_DIR}/TestConfig.h"
)
message(STATUS "PATH_LIBS->" ${PATH_LIBS})
set(PATH_DRAGONBALL ${PROJECT_SOURCE_DIR}/sources/dragonball/android/${ARCH})
set(PATH_SDK_LIBS ${PATH_LIBS}/external_sdk/android/${ARCH}/)
set(PATH_SQLITE_LIBS ${PATH_LIBS}/sqlite/android/${ARCH}/)
set(PATH_BOOST_LIBS ${PATH_LIBS}/boost/android/${ARCH}/)
set(PATH_CURLCPP_LIBS ${PATH_LIBS}/curlcpp/android/${ARCH}/)
message(STATUS "PATH_SDK_LIBS->" ${PATH_SDK_LIBS})
message(STATUS "PATH_BOOST_LIBS->" ${PATH_BOOST_LIBS})
#link_directories 相当于设置环境变量,接下来就可以直接引用lib
link_directories(${PATH_LIBS} ${PATH_SDK_LIBS} ${PATH_SQLITE_LIBS} ${PATH_BOOST_LIBS} ${PATH_CURLCPP_LIBS} ${PATH_DRAGONBALL}/lib/)
set(INC_DIR
${PATH_DRAGONBALL}/include/
${PROJECT_SOURCE_DIR}/include
${PATH_CORE}/inc/
)
#添加头文件
include_directories (
"${PROJECT_BINARY_DIR}"
INC_DIR
)
#添加libs前提是前边使用了link_directories,例如boost_atomic就直接到相应的PATH_BOOST_LIBS路径去找
set(BOOST_LIBS
boost_atomic
#boost_date_time
#boost_log
boost_program_options
#boost_stacktrace_basic
boost_system
boost_chrono
boost_filesystem
#boost_log_setup
boost_regex
#boost_stacktrace_noop
boost_thread
)
set(CIMG_LIBS
jpeg
png12
z
)
list(APPEND ALL_LIBS z log)
list(APPEND ALL_LIBS
${BOOST_LIBS}
sqlite3pp
sqlite3
mobvoi_common_static
mobvoisds
mobvoidsp
curl
ssl
crypto
dl
curlcpp
)
# ======================================================================
# Sub Directories
# ======================================================================
add_subdirectory(${PATH_CORE})
#aux_source_directory(src DIR_SRCS)
#set(TEST_MATH ${DIR_SRCS})
set(ANDROID_LIBS_SRC ./src/record_jni_control.cc)
add_library(record SHARED ${ANDROID_LIBS_SRC})
message(STATUS "ALL_LIBS->" ${ALL_LIBS})
set(CMAKE_CXX_FLAGS "-g")
#add_executable (Test ${TEST_MATH})
#install (TARGETS Test DESTINATION ./target/bin)
#install (FILES "${PROJECT_BINARY_DIR}/TestConfig.h" DESTINATION ./target/include)
target_link_libraries(record ${ALL_LIBS})
INSTALL (TARGETS record LIBRARY DESTINATION ./target/bin/libs)