blob: a8e25bae789affb2ccb7717248ca0591b8c82019 (
plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
project(libuv C)
# Disable warnings to avoid changing 3rd party code.
if(CMAKE_C_COMPILER_ID MATCHES
"^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
endif()
find_package(Threads)
set(uv_libraries ${CMAKE_THREAD_LIBS_INIT})
set(uv_includes include src)
set(uv_headers
include/uv.h
include/uv-errno.h
include/uv-threadpool.h
include/uv-version.h
)
set(uv_sources
src/fs-poll.c
src/heap-inl.h
src/inet.c
src/queue.h
src/threadpool.c
src/uv-common.c
src/uv-common.h
src/version.c
)
if(WIN32)
list(APPEND uv_libraries
ws2_32
psapi
iphlpapi
shell32
userenv
)
list(APPEND uv_includes
src/win
)
list(APPEND uv_defines
WIN32_LEAN_AND_MEAN
_WIN32_WINNT=0x0600
)
list(APPEND uv_headers
include/uv-win.h
include/tree.h
)
list(APPEND uv_sources
src/win/async.c
src/win/atomicops-inl.h
src/win/core.c
src/win/detect-wakeup.c
src/win/dl.c
src/win/error.c
src/win/fs-event.c
src/win/fs.c
src/win/getaddrinfo.c
src/win/getnameinfo.c
src/win/handle.c
src/win/handle-inl.h
src/win/internal.h
src/win/loop-watcher.c
src/win/pipe.c
src/win/poll.c
src/win/process-stdio.c
src/win/process.c
src/win/req.c
src/win/req-inl.h
src/win/signal.c
src/win/snprintf.c
src/win/stream.c
src/win/stream-inl.h
src/win/tcp.c
src/win/thread.c
src/win/timer.c
src/win/tty.c
src/win/udp.c
src/win/util.c
src/win/winapi.c
src/win/winapi.h
src/win/winsock.c
src/win/winsock.h
)
else()
list(APPEND uv_includes
src/unix
)
list(APPEND uv_headers
include/uv-unix.h
)
list(APPEND uv_sources
src/unix/async.c
src/unix/atomic-ops.h
src/unix/core.c
src/unix/dl.c
src/unix/fs.c
src/unix/getaddrinfo.c
src/unix/getnameinfo.c
src/unix/internal.h
src/unix/loop-watcher.c
src/unix/loop.c
src/unix/pipe.c
src/unix/poll.c
src/unix/process.c
src/unix/signal.c
src/unix/spinlock.h
src/unix/stream.c
src/unix/tcp.c
src/unix/thread.c
src/unix/timer.c
src/unix/tty.c
src/unix/udp.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
list(APPEND uv_libraries
perfstat
)
list(APPEND uv_headers
include/uv-aix.h
)
list(APPEND uv_defines
_ALL_SOURCE
_XOPEN_SOURCE=500
_LINUX_SOURCE_COMPAT
_THREAD_SAFE
)
list(APPEND uv_sources
src/unix/aix.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND uv_headers
include/uv-darwin.h
include/pthread-barrier.h
)
list(APPEND uv_defines
_DARWIN_USE_64_BIT_INODE=1
_DARWIN_UNLIMITED_SELECT=1
)
list(APPEND uv_sources
src/unix/darwin.c
src/unix/darwin-proctitle.c
src/unix/fsevents.c
src/unix/kqueue.c
src/unix/proctitle.c
src/unix/pthread-barrier.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND uv_libraries dl rt)
list(APPEND uv_headers
include/uv-linux.h
)
list(APPEND uv_defines _GNU_SOURCE)
list(APPEND uv_sources
src/unix/linux-core.c
src/unix/linux-inotify.c
src/unix/linux-syscalls.c
src/unix/linux-syscalls.h
src/unix/proctitle.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND uv_libraries
kvm
)
list(APPEND uv_headers
include/uv-bsd.h
)
list(APPEND uv_sources
src/unix/freebsd.c
src/unix/kqueue.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
list(APPEND uv_libraries
kvm
)
list(APPEND uv_headers
include/uv-bsd.h
)
list(APPEND uv_sources
src/unix/netbsd.c
src/unix/kqueue.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
list(APPEND uv_libraries
kvm
)
list(APPEND uv_headers
include/uv-bsd.h
)
list(APPEND uv_sources
src/unix/openbsd.c
src/unix/kqueue.c
)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
list(APPEND uv_libraries
kstat
nsl
sendfile
socket
)
list(APPEND uv_headers
include/uv-sunos.h
)
list(APPEND uv_defines
__EXTENSIONS__
)
if(CMAKE_SYSTEM_VERSION STREQUAL "5.10")
list(APPEND uv_defines
_XOPEN_SOURCE=500
)
else()
list(APPEND uv_defines
_XOPEN_SOURCE=600
)
endif()
list(APPEND uv_sources
src/unix/sunos.c
)
endif()
include_directories(
${uv_includes}
${KWSYS_HEADER_ROOT}
)
add_library(cmlibuv STATIC ${uv_sources})
target_link_libraries(cmlibuv ${uv_libraries})
set_property(TARGET cmlibuv PROPERTY COMPILE_DEFINITIONS ${uv_defines})
install(FILES LICENSE DESTINATION ${CMAKE_DOC_DIR}/cmlibuv)
|