2019-07-21 23:39:56 +00:00
|
|
|
if(NOT UNIX)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2019-08-17 12:20:16 +00:00
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
2019-12-23 06:52:23 +00:00
|
|
|
# can't have UNIX defined
|
|
|
|
# can't have the include paths for libuv either?
|
|
|
|
if(NOT IOS AND NOT ANDROID AND NOT WIN32)
|
|
|
|
if(LIBCURL_ROOT)
|
|
|
|
option(HTTP_ONLY "" ON)
|
|
|
|
option(SSL_ENABLED "" OFF)
|
|
|
|
option(BUILD_SHARED_LIBS "" OFF)
|
|
|
|
option(ENABLE_IPV6 "" OFF)
|
|
|
|
option(CMAKE_USE_OPENSSL "" OFF)
|
|
|
|
option(CURL_CA_PATH "" OFF)
|
|
|
|
set(CURL_CA_PATH none)
|
|
|
|
message(STATUS "using local curl: ${LIBCURL_ROOT}")
|
|
|
|
add_subdirectory(${LIBCURL_ROOT})
|
2019-12-26 18:06:02 +00:00
|
|
|
set(CURL_INCLUDE_DIRS ${LIBCURL_ROOT}/include)
|
2019-12-23 06:52:23 +00:00
|
|
|
set(CURL_LIBRARIES libcurl)
|
|
|
|
set(CURL_FOUND TRUE)
|
|
|
|
else()
|
2019-12-26 20:01:05 +00:00
|
|
|
include(FindCURL)
|
2019-12-23 06:52:23 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
add_definitions(-DUNIX)
|
|
|
|
add_definitions(-DPOSIX)
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix.c)
|
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()
|
|
|
|
|
2019-07-24 15:25:40 +00:00
|
|
|
if(LIBUV_ROOT)
|
|
|
|
add_subdirectory(${LIBUV_ROOT})
|
|
|
|
set(LIBUV_INCLUDE_DIRS ${LIBUV_ROOT}/include)
|
|
|
|
set(LIBUV_LIBRARY uv_a)
|
|
|
|
add_definitions(-D_LARGEFILE_SOURCE)
|
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64)
|
2019-09-30 08:59:34 +00:00
|
|
|
elseif(NOT LIBUV_IN_SOURCE)
|
2019-07-24 15:25:40 +00:00
|
|
|
find_package(LibUV 1.28.0 REQUIRED)
|
|
|
|
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()
|
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-netbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-09-30 08:59:34 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "iOS")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
2019-10-06 23:23:30 +00:00
|
|
|
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-sunos.c)
|
2019-07-31 20:22:23 +00:00
|
|
|
# Apple C++ screws up name decorations in stdc++fs, causing link to fail
|
|
|
|
# Samsung does not build c++experimental or c++fs in their Apple libc++ pkgsrc build
|
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
|
|
|
else()
|
2019-09-30 08:59:34 +00:00
|
|
|
message(FATAL_ERROR "Your operating system - ${CMAKE_SYSTEM_NAME} is not supported yet")
|
2019-04-29 23:48:43 +00:00
|
|
|
endif()
|
|
|
|
|
2019-09-19 15:36:05 +00:00
|
|
|
set(EXE_LIBS ${STATIC_LIB})
|
2019-04-29 23:48:43 +00:00
|
|
|
|
|
|
|
if(RELEASE_MOTTO)
|
|
|
|
add_definitions(-DLLARP_RELEASE_MOTTO="${RELEASE_MOTTO}")
|
2019-04-28 15:57:41 +00:00
|
|
|
endif()
|