Use vendored fs::filesystem on all platforms

pull/961/head
Stephen Shelton 5 years ago
parent 8f6dd132ff
commit 5ce260fce1

@ -29,6 +29,7 @@ option(USE_SHELLHOOKS "enable shell hooks on compile time (dangerous)" OFF)
option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF)
option(TRACY_ROOT "include tracy profiler source" OFF)
option(VENDOR_LIBSODIUM "use vendored libsodium" OFF)
option(VENDOR_FILESYSTEM "use vendored fs::filesystem" ON)
option(WITH_TESTS "build unit tests" ON)
option(WITH_SYSTEMD "enable systemd integration for sd_notify" OFF)
@ -226,6 +227,11 @@ if(WITH_SYSTEMD)
set(SD_LIBS ${SD_LDFLAGS})
endif()
if(VENDOR_FILESYSTEM)
include_directories("${CMAKE_CURRENT_LIST_DIR}/vendor/ghc-filesystem/include")
add_definitions(-DLOKINET_USE_GHC_FILESYSTEM)
message(STATUS "Using vendored ghc::filesystem")
endif()
set(ABSEIL_DIR vendor/abseil-cpp)
include_directories(SYSTEM ${ABSEIL_DIR})

@ -29,21 +29,11 @@ if(EMBEDDED_CFG OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
link_libatomic()
endif()
function(use_vendored_filesystem)
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/ghc-filesystem/include")
add_definitions(-DLOKINET_USE_GHC_FILESYSTEM)
set(FS_LIB "" PARENT_SCOPE)
message(STATUS "Using vendored ghc::filesystem")
endfunction()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(FS_LIB stdc++fs)
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)
if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
use_vendored_filesystem()
endif()
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-linux.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-openbsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
@ -54,9 +44,6 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "iOS")
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)
if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
use_vendored_filesystem()
endif()
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-unix-sunos.c)
@ -65,19 +52,10 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
if (LIBUV_USE_STATIC)
link_libraries(-lkstat -lsendfile)
endif()
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
use_vendored_filesystem()
else()
set(FS_LIB stdc++fs)
endif()
else()
message(FATAL_ERROR "Your operating system - ${CMAKE_SYSTEM_NAME} is not supported yet")
endif()
if(FS_LIB AND USE_VENDORED_FILESYSTEM)
use_vendored_filesystem()
endif()
set(EXE_LIBS ${STATIC_LIB})
if(RELEASE_MOTTO)

Loading…
Cancel
Save