2019-07-21 23:39:56 +00:00
|
|
|
if(NOT UNIX)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
add_definitions(-DUNIX)
|
|
|
|
add_definitions(-DPOSIX)
|
2019-04-29 23:48:43 +00:00
|
|
|
|
2019-07-01 09:33:03 +00:00
|
|
|
if (STATIC_LINK_RUNTIME)
|
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)
|
|
|
|
else()
|
|
|
|
find_package(LibUV 1.28.0 REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(${LIBUV_INCLUDE_DIRS})
|
2019-07-13 13:05:00 +00:00
|
|
|
|
2019-04-28 15:57:41 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2019-06-25 13:51:17 +00:00
|
|
|
set(FS_LIB stdc++fs)
|
2019-04-29 23:48:43 +00:00
|
|
|
get_filename_component(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c ABSOLUTE)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
2019-07-24 15:25:40 +00:00
|
|
|
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)
|
|
|
|
if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
|
|
|
|
add_subdirectory(vendor)
|
|
|
|
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/cppbackport-master/lib")
|
|
|
|
add_definitions(-DLOKINET_USE_CPPBACKPORT)
|
|
|
|
set(FS_LIB cppbackport)
|
|
|
|
endif()
|
2019-04-29 23:48:43 +00:00
|
|
|
get_filename_component(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-linux.c ABSOLUTE)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
2019-04-29 23:48:43 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${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-04-29 23:48:43 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${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-07-01 09:33:03 +00:00
|
|
|
find_library(FS_LIB NAMES c++experimental)
|
2019-04-29 23:48:43 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
2019-04-28 15:57:41 +00:00
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2019-07-02 21:47:38 +00:00
|
|
|
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)
|
2019-07-01 09:33:03 +00:00
|
|
|
|
|
|
|
if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
|
|
|
|
add_subdirectory(vendor)
|
|
|
|
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/cppbackport-master/lib")
|
|
|
|
add_definitions(-DLOKINET_USE_CPPBACKPORT)
|
|
|
|
set(FS_LIB cppbackport)
|
|
|
|
endif()
|
|
|
|
|
2019-04-29 23:48:43 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${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-04-29 23:48:43 +00:00
|
|
|
set(LIBTUNTAP_IMPL ${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
|
|
|
|
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
add_subdirectory(vendor)
|
|
|
|
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/cppbackport-master/lib")
|
|
|
|
add_definitions(-DLOKINET_USE_CPPBACKPORT)
|
|
|
|
set(FS_LIB cppbackport)
|
|
|
|
endif()
|
2019-04-28 15:57:41 +00:00
|
|
|
else()
|
2019-04-29 23:48:43 +00:00
|
|
|
message(FATAL_ERROR "Your operating system is not supported yet")
|
|
|
|
endif()
|
|
|
|
|
2019-06-24 15:51:58 +00:00
|
|
|
|
|
|
|
set(EXE_LIBS ${STATIC_LIB} libutp)
|
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()
|