11cb0ef41Sopenharmony_cicmake_minimum_required(VERSION 3.4) 21cb0ef41Sopenharmony_ciproject(libuv LANGUAGES C) 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cicmake_policy(SET CMP0057 NEW) # Enable IN_LIST operator 51cb0ef41Sopenharmony_cicmake_policy(SET CMP0064 NEW) # Support if (TEST) operator 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_cilist(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciinclude(CMakePackageConfigHelpers) 101cb0ef41Sopenharmony_ciinclude(CMakeDependentOption) 111cb0ef41Sopenharmony_ciinclude(CheckCCompilerFlag) 121cb0ef41Sopenharmony_ciinclude(GNUInstallDirs) 131cb0ef41Sopenharmony_ciinclude(CTest) 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciset(CMAKE_C_VISIBILITY_PRESET hidden) 161cb0ef41Sopenharmony_ciset(CMAKE_C_STANDARD_REQUIRED ON) 171cb0ef41Sopenharmony_ciset(CMAKE_C_EXTENSIONS ON) 181cb0ef41Sopenharmony_ciset(CMAKE_C_STANDARD 90) 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cicmake_dependent_option(LIBUV_BUILD_TESTS 211cb0ef41Sopenharmony_ci "Build the unit tests when BUILD_TESTING is enabled and we are the root project" ON 221cb0ef41Sopenharmony_ci "BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF) 231cb0ef41Sopenharmony_cicmake_dependent_option(LIBUV_BUILD_BENCH 241cb0ef41Sopenharmony_ci "Build the benchmarks when building unit tests and we are the root project" ON 251cb0ef41Sopenharmony_ci "LIBUV_BUILD_TESTS" OFF) 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci# Qemu Build 281cb0ef41Sopenharmony_cioption(QEMU "build for qemu" OFF) 291cb0ef41Sopenharmony_ciif(QEMU) 301cb0ef41Sopenharmony_ci add_definitions(-D__QEMU__=1) 311cb0ef41Sopenharmony_ciendif() 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_cioption(ASAN "Enable AddressSanitizer (ASan)" OFF) 341cb0ef41Sopenharmony_cioption(TSAN "Enable ThreadSanitizer (TSan)" OFF) 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ciif((ASAN OR TSAN) AND NOT (CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")) 371cb0ef41Sopenharmony_ci message(SEND_ERROR "Sanitizer support requires clang or gcc. Try again with -DCMAKE_C_COMPILER.") 381cb0ef41Sopenharmony_ciendif() 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ciif(ASAN) 411cb0ef41Sopenharmony_ci add_definitions(-D__ASAN__=1) 421cb0ef41Sopenharmony_ci set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address") 431cb0ef41Sopenharmony_ci set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address") 441cb0ef41Sopenharmony_ci set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address") 451cb0ef41Sopenharmony_ciendif() 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ciif(TSAN) 481cb0ef41Sopenharmony_ci add_definitions(-D__TSAN__=1) 491cb0ef41Sopenharmony_ci set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=thread") 501cb0ef41Sopenharmony_ci set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread") 511cb0ef41Sopenharmony_ci set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread") 521cb0ef41Sopenharmony_ciendif() 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci# Compiler check 551cb0ef41Sopenharmony_cistring(CONCAT is-msvc $<OR: 561cb0ef41Sopenharmony_ci $<C_COMPILER_ID:MSVC>, 571cb0ef41Sopenharmony_ci $<STREQUAL:${CMAKE_C_COMPILER_FRONTEND_VARIANT},MSVC> 581cb0ef41Sopenharmony_ci>) 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_cicheck_c_compiler_flag(/W4 UV_LINT_W4) 611cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4100 UV_LINT_NO_UNUSED_PARAMETER_MSVC) 621cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4127 UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC) 631cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4201 UV_LINT_NO_NONSTANDARD_MSVC) 641cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4206 UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC) 651cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4210 UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC) 661cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4232 UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC) 671cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4456 UV_LINT_NO_HIDES_LOCAL) 681cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4457 UV_LINT_NO_HIDES_PARAM) 691cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4459 UV_LINT_NO_HIDES_GLOBAL) 701cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4706 UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC) 711cb0ef41Sopenharmony_cicheck_c_compiler_flag(/wd4996 UV_LINT_NO_UNSAFE_MSVC) 721cb0ef41Sopenharmony_ci 731cb0ef41Sopenharmony_cicheck_c_compiler_flag(-Wall UV_LINT_WALL) # DO NOT use this under MSVC 741cb0ef41Sopenharmony_ci 751cb0ef41Sopenharmony_ci# TODO: Place these into its own function 761cb0ef41Sopenharmony_cicheck_c_compiler_flag(-Wno-unused-parameter UV_LINT_NO_UNUSED_PARAMETER) 771cb0ef41Sopenharmony_cicheck_c_compiler_flag(-Wstrict-prototypes UV_LINT_STRICT_PROTOTYPES) 781cb0ef41Sopenharmony_cicheck_c_compiler_flag(-Wextra UV_LINT_EXTRA) 791cb0ef41Sopenharmony_ci 801cb0ef41Sopenharmony_cicheck_c_compiler_flag(/utf-8 UV_LINT_UTF8_MSVC) 811cb0ef41Sopenharmony_ci 821cb0ef41Sopenharmony_ciset(lint-no-unused-parameter $<$<BOOL:${UV_LINT_NO_UNUSED_PARAMETER}>:-Wno-unused-parameter>) 831cb0ef41Sopenharmony_ciset(lint-strict-prototypes $<$<BOOL:${UV_LINT_STRICT_PROTOTYPES}>:-Wstrict-prototypes>) 841cb0ef41Sopenharmony_ciset(lint-extra $<$<BOOL:${UV_LINT_EXTRA}>:-Wextra>) 851cb0ef41Sopenharmony_ciset(lint-w4 $<$<BOOL:${UV_LINT_W4}>:/W4>) 861cb0ef41Sopenharmony_ciset(lint-no-unused-parameter-msvc $<$<BOOL:${UV_LINT_NO_UNUSED_PARAMETER_MSVC}>:/wd4100>) 871cb0ef41Sopenharmony_ciset(lint-no-conditional-constant-msvc $<$<BOOL:${UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC}>:/wd4127>) 881cb0ef41Sopenharmony_ciset(lint-no-nonstandard-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_MSVC}>:/wd4201>) 891cb0ef41Sopenharmony_ciset(lint-no-nonstandard-empty-tu-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC}>:/wd4206>) 901cb0ef41Sopenharmony_ciset(lint-no-nonstandard-file-scope-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC}>:/wd4210>) 911cb0ef41Sopenharmony_ciset(lint-no-nonstandard-nonstatic-dlimport-msvc $<$<BOOL:${UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC}>:/wd4232>) 921cb0ef41Sopenharmony_ciset(lint-no-hides-local-msvc $<$<BOOL:${UV_LINT_NO_HIDES_LOCAL}>:/wd4456>) 931cb0ef41Sopenharmony_ciset(lint-no-hides-param-msvc $<$<BOOL:${UV_LINT_NO_HIDES_PARAM}>:/wd4457>) 941cb0ef41Sopenharmony_ciset(lint-no-hides-global-msvc $<$<BOOL:${UV_LINT_NO_HIDES_GLOBAL}>:/wd4459>) 951cb0ef41Sopenharmony_ciset(lint-no-conditional-assignment-msvc $<$<BOOL:${UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC}>:/wd4706>) 961cb0ef41Sopenharmony_ciset(lint-no-unsafe-msvc $<$<BOOL:${UV_LINT_NO_UNSAFE_MSVC}>:/wd4996>) 971cb0ef41Sopenharmony_ci# Unfortunately, this one is complicated because MSVC and clang-cl support -Wall 981cb0ef41Sopenharmony_ci# but using it is like calling -Weverything 991cb0ef41Sopenharmony_cistring(CONCAT lint-default $< 1001cb0ef41Sopenharmony_ci $<AND:$<BOOL:${UV_LINT_WALL}>,$<NOT:${is-msvc}>>:-Wall 1011cb0ef41Sopenharmony_ci>) 1021cb0ef41Sopenharmony_ciset(lint-utf8-msvc $<$<BOOL:${UV_LINT_UTF8_MSVC}>:/utf-8>) 1031cb0ef41Sopenharmony_ci 1041cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-strict-prototypes} ${lint-extra} ${lint-default} ${lint-w4}) 1051cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-unused-parameter}) 1061cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-unused-parameter-msvc}) 1071cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-conditional-constant-msvc}) 1081cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-nonstandard-msvc}) 1091cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-nonstandard-empty-tu-msvc}) 1101cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-nonstandard-file-scope-msvc}) 1111cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-nonstandard-nonstatic-dlimport-msvc}) 1121cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-hides-local-msvc}) 1131cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-hides-param-msvc}) 1141cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-hides-global-msvc}) 1151cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-conditional-assignment-msvc}) 1161cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-no-unsafe-msvc}) 1171cb0ef41Sopenharmony_cilist(APPEND uv_cflags ${lint-utf8-msvc} ) 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_cicheck_c_compiler_flag(-fno-strict-aliasing UV_F_STRICT_ALIASING) 1201cb0ef41Sopenharmony_cilist(APPEND uv_cflags $<$<BOOL:${UV_F_STRICT_ALIASING}>:-fno-strict-aliasing>) 1211cb0ef41Sopenharmony_ci 1221cb0ef41Sopenharmony_ciset(uv_sources 1231cb0ef41Sopenharmony_ci src/fs-poll.c 1241cb0ef41Sopenharmony_ci src/idna.c 1251cb0ef41Sopenharmony_ci src/inet.c 1261cb0ef41Sopenharmony_ci src/random.c 1271cb0ef41Sopenharmony_ci src/strscpy.c 1281cb0ef41Sopenharmony_ci src/strtok.c 1291cb0ef41Sopenharmony_ci src/threadpool.c 1301cb0ef41Sopenharmony_ci src/timer.c 1311cb0ef41Sopenharmony_ci src/uv-common.c 1321cb0ef41Sopenharmony_ci src/uv-data-getter-setters.c 1331cb0ef41Sopenharmony_ci src/version.c) 1341cb0ef41Sopenharmony_ci 1351cb0ef41Sopenharmony_ciif(WIN32) 1361cb0ef41Sopenharmony_ci list(APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0602) 1371cb0ef41Sopenharmony_ci list(APPEND uv_libraries 1381cb0ef41Sopenharmony_ci psapi 1391cb0ef41Sopenharmony_ci user32 1401cb0ef41Sopenharmony_ci advapi32 1411cb0ef41Sopenharmony_ci iphlpapi 1421cb0ef41Sopenharmony_ci userenv 1431cb0ef41Sopenharmony_ci ws2_32) 1441cb0ef41Sopenharmony_ci list(APPEND uv_sources 1451cb0ef41Sopenharmony_ci src/win/async.c 1461cb0ef41Sopenharmony_ci src/win/core.c 1471cb0ef41Sopenharmony_ci src/win/detect-wakeup.c 1481cb0ef41Sopenharmony_ci src/win/dl.c 1491cb0ef41Sopenharmony_ci src/win/error.c 1501cb0ef41Sopenharmony_ci src/win/fs.c 1511cb0ef41Sopenharmony_ci src/win/fs-event.c 1521cb0ef41Sopenharmony_ci src/win/getaddrinfo.c 1531cb0ef41Sopenharmony_ci src/win/getnameinfo.c 1541cb0ef41Sopenharmony_ci src/win/handle.c 1551cb0ef41Sopenharmony_ci src/win/loop-watcher.c 1561cb0ef41Sopenharmony_ci src/win/pipe.c 1571cb0ef41Sopenharmony_ci src/win/thread.c 1581cb0ef41Sopenharmony_ci src/win/poll.c 1591cb0ef41Sopenharmony_ci src/win/process.c 1601cb0ef41Sopenharmony_ci src/win/process-stdio.c 1611cb0ef41Sopenharmony_ci src/win/signal.c 1621cb0ef41Sopenharmony_ci src/win/snprintf.c 1631cb0ef41Sopenharmony_ci src/win/stream.c 1641cb0ef41Sopenharmony_ci src/win/tcp.c 1651cb0ef41Sopenharmony_ci src/win/tty.c 1661cb0ef41Sopenharmony_ci src/win/udp.c 1671cb0ef41Sopenharmony_ci src/win/util.c 1681cb0ef41Sopenharmony_ci src/win/winapi.c 1691cb0ef41Sopenharmony_ci src/win/winsock.c) 1701cb0ef41Sopenharmony_ci list(APPEND uv_test_libraries ws2_32) 1711cb0ef41Sopenharmony_ci list(APPEND uv_test_sources src/win/snprintf.c test/runner-win.c) 1721cb0ef41Sopenharmony_cielse() 1731cb0ef41Sopenharmony_ci list(APPEND uv_defines _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE) 1741cb0ef41Sopenharmony_ci if(NOT CMAKE_SYSTEM_NAME MATCHES "Android|OS390|QNX") 1751cb0ef41Sopenharmony_ci # TODO: This should be replaced with find_package(Threads) if possible 1761cb0ef41Sopenharmony_ci # Android has pthread as part of its c library, not as a separate 1771cb0ef41Sopenharmony_ci # libpthread.so. 1781cb0ef41Sopenharmony_ci list(APPEND uv_libraries pthread) 1791cb0ef41Sopenharmony_ci endif() 1801cb0ef41Sopenharmony_ci list(APPEND uv_sources 1811cb0ef41Sopenharmony_ci src/unix/async.c 1821cb0ef41Sopenharmony_ci src/unix/core.c 1831cb0ef41Sopenharmony_ci src/unix/dl.c 1841cb0ef41Sopenharmony_ci src/unix/fs.c 1851cb0ef41Sopenharmony_ci src/unix/getaddrinfo.c 1861cb0ef41Sopenharmony_ci src/unix/getnameinfo.c 1871cb0ef41Sopenharmony_ci src/unix/loop-watcher.c 1881cb0ef41Sopenharmony_ci src/unix/loop.c 1891cb0ef41Sopenharmony_ci src/unix/pipe.c 1901cb0ef41Sopenharmony_ci src/unix/poll.c 1911cb0ef41Sopenharmony_ci src/unix/process.c 1921cb0ef41Sopenharmony_ci src/unix/random-devurandom.c 1931cb0ef41Sopenharmony_ci src/unix/signal.c 1941cb0ef41Sopenharmony_ci src/unix/stream.c 1951cb0ef41Sopenharmony_ci src/unix/tcp.c 1961cb0ef41Sopenharmony_ci src/unix/thread.c 1971cb0ef41Sopenharmony_ci src/unix/tty.c 1981cb0ef41Sopenharmony_ci src/unix/udp.c) 1991cb0ef41Sopenharmony_ci list(APPEND uv_test_sources test/runner-unix.c) 2001cb0ef41Sopenharmony_ciendif() 2011cb0ef41Sopenharmony_ci 2021cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "AIX") 2031cb0ef41Sopenharmony_ci list(APPEND uv_defines 2041cb0ef41Sopenharmony_ci _ALL_SOURCE 2051cb0ef41Sopenharmony_ci _LINUX_SOURCE_COMPAT 2061cb0ef41Sopenharmony_ci _THREAD_SAFE 2071cb0ef41Sopenharmony_ci _XOPEN_SOURCE=500 2081cb0ef41Sopenharmony_ci HAVE_SYS_AHAFS_EVPRODS_H) 2091cb0ef41Sopenharmony_ci list(APPEND uv_libraries perfstat) 2101cb0ef41Sopenharmony_ci list(APPEND uv_sources 2111cb0ef41Sopenharmony_ci src/unix/aix.c 2121cb0ef41Sopenharmony_ci src/unix/aix-common.c) 2131cb0ef41Sopenharmony_ciendif() 2141cb0ef41Sopenharmony_ci 2151cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "Android") 2161cb0ef41Sopenharmony_ci list(APPEND uv_defines _GNU_SOURCE) 2171cb0ef41Sopenharmony_ci list(APPEND uv_libraries dl) 2181cb0ef41Sopenharmony_ci list(APPEND uv_sources 2191cb0ef41Sopenharmony_ci src/unix/linux-core.c 2201cb0ef41Sopenharmony_ci src/unix/linux-inotify.c 2211cb0ef41Sopenharmony_ci src/unix/linux-syscalls.c 2221cb0ef41Sopenharmony_ci src/unix/procfs-exepath.c 2231cb0ef41Sopenharmony_ci src/unix/pthread-fixes.c 2241cb0ef41Sopenharmony_ci src/unix/random-getentropy.c 2251cb0ef41Sopenharmony_ci src/unix/random-getrandom.c 2261cb0ef41Sopenharmony_ci src/unix/random-sysctl-linux.c 2271cb0ef41Sopenharmony_ci src/unix/epoll.c) 2281cb0ef41Sopenharmony_ciendif() 2291cb0ef41Sopenharmony_ci 2301cb0ef41Sopenharmony_ciif(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux") 2311cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/proctitle.c) 2321cb0ef41Sopenharmony_ciendif() 2331cb0ef41Sopenharmony_ci 2341cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD") 2351cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/freebsd.c) 2361cb0ef41Sopenharmony_ciendif() 2371cb0ef41Sopenharmony_ci 2381cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") 2391cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/posix-hrtime.c src/unix/bsd-proctitle.c) 2401cb0ef41Sopenharmony_ciendif() 2411cb0ef41Sopenharmony_ci 2421cb0ef41Sopenharmony_ciif(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") 2431cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/bsd-ifaddrs.c src/unix/kqueue.c) 2441cb0ef41Sopenharmony_ciendif() 2451cb0ef41Sopenharmony_ci 2461cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") 2471cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/random-getrandom.c) 2481cb0ef41Sopenharmony_ciendif() 2491cb0ef41Sopenharmony_ci 2501cb0ef41Sopenharmony_ciif(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") 2511cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/random-getentropy.c) 2521cb0ef41Sopenharmony_ciendif() 2531cb0ef41Sopenharmony_ci 2541cb0ef41Sopenharmony_ciif(APPLE) 2551cb0ef41Sopenharmony_ci list(APPEND uv_defines _DARWIN_UNLIMITED_SELECT=1 _DARWIN_USE_64_BIT_INODE=1) 2561cb0ef41Sopenharmony_ci list(APPEND uv_sources 2571cb0ef41Sopenharmony_ci src/unix/darwin-proctitle.c 2581cb0ef41Sopenharmony_ci src/unix/darwin.c 2591cb0ef41Sopenharmony_ci src/unix/fsevents.c) 2601cb0ef41Sopenharmony_ciendif() 2611cb0ef41Sopenharmony_ci 2621cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "GNU") 2631cb0ef41Sopenharmony_ci list(APPEND uv_libraries dl) 2641cb0ef41Sopenharmony_ci list(APPEND uv_sources 2651cb0ef41Sopenharmony_ci src/unix/bsd-ifaddrs.c 2661cb0ef41Sopenharmony_ci src/unix/no-fsevents.c 2671cb0ef41Sopenharmony_ci src/unix/no-proctitle.c 2681cb0ef41Sopenharmony_ci src/unix/posix-hrtime.c 2691cb0ef41Sopenharmony_ci src/unix/posix-poll.c 2701cb0ef41Sopenharmony_ci src/unix/hurd.c) 2711cb0ef41Sopenharmony_ciendif() 2721cb0ef41Sopenharmony_ci 2731cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD") 2741cb0ef41Sopenharmony_ci list(APPEND uv_defines _GNU_SOURCE) 2751cb0ef41Sopenharmony_ci list(APPEND uv_libraries dl freebsd-glue) 2761cb0ef41Sopenharmony_ciendif() 2771cb0ef41Sopenharmony_ci 2781cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "Linux") 2791cb0ef41Sopenharmony_ci list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) 2801cb0ef41Sopenharmony_ci list(APPEND uv_libraries dl rt) 2811cb0ef41Sopenharmony_ci list(APPEND uv_sources 2821cb0ef41Sopenharmony_ci src/unix/linux-core.c 2831cb0ef41Sopenharmony_ci src/unix/linux-inotify.c 2841cb0ef41Sopenharmony_ci src/unix/linux-syscalls.c 2851cb0ef41Sopenharmony_ci src/unix/procfs-exepath.c 2861cb0ef41Sopenharmony_ci src/unix/random-getrandom.c 2871cb0ef41Sopenharmony_ci src/unix/random-sysctl-linux.c 2881cb0ef41Sopenharmony_ci src/unix/epoll.c) 2891cb0ef41Sopenharmony_ciendif() 2901cb0ef41Sopenharmony_ci 2911cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") 2921cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/netbsd.c) 2931cb0ef41Sopenharmony_ci list(APPEND uv_libraries kvm) 2941cb0ef41Sopenharmony_ciendif() 2951cb0ef41Sopenharmony_ci 2961cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") 2971cb0ef41Sopenharmony_ci list(APPEND uv_sources src/unix/openbsd.c) 2981cb0ef41Sopenharmony_ciendif() 2991cb0ef41Sopenharmony_ci 3001cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "OS390") 3011cb0ef41Sopenharmony_ci enable_language(CXX) 3021cb0ef41Sopenharmony_ci list(APPEND uv_defines PATH_MAX=1024) 3031cb0ef41Sopenharmony_ci list(APPEND uv_defines _AE_BIMODAL) 3041cb0ef41Sopenharmony_ci list(APPEND uv_defines _ALL_SOURCE) 3051cb0ef41Sopenharmony_ci list(APPEND uv_defines _ENHANCED_ASCII_EXT=0xFFFFFFFF) 3061cb0ef41Sopenharmony_ci list(APPEND uv_defines _ISOC99_SOURCE) 3071cb0ef41Sopenharmony_ci list(APPEND uv_defines _LARGE_TIME_API) 3081cb0ef41Sopenharmony_ci list(APPEND uv_defines _OPEN_MSGQ_EXT) 3091cb0ef41Sopenharmony_ci list(APPEND uv_defines _OPEN_SYS_FILE_EXT) 3101cb0ef41Sopenharmony_ci list(APPEND uv_defines _OPEN_SYS_IF_EXT) 3111cb0ef41Sopenharmony_ci list(APPEND uv_defines _OPEN_SYS_SOCK_EXT3) 3121cb0ef41Sopenharmony_ci list(APPEND uv_defines _OPEN_SYS_SOCK_IPV6) 3131cb0ef41Sopenharmony_ci list(APPEND uv_defines _UNIX03_SOURCE) 3141cb0ef41Sopenharmony_ci list(APPEND uv_defines _UNIX03_THREADS) 3151cb0ef41Sopenharmony_ci list(APPEND uv_defines _UNIX03_WITHDRAWN) 3161cb0ef41Sopenharmony_ci list(APPEND uv_defines _XOPEN_SOURCE=600) 3171cb0ef41Sopenharmony_ci list(APPEND uv_defines _XOPEN_SOURCE_EXTENDED) 3181cb0ef41Sopenharmony_ci list(APPEND uv_sources 3191cb0ef41Sopenharmony_ci src/unix/pthread-fixes.c 3201cb0ef41Sopenharmony_ci src/unix/os390.c 3211cb0ef41Sopenharmony_ci src/unix/os390-syscalls.c 3221cb0ef41Sopenharmony_ci src/unix/os390-proctitle.c) 3231cb0ef41Sopenharmony_ci list(APPEND uv_cflags 3241cb0ef41Sopenharmony_ci -q64 3251cb0ef41Sopenharmony_ci -qascii 3261cb0ef41Sopenharmony_ci -qexportall 3271cb0ef41Sopenharmony_ci -qgonumber 3281cb0ef41Sopenharmony_ci -qlongname 3291cb0ef41Sopenharmony_ci -qlibansi 3301cb0ef41Sopenharmony_ci -qfloat=IEEE 3311cb0ef41Sopenharmony_ci -qtune=10 3321cb0ef41Sopenharmony_ci -qarch=10 3331cb0ef41Sopenharmony_ci -qasm 3341cb0ef41Sopenharmony_ci -qasmlib=sys1.maclib:sys1.modgen) 3351cb0ef41Sopenharmony_ci find_library(ZOSLIB 3361cb0ef41Sopenharmony_ci NAMES zoslib 3371cb0ef41Sopenharmony_ci PATHS ${ZOSLIB_DIR} 3381cb0ef41Sopenharmony_ci PATH_SUFFIXES lib 3391cb0ef41Sopenharmony_ci ) 3401cb0ef41Sopenharmony_ci list(APPEND uv_libraries ${ZOSLIB}) 3411cb0ef41Sopenharmony_ciendif() 3421cb0ef41Sopenharmony_ci 3431cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "OS400") 3441cb0ef41Sopenharmony_ci list(APPEND uv_defines 3451cb0ef41Sopenharmony_ci _ALL_SOURCE 3461cb0ef41Sopenharmony_ci _LINUX_SOURCE_COMPAT 3471cb0ef41Sopenharmony_ci _THREAD_SAFE 3481cb0ef41Sopenharmony_ci _XOPEN_SOURCE=500) 3491cb0ef41Sopenharmony_ci list(APPEND uv_sources 3501cb0ef41Sopenharmony_ci src/unix/aix-common.c 3511cb0ef41Sopenharmony_ci src/unix/ibmi.c 3521cb0ef41Sopenharmony_ci src/unix/no-fsevents.c 3531cb0ef41Sopenharmony_ci src/unix/posix-poll.c) 3541cb0ef41Sopenharmony_ciendif() 3551cb0ef41Sopenharmony_ci 3561cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "SunOS") 3571cb0ef41Sopenharmony_ci list(APPEND uv_defines __EXTENSIONS__ _XOPEN_SOURCE=500 _REENTRANT) 3581cb0ef41Sopenharmony_ci list(APPEND uv_libraries kstat nsl sendfile socket) 3591cb0ef41Sopenharmony_ci list(APPEND uv_sources 3601cb0ef41Sopenharmony_ci src/unix/no-proctitle.c 3611cb0ef41Sopenharmony_ci src/unix/sunos.c) 3621cb0ef41Sopenharmony_ciendif() 3631cb0ef41Sopenharmony_ci 3641cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "Haiku") 3651cb0ef41Sopenharmony_ci list(APPEND uv_defines _BSD_SOURCE) 3661cb0ef41Sopenharmony_ci list(APPEND uv_libraries bsd network) 3671cb0ef41Sopenharmony_ci list(APPEND uv_sources 3681cb0ef41Sopenharmony_ci src/unix/haiku.c 3691cb0ef41Sopenharmony_ci src/unix/bsd-ifaddrs.c 3701cb0ef41Sopenharmony_ci src/unix/no-fsevents.c 3711cb0ef41Sopenharmony_ci src/unix/no-proctitle.c 3721cb0ef41Sopenharmony_ci src/unix/posix-hrtime.c 3731cb0ef41Sopenharmony_ci src/unix/posix-poll.c) 3741cb0ef41Sopenharmony_ciendif() 3751cb0ef41Sopenharmony_ci 3761cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "QNX") 3771cb0ef41Sopenharmony_ci list(APPEND uv_sources 3781cb0ef41Sopenharmony_ci src/unix/posix-hrtime.c 3791cb0ef41Sopenharmony_ci src/unix/posix-poll.c 3801cb0ef41Sopenharmony_ci src/unix/qnx.c 3811cb0ef41Sopenharmony_ci src/unix/bsd-ifaddrs.c 3821cb0ef41Sopenharmony_ci src/unix/no-proctitle.c 3831cb0ef41Sopenharmony_ci src/unix/no-fsevents.c) 3841cb0ef41Sopenharmony_ci list(APPEND uv_libraries socket) 3851cb0ef41Sopenharmony_ciendif() 3861cb0ef41Sopenharmony_ci 3871cb0ef41Sopenharmony_ciif(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") 3881cb0ef41Sopenharmony_ci list(APPEND uv_test_libraries util) 3891cb0ef41Sopenharmony_ciendif() 3901cb0ef41Sopenharmony_ci 3911cb0ef41Sopenharmony_ciadd_library(uv SHARED ${uv_sources}) 3921cb0ef41Sopenharmony_citarget_compile_definitions(uv 3931cb0ef41Sopenharmony_ci INTERFACE 3941cb0ef41Sopenharmony_ci USING_UV_SHARED=1 3951cb0ef41Sopenharmony_ci PRIVATE 3961cb0ef41Sopenharmony_ci BUILDING_UV_SHARED=1 3971cb0ef41Sopenharmony_ci ${uv_defines}) 3981cb0ef41Sopenharmony_citarget_compile_options(uv PRIVATE ${uv_cflags}) 3991cb0ef41Sopenharmony_citarget_include_directories(uv 4001cb0ef41Sopenharmony_ci PUBLIC 4011cb0ef41Sopenharmony_ci $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> 4021cb0ef41Sopenharmony_ci $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> 4031cb0ef41Sopenharmony_ci PRIVATE 4041cb0ef41Sopenharmony_ci $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>) 4051cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "OS390") 4061cb0ef41Sopenharmony_ci target_include_directories(uv PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>) 4071cb0ef41Sopenharmony_ci set_target_properties(uv PROPERTIES LINKER_LANGUAGE CXX) 4081cb0ef41Sopenharmony_ciendif() 4091cb0ef41Sopenharmony_citarget_link_libraries(uv ${uv_libraries}) 4101cb0ef41Sopenharmony_ci 4111cb0ef41Sopenharmony_ciadd_library(uv_a STATIC ${uv_sources}) 4121cb0ef41Sopenharmony_citarget_compile_definitions(uv_a PRIVATE ${uv_defines}) 4131cb0ef41Sopenharmony_citarget_compile_options(uv_a PRIVATE ${uv_cflags}) 4141cb0ef41Sopenharmony_citarget_include_directories(uv_a 4151cb0ef41Sopenharmony_ci PUBLIC 4161cb0ef41Sopenharmony_ci $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> 4171cb0ef41Sopenharmony_ci $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> 4181cb0ef41Sopenharmony_ci PRIVATE 4191cb0ef41Sopenharmony_ci $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>) 4201cb0ef41Sopenharmony_ciif(CMAKE_SYSTEM_NAME STREQUAL "OS390") 4211cb0ef41Sopenharmony_ci target_include_directories(uv_a PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>) 4221cb0ef41Sopenharmony_ci set_target_properties(uv_a PROPERTIES LINKER_LANGUAGE CXX) 4231cb0ef41Sopenharmony_ciendif() 4241cb0ef41Sopenharmony_citarget_link_libraries(uv_a ${uv_libraries}) 4251cb0ef41Sopenharmony_ci 4261cb0ef41Sopenharmony_ciif(LIBUV_BUILD_TESTS) 4271cb0ef41Sopenharmony_ci # Small hack: use ${uv_test_sources} now to get the runner skeleton, 4281cb0ef41Sopenharmony_ci # before the actual tests are added. 4291cb0ef41Sopenharmony_ci add_executable( 4301cb0ef41Sopenharmony_ci uv_run_benchmarks_a 4311cb0ef41Sopenharmony_ci ${uv_test_sources} 4321cb0ef41Sopenharmony_ci test/benchmark-async-pummel.c 4331cb0ef41Sopenharmony_ci test/benchmark-async.c 4341cb0ef41Sopenharmony_ci test/benchmark-fs-stat.c 4351cb0ef41Sopenharmony_ci test/benchmark-getaddrinfo.c 4361cb0ef41Sopenharmony_ci test/benchmark-loop-count.c 4371cb0ef41Sopenharmony_ci test/benchmark-queue-work.c 4381cb0ef41Sopenharmony_ci test/benchmark-million-async.c 4391cb0ef41Sopenharmony_ci test/benchmark-million-timers.c 4401cb0ef41Sopenharmony_ci test/benchmark-multi-accept.c 4411cb0ef41Sopenharmony_ci test/benchmark-ping-pongs.c 4421cb0ef41Sopenharmony_ci test/benchmark-ping-udp.c 4431cb0ef41Sopenharmony_ci test/benchmark-pound.c 4441cb0ef41Sopenharmony_ci test/benchmark-pump.c 4451cb0ef41Sopenharmony_ci test/benchmark-sizes.c 4461cb0ef41Sopenharmony_ci test/benchmark-spawn.c 4471cb0ef41Sopenharmony_ci test/benchmark-tcp-write-batch.c 4481cb0ef41Sopenharmony_ci test/benchmark-thread.c 4491cb0ef41Sopenharmony_ci test/benchmark-udp-pummel.c 4501cb0ef41Sopenharmony_ci test/blackhole-server.c 4511cb0ef41Sopenharmony_ci test/echo-server.c 4521cb0ef41Sopenharmony_ci test/run-benchmarks.c 4531cb0ef41Sopenharmony_ci test/runner.c) 4541cb0ef41Sopenharmony_ci target_compile_definitions(uv_run_benchmarks_a PRIVATE ${uv_defines}) 4551cb0ef41Sopenharmony_ci target_compile_options(uv_run_benchmarks_a PRIVATE ${uv_cflags}) 4561cb0ef41Sopenharmony_ci target_link_libraries(uv_run_benchmarks_a uv_a ${uv_test_libraries}) 4571cb0ef41Sopenharmony_ci 4581cb0ef41Sopenharmony_ci list(APPEND uv_test_sources 4591cb0ef41Sopenharmony_ci test/blackhole-server.c 4601cb0ef41Sopenharmony_ci test/echo-server.c 4611cb0ef41Sopenharmony_ci test/run-tests.c 4621cb0ef41Sopenharmony_ci test/runner.c 4631cb0ef41Sopenharmony_ci test/test-active.c 4641cb0ef41Sopenharmony_ci test/test-async-null-cb.c 4651cb0ef41Sopenharmony_ci test/test-async.c 4661cb0ef41Sopenharmony_ci test/test-barrier.c 4671cb0ef41Sopenharmony_ci test/test-callback-stack.c 4681cb0ef41Sopenharmony_ci test/test-close-fd.c 4691cb0ef41Sopenharmony_ci test/test-close-order.c 4701cb0ef41Sopenharmony_ci test/test-condvar.c 4711cb0ef41Sopenharmony_ci test/test-connect-unspecified.c 4721cb0ef41Sopenharmony_ci test/test-connection-fail.c 4731cb0ef41Sopenharmony_ci test/test-cwd-and-chdir.c 4741cb0ef41Sopenharmony_ci test/test-default-loop-close.c 4751cb0ef41Sopenharmony_ci test/test-delayed-accept.c 4761cb0ef41Sopenharmony_ci test/test-dlerror.c 4771cb0ef41Sopenharmony_ci test/test-eintr-handling.c 4781cb0ef41Sopenharmony_ci test/test-embed.c 4791cb0ef41Sopenharmony_ci test/test-emfile.c 4801cb0ef41Sopenharmony_ci test/test-env-vars.c 4811cb0ef41Sopenharmony_ci test/test-error.c 4821cb0ef41Sopenharmony_ci test/test-fail-always.c 4831cb0ef41Sopenharmony_ci test/test-fork.c 4841cb0ef41Sopenharmony_ci test/test-fs-copyfile.c 4851cb0ef41Sopenharmony_ci test/test-fs-event.c 4861cb0ef41Sopenharmony_ci test/test-fs-poll.c 4871cb0ef41Sopenharmony_ci test/test-fs.c 4881cb0ef41Sopenharmony_ci test/test-fs-readdir.c 4891cb0ef41Sopenharmony_ci test/test-fs-fd-hash.c 4901cb0ef41Sopenharmony_ci test/test-fs-open-flags.c 4911cb0ef41Sopenharmony_ci test/test-get-currentexe.c 4921cb0ef41Sopenharmony_ci test/test-get-loadavg.c 4931cb0ef41Sopenharmony_ci test/test-get-memory.c 4941cb0ef41Sopenharmony_ci test/test-get-passwd.c 4951cb0ef41Sopenharmony_ci test/test-getaddrinfo.c 4961cb0ef41Sopenharmony_ci test/test-gethostname.c 4971cb0ef41Sopenharmony_ci test/test-getnameinfo.c 4981cb0ef41Sopenharmony_ci test/test-getsockname.c 4991cb0ef41Sopenharmony_ci test/test-getters-setters.c 5001cb0ef41Sopenharmony_ci test/test-gettimeofday.c 5011cb0ef41Sopenharmony_ci test/test-handle-fileno.c 5021cb0ef41Sopenharmony_ci test/test-homedir.c 5031cb0ef41Sopenharmony_ci test/test-hrtime.c 5041cb0ef41Sopenharmony_ci test/test-idle.c 5051cb0ef41Sopenharmony_ci test/test-idna.c 5061cb0ef41Sopenharmony_ci test/test-ip4-addr.c 5071cb0ef41Sopenharmony_ci test/test-ip6-addr.c 5081cb0ef41Sopenharmony_ci test/test-ip-name.c 5091cb0ef41Sopenharmony_ci test/test-ipc-heavy-traffic-deadlock-bug.c 5101cb0ef41Sopenharmony_ci test/test-ipc-send-recv.c 5111cb0ef41Sopenharmony_ci test/test-ipc.c 5121cb0ef41Sopenharmony_ci test/test-loop-alive.c 5131cb0ef41Sopenharmony_ci test/test-loop-close.c 5141cb0ef41Sopenharmony_ci test/test-loop-configure.c 5151cb0ef41Sopenharmony_ci test/test-loop-handles.c 5161cb0ef41Sopenharmony_ci test/test-loop-stop.c 5171cb0ef41Sopenharmony_ci test/test-loop-time.c 5181cb0ef41Sopenharmony_ci test/test-metrics.c 5191cb0ef41Sopenharmony_ci test/test-multiple-listen.c 5201cb0ef41Sopenharmony_ci test/test-mutexes.c 5211cb0ef41Sopenharmony_ci test/test-not-readable-nor-writable-on-read-error.c 5221cb0ef41Sopenharmony_ci test/test-not-writable-after-shutdown.c 5231cb0ef41Sopenharmony_ci test/test-osx-select.c 5241cb0ef41Sopenharmony_ci test/test-pass-always.c 5251cb0ef41Sopenharmony_ci test/test-ping-pong.c 5261cb0ef41Sopenharmony_ci test/test-pipe-bind-error.c 5271cb0ef41Sopenharmony_ci test/test-pipe-close-stdout-read-stdin.c 5281cb0ef41Sopenharmony_ci test/test-pipe-connect-error.c 5291cb0ef41Sopenharmony_ci test/test-pipe-connect-multiple.c 5301cb0ef41Sopenharmony_ci test/test-pipe-connect-prepare.c 5311cb0ef41Sopenharmony_ci test/test-pipe-getsockname.c 5321cb0ef41Sopenharmony_ci test/test-pipe-pending-instances.c 5331cb0ef41Sopenharmony_ci test/test-pipe-sendmsg.c 5341cb0ef41Sopenharmony_ci test/test-pipe-server-close.c 5351cb0ef41Sopenharmony_ci test/test-pipe-set-fchmod.c 5361cb0ef41Sopenharmony_ci test/test-pipe-set-non-blocking.c 5371cb0ef41Sopenharmony_ci test/test-platform-output.c 5381cb0ef41Sopenharmony_ci test/test-poll-close-doesnt-corrupt-stack.c 5391cb0ef41Sopenharmony_ci test/test-poll-close.c 5401cb0ef41Sopenharmony_ci test/test-poll-closesocket.c 5411cb0ef41Sopenharmony_ci test/test-poll-multiple-handles.c 5421cb0ef41Sopenharmony_ci test/test-poll-oob.c 5431cb0ef41Sopenharmony_ci test/test-poll.c 5441cb0ef41Sopenharmony_ci test/test-process-priority.c 5451cb0ef41Sopenharmony_ci test/test-process-title-threadsafe.c 5461cb0ef41Sopenharmony_ci test/test-process-title.c 5471cb0ef41Sopenharmony_ci test/test-queue-foreach-delete.c 5481cb0ef41Sopenharmony_ci test/test-random.c 5491cb0ef41Sopenharmony_ci test/test-readable-on-eof.c 5501cb0ef41Sopenharmony_ci test/test-ref.c 5511cb0ef41Sopenharmony_ci test/test-run-nowait.c 5521cb0ef41Sopenharmony_ci test/test-run-once.c 5531cb0ef41Sopenharmony_ci test/test-semaphore.c 5541cb0ef41Sopenharmony_ci test/test-shutdown-close.c 5551cb0ef41Sopenharmony_ci test/test-shutdown-eof.c 5561cb0ef41Sopenharmony_ci test/test-shutdown-simultaneous.c 5571cb0ef41Sopenharmony_ci test/test-shutdown-twice.c 5581cb0ef41Sopenharmony_ci test/test-signal-multiple-loops.c 5591cb0ef41Sopenharmony_ci test/test-signal-pending-on-close.c 5601cb0ef41Sopenharmony_ci test/test-signal.c 5611cb0ef41Sopenharmony_ci test/test-socket-buffer-size.c 5621cb0ef41Sopenharmony_ci test/test-spawn.c 5631cb0ef41Sopenharmony_ci test/test-stdio-over-pipes.c 5641cb0ef41Sopenharmony_ci test/test-strscpy.c 5651cb0ef41Sopenharmony_ci test/test-strtok.c 5661cb0ef41Sopenharmony_ci test/test-tcp-alloc-cb-fail.c 5671cb0ef41Sopenharmony_ci test/test-tcp-bind-error.c 5681cb0ef41Sopenharmony_ci test/test-tcp-bind6-error.c 5691cb0ef41Sopenharmony_ci test/test-tcp-close-accept.c 5701cb0ef41Sopenharmony_ci test/test-tcp-close-after-read-timeout.c 5711cb0ef41Sopenharmony_ci test/test-tcp-close-while-connecting.c 5721cb0ef41Sopenharmony_ci test/test-tcp-close.c 5731cb0ef41Sopenharmony_ci test/test-tcp-close-reset.c 5741cb0ef41Sopenharmony_ci test/test-tcp-connect-error-after-write.c 5751cb0ef41Sopenharmony_ci test/test-tcp-connect-error.c 5761cb0ef41Sopenharmony_ci test/test-tcp-connect-timeout.c 5771cb0ef41Sopenharmony_ci test/test-tcp-connect6-error.c 5781cb0ef41Sopenharmony_ci test/test-tcp-create-socket-early.c 5791cb0ef41Sopenharmony_ci test/test-tcp-flags.c 5801cb0ef41Sopenharmony_ci test/test-tcp-oob.c 5811cb0ef41Sopenharmony_ci test/test-tcp-open.c 5821cb0ef41Sopenharmony_ci test/test-tcp-read-stop.c 5831cb0ef41Sopenharmony_ci test/test-tcp-read-stop-start.c 5841cb0ef41Sopenharmony_ci test/test-tcp-rst.c 5851cb0ef41Sopenharmony_ci test/test-tcp-shutdown-after-write.c 5861cb0ef41Sopenharmony_ci test/test-tcp-try-write.c 5871cb0ef41Sopenharmony_ci test/test-tcp-try-write-error.c 5881cb0ef41Sopenharmony_ci test/test-tcp-unexpected-read.c 5891cb0ef41Sopenharmony_ci test/test-tcp-write-after-connect.c 5901cb0ef41Sopenharmony_ci test/test-tcp-write-fail.c 5911cb0ef41Sopenharmony_ci test/test-tcp-write-queue-order.c 5921cb0ef41Sopenharmony_ci test/test-tcp-write-to-half-open-connection.c 5931cb0ef41Sopenharmony_ci test/test-tcp-writealot.c 5941cb0ef41Sopenharmony_ci test/test-test-macros.c 5951cb0ef41Sopenharmony_ci test/test-thread-equal.c 5961cb0ef41Sopenharmony_ci test/test-thread.c 5971cb0ef41Sopenharmony_ci test/test-threadpool-cancel.c 5981cb0ef41Sopenharmony_ci test/test-threadpool.c 5991cb0ef41Sopenharmony_ci test/test-timer-again.c 6001cb0ef41Sopenharmony_ci test/test-timer-from-check.c 6011cb0ef41Sopenharmony_ci test/test-timer.c 6021cb0ef41Sopenharmony_ci test/test-tmpdir.c 6031cb0ef41Sopenharmony_ci test/test-tty-duplicate-key.c 6041cb0ef41Sopenharmony_ci test/test-tty-escape-sequence-processing.c 6051cb0ef41Sopenharmony_ci test/test-tty.c 6061cb0ef41Sopenharmony_ci test/test-udp-alloc-cb-fail.c 6071cb0ef41Sopenharmony_ci test/test-udp-bind.c 6081cb0ef41Sopenharmony_ci test/test-udp-connect.c 6091cb0ef41Sopenharmony_ci test/test-udp-connect6.c 6101cb0ef41Sopenharmony_ci test/test-udp-create-socket-early.c 6111cb0ef41Sopenharmony_ci test/test-udp-dgram-too-big.c 6121cb0ef41Sopenharmony_ci test/test-udp-ipv6.c 6131cb0ef41Sopenharmony_ci test/test-udp-mmsg.c 6141cb0ef41Sopenharmony_ci test/test-udp-multicast-interface.c 6151cb0ef41Sopenharmony_ci test/test-udp-multicast-interface6.c 6161cb0ef41Sopenharmony_ci test/test-udp-multicast-join.c 6171cb0ef41Sopenharmony_ci test/test-udp-multicast-join6.c 6181cb0ef41Sopenharmony_ci test/test-udp-multicast-ttl.c 6191cb0ef41Sopenharmony_ci test/test-udp-open.c 6201cb0ef41Sopenharmony_ci test/test-udp-options.c 6211cb0ef41Sopenharmony_ci test/test-udp-send-and-recv.c 6221cb0ef41Sopenharmony_ci test/test-udp-send-hang-loop.c 6231cb0ef41Sopenharmony_ci test/test-udp-send-immediate.c 6241cb0ef41Sopenharmony_ci test/test-udp-sendmmsg-error.c 6251cb0ef41Sopenharmony_ci test/test-udp-send-unreachable.c 6261cb0ef41Sopenharmony_ci test/test-udp-try-send.c 6271cb0ef41Sopenharmony_ci test/test-uname.c 6281cb0ef41Sopenharmony_ci test/test-walk-handles.c 6291cb0ef41Sopenharmony_ci test/test-watcher-cross-stop.c) 6301cb0ef41Sopenharmony_ci 6311cb0ef41Sopenharmony_ci add_executable(uv_run_tests ${uv_test_sources} uv_win_longpath.manifest) 6321cb0ef41Sopenharmony_ci target_compile_definitions(uv_run_tests 6331cb0ef41Sopenharmony_ci PRIVATE ${uv_defines} USING_UV_SHARED=1) 6341cb0ef41Sopenharmony_ci target_compile_options(uv_run_tests PRIVATE ${uv_cflags}) 6351cb0ef41Sopenharmony_ci target_link_libraries(uv_run_tests uv ${uv_test_libraries}) 6361cb0ef41Sopenharmony_ci add_test(NAME uv_test 6371cb0ef41Sopenharmony_ci COMMAND uv_run_tests 6381cb0ef41Sopenharmony_ci WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 6391cb0ef41Sopenharmony_ci if(CMAKE_SYSTEM_NAME STREQUAL "OS390") 6401cb0ef41Sopenharmony_ci set_tests_properties(uv_test PROPERTIES ENVIRONMENT 6411cb0ef41Sopenharmony_ci "LIBPATH=${CMAKE_BINARY_DIR}:$ENV{LIBPATH}") 6421cb0ef41Sopenharmony_ci endif() 6431cb0ef41Sopenharmony_ci add_executable(uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest) 6441cb0ef41Sopenharmony_ci target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines}) 6451cb0ef41Sopenharmony_ci target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags}) 6461cb0ef41Sopenharmony_ci if(QEMU) 6471cb0ef41Sopenharmony_ci target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries} -static) 6481cb0ef41Sopenharmony_ci else() 6491cb0ef41Sopenharmony_ci target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries}) 6501cb0ef41Sopenharmony_ci endif() 6511cb0ef41Sopenharmony_ci add_test(NAME uv_test_a 6521cb0ef41Sopenharmony_ci COMMAND uv_run_tests_a 6531cb0ef41Sopenharmony_ci WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 6541cb0ef41Sopenharmony_ci if(CMAKE_SYSTEM_NAME STREQUAL "OS390") 6551cb0ef41Sopenharmony_ci set_target_properties(uv_run_benchmarks_a PROPERTIES LINKER_LANGUAGE CXX) 6561cb0ef41Sopenharmony_ci set_target_properties(uv_run_tests PROPERTIES LINKER_LANGUAGE CXX) 6571cb0ef41Sopenharmony_ci set_target_properties(uv_run_tests_a PROPERTIES LINKER_LANGUAGE CXX) 6581cb0ef41Sopenharmony_ci endif() 6591cb0ef41Sopenharmony_ciendif() 6601cb0ef41Sopenharmony_ci 6611cb0ef41Sopenharmony_ci# Now for some gibbering horrors from beyond the stars... 6621cb0ef41Sopenharmony_ciforeach(lib IN LISTS uv_libraries) 6631cb0ef41Sopenharmony_ci list(APPEND LIBS "-l${lib}") 6641cb0ef41Sopenharmony_ciendforeach() 6651cb0ef41Sopenharmony_cistring(REPLACE ";" " " LIBS "${LIBS}") 6661cb0ef41Sopenharmony_ci# Consider setting project version via project() call? 6671cb0ef41Sopenharmony_cifile(STRINGS configure.ac configure_ac REGEX ^AC_INIT) 6681cb0ef41Sopenharmony_cistring(REGEX MATCH "([0-9]+)[.][0-9]+[.][0-9]+" PACKAGE_VERSION "${configure_ac}") 6691cb0ef41Sopenharmony_ciset(UV_VERSION_MAJOR "${CMAKE_MATCH_1}") 6701cb0ef41Sopenharmony_ci# The version in the filename is mirroring the behaviour of autotools. 6711cb0ef41Sopenharmony_ciset_target_properties(uv PROPERTIES 6721cb0ef41Sopenharmony_ci VERSION ${UV_VERSION_MAJOR}.0.0 6731cb0ef41Sopenharmony_ci SOVERSION ${UV_VERSION_MAJOR}) 6741cb0ef41Sopenharmony_ciset(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) 6751cb0ef41Sopenharmony_ciset(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) 6761cb0ef41Sopenharmony_ciset(prefix ${CMAKE_INSTALL_PREFIX}) 6771cb0ef41Sopenharmony_ciconfigure_file(libuv.pc.in libuv.pc @ONLY) 6781cb0ef41Sopenharmony_ciconfigure_file(libuv-static.pc.in libuv-static.pc @ONLY) 6791cb0ef41Sopenharmony_ci 6801cb0ef41Sopenharmony_ciinstall(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 6811cb0ef41Sopenharmony_ciinstall(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) 6821cb0ef41Sopenharmony_ciinstall(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.pc 6831cb0ef41Sopenharmony_ci DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) 6841cb0ef41Sopenharmony_ciinstall(TARGETS uv EXPORT libuvConfig 6851cb0ef41Sopenharmony_ci RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 6861cb0ef41Sopenharmony_ci LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 6871cb0ef41Sopenharmony_ci ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 6881cb0ef41Sopenharmony_ciinstall(TARGETS uv_a EXPORT libuvConfig 6891cb0ef41Sopenharmony_ci ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) 6901cb0ef41Sopenharmony_ciinstall(EXPORT libuvConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv) 6911cb0ef41Sopenharmony_ci 6921cb0ef41Sopenharmony_ciif(MSVC) 6931cb0ef41Sopenharmony_ci set(CMAKE_DEBUG_POSTFIX d) 6941cb0ef41Sopenharmony_ciendif() 6951cb0ef41Sopenharmony_ci 6961cb0ef41Sopenharmony_cimessage(STATUS "summary of build options: 6971cb0ef41Sopenharmony_ci Install prefix: ${CMAKE_INSTALL_PREFIX} 6981cb0ef41Sopenharmony_ci Target system: ${CMAKE_SYSTEM_NAME} 6991cb0ef41Sopenharmony_ci Compiler: 7001cb0ef41Sopenharmony_ci C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}) 7011cb0ef41Sopenharmony_ci CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS} 7021cb0ef41Sopenharmony_ci") 703