2020-09-22 19:04:15 +00:00
|
|
|
if(NOT ANDROID)
|
|
|
|
if(NOT UNIX)
|
|
|
|
return()
|
|
|
|
endif()
|
2019-07-21 23:39:56 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-21 11:51:04 +00:00
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
2020-05-21 14:18:23 +00:00
|
|
|
if(WITH_JEMALLOC)
|
|
|
|
find_package(Jemalloc REQUIRED)
|
|
|
|
if(NOT JEMALLOC_FOUND)
|
|
|
|
message(FATAL_ERROR "did not find jemalloc")
|
|
|
|
endif()
|
|
|
|
add_definitions(-DUSE_JEMALLOC)
|
|
|
|
message(STATUS "using jemalloc")
|
|
|
|
endif()
|
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
add_definitions(-DUNIX)
|
|
|
|
add_definitions(-DPOSIX)
|
2019-04-29 23:48:43 +00:00
|
|
|
|
2019-09-18 20:19:13 +00:00
|
|
|
if (STATIC_LINK_RUNTIME OR STATIC_LINK)
|
2019-07-13 13:05:00 +00:00
|
|
|
set(LIBUV_USE_STATIC ON)
|
2019-07-01 09:33:03 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-21 11:51:04 +00:00
|
|
|
|
|
|
|
option(DOWNLOAD_UV "statically compile in libuv" OFF)
|
|
|
|
# Allow -DDOWNLOAD_UV=FORCE to download without even checking for a local libuv
|
|
|
|
if(NOT DOWNLOAD_UV STREQUAL "FORCE")
|
|
|
|
find_package(LibUV 1.28.0)
|
|
|
|
endif()
|
|
|
|
if(LibUV_FOUND)
|
|
|
|
message(STATUS "using system libuv")
|
|
|
|
elseif(DOWNLOAD_UV)
|
|
|
|
message(STATUS "using libuv submodule")
|
|
|
|
set(LIBUV_ROOT ${CMAKE_SOURCE_DIR}/external/libuv)
|
2019-07-24 15:25:40 +00:00
|
|
|
add_subdirectory(${LIBUV_ROOT})
|
|
|
|
set(LIBUV_INCLUDE_DIRS ${LIBUV_ROOT}/include)
|
|
|
|
set(LIBUV_LIBRARY uv_a)
|
2020-09-22 19:04:15 +00:00
|
|
|
if(NOT ANDROID)
|
|
|
|
add_definitions(-D_LARGEFILE_SOURCE)
|
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64)
|
|
|
|
endif()
|
2019-07-24 15:25:40 +00:00
|
|
|
endif()
|
2019-12-23 07:15:51 +00:00
|
|
|
include_directories(${LIBUV_INCLUDE_DIRS})
|
2019-07-13 13:05:00 +00:00
|
|
|
|
2019-08-29 13:59:04 +00:00
|
|
|
if(EMBEDDED_CFG OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2019-08-27 13:47:44 +00:00
|
|
|
link_libatomic()
|
|
|
|
endif()
|
|
|
|
|
2020-05-17 19:41:48 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
2020-02-17 23:01:37 +00:00
|
|
|
add_definitions(-D_BSD_SOURCE)
|
|
|
|
add_definitions(-D_GNU_SOURCE)
|
|
|
|
add_definitions(-D_XOPEN_SOURCE=700)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
2019-08-27 13:47:44 +00:00
|
|
|
if (LIBUV_USE_STATIC)
|
|
|
|
link_libraries(-lkstat -lsendfile)
|
|
|
|
endif()
|
2019-04-28 15:57:41 +00:00
|
|
|
endif()
|