1- # TODO: determine CMAKE_SYSTEM_NAME on OS/390. Currently assumes "OS/390".
21cmake_minimum_required (VERSION 3.4)
32project (libuv LANGUAGES C)
43
@@ -114,7 +113,7 @@ if(WIN32)
114113 list (APPEND uv_test_sources src/win/snprintf.c test /runner-win.c)
115114else ()
116115 list (APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE)
117- if (NOT CMAKE_SYSTEM_NAME STREQUAL "Android" )
116+ if (NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390 " )
118117 # TODO: This should be replaced with find_package(Threads) if possible
119118 # Android has pthread as part of its c library, not as a separate
120119 # libpthread.so.
@@ -147,9 +146,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
147146 _ALL_SOURCE
148147 _LINUX_SOURCE_COMPAT
149148 _THREAD_SAFE
150- _XOPEN_SOURCE=500)
149+ _XOPEN_SOURCE=500
150+ HAVE_SYS_AHAFS_EVPRODS_H)
151151 list (APPEND uv_libraries perfstat)
152- list (APPEND uv_sources src/unix /aix.c)
152+ list (APPEND uv_sources
153+ src/unix /aix.c
154+ src/unix /aix-common.c)
153155endif ()
154156
155157if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
@@ -167,7 +169,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
167169 src/unix /sysinfo-loadavg.c)
168170endif ()
169171
170- if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux|OS/390 " )
172+ if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux|OS390 " )
171173 list (APPEND uv_sources src/unix /proctitle.c)
172174endif ()
173175
@@ -221,10 +223,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
221223 list (APPEND uv_sources src/unix /openbsd.c)
222224endif ()
223225
224- if (CMAKE_SYSTEM_NAME STREQUAL "OS/390 " )
226+ if (CMAKE_SYSTEM_NAME STREQUAL "OS390 " )
225227 list (APPEND uv_defines PATH_MAX=255)
226228 list (APPEND uv_defines _AE_BIMODAL)
227229 list (APPEND uv_defines _ALL_SOURCE)
230+ list (APPEND uv_defines _ISOC99_SOURCE)
228231 list (APPEND uv_defines _LARGE_TIME_API)
229232 list (APPEND uv_defines _OPEN_MSGQ_EXT)
230233 list (APPEND uv_defines _OPEN_SYS_FILE_EXT)
@@ -237,9 +240,25 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS/390")
237240 list (APPEND uv_defines _XOPEN_SOURCE_EXTENDED)
238241 list (APPEND uv_sources
239242 src/unix /pthread-fixes.c
240- src/unix /pthread-barrier.c
241243 src/unix /os390.c
242244 src/unix /os390-syscalls.c)
245+ list (APPEND uv_cflags -Wc,DLL -Wc,exportall -Wc,xplink)
246+ list (APPEND uv_libraries -Wl,xplink)
247+ list (APPEND uv_test_libraries -Wl,xplink)
248+ endif ()
249+
250+ if (CMAKE_SYSTEM_NAME STREQUAL "OS400" )
251+ list (APPEND uv_defines
252+ _ALL_SOURCE
253+ _LINUX_SOURCE_COMPAT
254+ _THREAD_SAFE
255+ _XOPEN_SOURCE=500)
256+ list (APPEND uv_sources
257+ src/unix /aix-common.c
258+ src/unix /ibmi.c
259+ src/unix /no -fsevents.c
260+ src/unix /no -proctitle.c
261+ src/unix /posix-poll.c)
243262endif ()
244263
245264if (CMAKE_SYSTEM_NAME STREQUAL "SunOS" )
@@ -280,6 +299,37 @@ target_include_directories(uv_a
280299target_link_libraries (uv_a ${uv_libraries} )
281300
282301if (LIBUV_BUILD_TESTS)
302+ # Small hack: use ${uv_test_sources} now to get the runner skeleton,
303+ # before the actual tests are added.
304+ add_executable (
305+ uv_run_benchmarks_a
306+ ${uv_test_sources}
307+ test /benchmark-async-pummel.c
308+ test /benchmark-async.c
309+ test /benchmark-fs-stat.c
310+ test /benchmark-getaddrinfo.c
311+ test /benchmark-loop-count.c
312+ test /benchmark-million-async.c
313+ test /benchmark-million-timers.c
314+ test /benchmark-multi-accept.c
315+ test /benchmark-ping-pongs.c
316+ test /benchmark-ping-udp.c
317+ test /benchmark-pound.c
318+ test /benchmark-pump.c
319+ test /benchmark-sizes.c
320+ test /benchmark-spawn.c
321+ test /benchmark-tcp-write-batch.c
322+ test /benchmark-thread.c
323+ test /benchmark-udp-pummel.c
324+ test /blackhole-server.c
325+ test /dns-server.c
326+ test /echo-server.c
327+ test /run-benchmarks.c
328+ test /runner.c)
329+ target_compile_definitions (uv_run_benchmarks_a PRIVATE ${uv_defines} )
330+ target_compile_options (uv_run_benchmarks_a PRIVATE ${uv_cflags} )
331+ target_link_libraries (uv_run_benchmarks_a uv_a ${uv_test_libraries} )
332+
283333 list (APPEND uv_test_sources
284334 test /blackhole-server.c
285335 test /echo-server.c
@@ -447,6 +497,10 @@ if(LIBUV_BUILD_TESTS)
447497 add_test (NAME uv_test
448498 COMMAND uv_run_tests
449499 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
500+ if (CMAKE_SYSTEM_NAME STREQUAL "OS390" )
501+ set_tests_properties (uv_test PROPERTIES ENVIRONMENT
502+ "LIBPATH=${CMAKE_BINARY_DIR} :$ENV{LIBPATH} " )
503+ endif ()
450504 add_executable (uv_run_tests_a ${uv_test_sources} )
451505 target_compile_definitions (uv_run_tests_a PRIVATE ${uv_defines} )
452506 target_compile_options (uv_run_tests_a PRIVATE ${uv_cflags} )
0 commit comments