-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
145 lines (120 loc) · 5.67 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
cmake_minimum_required(VERSION 2.6)
find_package(PkgConfig)
#functions
function(test_lib LIB_NAME)
if (${LIB_NAME} MATCHES "^.*-NOTFOUND")
message(FATAL_ERROR "lib not found: " ${LIB_NAME} " check README")
return()
endif(${LIB_NAME} MATCHES "^.*-NOTFOUND")
endfunction(test_lib)
project(nrappkit)
set(NRAPPKIT_BUILD "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
set(NRAPPKIT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND nrappkit__c_srcs
"${NRAPPKIT_SOURCE}/src/util/libekr/r_assoc.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_crc32.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_data.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_errors.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_list.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_memory.c"
#"${NRAPPKIT_SOURCE}/src/util/libekr/r_replace.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_time.c"
"${NRAPPKIT_SOURCE}/src/util/libekr/debug.c"
"${NRAPPKIT_SOURCE}/src/util/byteorder.c"
"${NRAPPKIT_SOURCE}/src/util/hex.c"
"${NRAPPKIT_SOURCE}/src/util/p_buf.c"
"${NRAPPKIT_SOURCE}/src/util/util.c"
"${NRAPPKIT_SOURCE}/src/log/r_log.c"
"${NRAPPKIT_SOURCE}/src/event/async_timer.c"
"${NRAPPKIT_SOURCE}/src/event/async_wait.c"
"${NRAPPKIT_SOURCE}/src/registry/c2ru.c"
"${NRAPPKIT_SOURCE}/src/registry/registry.c"
"${NRAPPKIT_SOURCE}/src/registry/registry_local.c"
"${NRAPPKIT_SOURCE}/src/registry/registrycb.c")
list(APPEND nrappkit__other_srcs
"${NRAPPKIT_SOURCE}/src/share/nr_common.h"
"${NRAPPKIT_SOURCE}/src/share/nr_reg_keys.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/assoc.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/debug.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_assoc.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_common.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_crc32.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_data.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_defaults.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_errors.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_includes.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_list.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_macros.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_memory.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_thread.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_time.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/r_types.h"
"${NRAPPKIT_SOURCE}/src/util/libekr/debug.h"
"${NRAPPKIT_SOURCE}/src/util/byteorder.h"
"${NRAPPKIT_SOURCE}/src/util/hex.h"
"${NRAPPKIT_SOURCE}/src/util/p_buf.h"
"${NRAPPKIT_SOURCE}/src/util/util.h"
"${NRAPPKIT_SOURCE}/src/event/async_timer.h"
"${NRAPPKIT_SOURCE}/src/event/async_wait.h"
"${NRAPPKIT_SOURCE}/src/event/async_wait_int.h"
"${NRAPPKIT_SOURCE}/src/log/r_log.h"
"${NRAPPKIT_SOURCE}/src/registry/c2ru.h"
"${NRAPPKIT_SOURCE}/src/registry/registry.h"
"${NRAPPKIT_SOURCE}/src/registry/registry_int.h"
"${NRAPPKIT_SOURCE}/src/registry/registry_vtbl.h")
file(GLOB_RECURSE PORT_GENERIC_INCLUDE "${NRAPPKIT_SOURCE}/src/port/generic/include")
list(APPEND nrappkit__other_srcs ${PORT_GENERIC_INCLUDE})
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND nrappkit__other_srcs "${NRAPPKIT_SOURCE}/src/port/darwin/include/csi_platform.h")
ELSE()
list(APPEND nrappkit__other_srcs "${NRAPPKIT_SOURCE}/src/port/linux/include/csi_platform.h")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_library(nrappkit STATIC ${nrappkit__c_srcs} ${nrappkit__other_srcs})
# OPENSSL
find_library(SSL ssl HINTS "${THIRD_PARTY_LIB}")
test_lib(${SSL})
find_library(CRYPTO crypto HINTS "${THIRD_PARTY_LIB}")
test_lib(${CRYPTO})
set_target_properties(nrappkit PROPERTIES EXCLUDE_FROM_ALL "FALSE")
set_source_files_properties(${nrappkit__other_srcs} PROPERTIES HEADER_FILE_ONLY "TRUE")
set_target_properties(nrappkit PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "nrappkit")
set_target_properties(nrappkit PROPERTIES PREFIX "lib")
set_target_properties(nrappkit PROPERTIES ARCHIVE_OUTPUT_NAME "nrappkit")
set_target_properties(nrappkit PROPERTIES SUFFIX ".a")
set_source_files_properties(nrappkit/libnrappkit.a PROPERTIES GENERATED "TRUE")
list(APPEND nrappkit__include_dirs
"${NRAPPKIT_SOURCE}/src/event"
"${NRAPPKIT_SOURCE}/src/log"
"${NRAPPKIT_SOURCE}/src/port/generic/include"
"${NRAPPKIT_SOURCE}/src/registry"
"${NRAPPKIT_SOURCE}/src/share"
"${NRAPPKIT_SOURCE}/src/plugin"
"${NRAPPKIT_SOURCE}/src/stats"
"${NRAPPKIT_SOURCE}/src/util"
"${NRAPPKIT_SOURCE}/src/util/libekr")
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (NRAPPKIT_OS DARWIN)
list(APPEND nrappkit__include_dirs "${NRAPPKIT_SOURCE}/src/port/darwin/include")
ELSE()
set (NRAPPKIT_OS LINUX)
list(APPEND nrappkit__include_dirs "${NRAPPKIT_SOURCE}/src/port/linux/include")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_target_properties(nrappkit PROPERTIES COMPILE_FLAGS "-g -fPIC -Wall -Wno-parentheses -Wno-strict-prototypes -Wmissing-prototypes -DNO_REG_RPC=1 -DHAVE_VFPRINTF=1 -DRETSIGTYPE=void -DNEW_STDIO -DHAVE_STRDUP=1 -DHAVE_STRLCPY=1 -DHAVE_LIBM=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME_H=1 -D${NRAPPKIT_OS} -D__UNUSED__=\"__attribute__((unused))\"")
set_property(TARGET nrappkit APPEND PROPERTY INCLUDE_DIRECTORIES ${nrappkit__include_dirs})
target_link_libraries(nrappkit PUBLIC ${SSL} ${CRYPTO})
install(TARGETS nrappkit
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
list(APPEND nrappkit__include_public_dirs
"${NRAPPKIT_SOURCE}/src/event"
"${NRAPPKIT_SOURCE}/src/log"
"${NRAPPKIT_SOURCE}/src/plugin"
"${NRAPPKIT_SOURCE}/src/port"
"${NRAPPKIT_SOURCE}/src/registry"
"${NRAPPKIT_SOURCE}/src/share"
"${NRAPPKIT_SOURCE}/src/stats"
"${NRAPPKIT_SOURCE}/src/util")
target_include_directories(nrappkit PUBLIC ${nrappkit__include_public_dirs})
install(DIRECTORY ${nrappkit__include_public_dirs} DESTINATION include FILES_MATCHING PATTERN "**.h")