mirror of https://github.com/oxen-io/lokinet
port abseil-cpp to Solaris 2.x and legacy compiler
fuck oracle with a rusty knife, we only support compilers with a full implementation of G++ (so, basically, only clang)
This commit is contained in:
parent
67845e342a
commit
87cebd9ba6
|
@ -40,12 +40,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|||
# Note that the zombie of Oracle Solaris 2.11.x will NOT have
|
||||
# this, the header check is the only method we have to distinguish
|
||||
# them. -rick the svr4 guy
|
||||
set(SOLARIS ON)
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
CHECK_INCLUDE_FILES(sys/epoll.h SOLARIS_HAVE_EPOLL)
|
||||
if (SOLARIS_HAVE_EPOLL)
|
||||
message("Using fast emulation of Linux epoll(5) on Solaris.")
|
||||
add_definitions(-DSOLARIS_HAVE_EPOLL)
|
||||
message(STATUS "Using fast emulation of Linux epoll(5) on Solaris.")
|
||||
else()
|
||||
message("Falling back to poll(2) based event loop.")
|
||||
message(STATUS "Falling back to poll(2) based event loop.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -64,11 +66,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
|||
message( FATAL_ERROR "shadow-framework is Linux only" )
|
||||
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
||||
|
||||
# might be redundant. -rick
|
||||
if (STATIC_LINK_RUNTIME AND SHADOW)
|
||||
message(FATAL_ERROR "the shadow-framework build cannot be linked statically!")
|
||||
endif(STATIC_LINK_RUNTIME AND SHADOW)
|
||||
|
||||
if (WIN32 AND NOT STATIC_LINK_RUNTIME)
|
||||
message("must ship compiler runtime libraries with this build: libwinpthread-1.dll, libgcc_s_dw2-1.dll, and libstdc++-6.dll")
|
||||
message("for release builds, turn on STATIC_LINK_RUNTIME in cmake options")
|
||||
|
@ -90,18 +87,22 @@ add_subdirectory(${ABSEIL_DIR})
|
|||
if (WARNINGS_AS_ERRORS)
|
||||
add_compile_options(-Werror)
|
||||
endif()
|
||||
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas -Wno-unknown-warning-option)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wno-unknown-warning-option)
|
||||
endif()
|
||||
|
||||
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas)
|
||||
# vla are evil
|
||||
add_compile_options(-Wvla)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
|
||||
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
|
||||
|
||||
if (USING_CLANG)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wthread-safety)
|
||||
endif()
|
||||
|
||||
if (WITH_COVERAGE)
|
||||
if (USING_CLANG)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options( -fprofile-instr-generate -fcoverage-mapping )
|
||||
link_libraries( -fprofile-instr-generate )
|
||||
else()
|
||||
|
@ -113,7 +114,7 @@ endif()
|
|||
# these vars are set by the cmake toolchain spec
|
||||
if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
||||
# dynamic linking does this all the time
|
||||
if (USING_CLANG) # windows only, also set by toolchain file
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
option(NO_LIBGCC "use libunwind+compiler-rt instead, must already be installed in mingw-w64 sysroot" OFF)
|
||||
add_compile_options(-Wno-unused-command-line-argument -Wno-c++11-narrowing)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
|
||||
|
@ -124,7 +125,7 @@ if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
|||
else()
|
||||
# found it. this is GNU only
|
||||
add_compile_options(-Wno-cast-function-type)
|
||||
endif(USING_CLANG)
|
||||
endif()
|
||||
endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -158,14 +159,20 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# not supported on Solaris - system libraries are not available as archives
|
||||
if(STATIC_LINK_RUNTIME)
|
||||
add_compile_options(-static)
|
||||
if(USING_CLANG)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libstdc++ -pthread" )
|
||||
if (NOT SOLARIS)
|
||||
add_compile_options(-static)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libstdc++ -pthread" )
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif(USING_CLANG)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc" )
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif(STATIC_LINK_RUNTIME)
|
||||
|
||||
if(USE_NETNS)
|
||||
|
@ -301,10 +308,13 @@ if(UNIX)
|
|||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
|
||||
get_filename_component(EV_SRC "llarp/ev/ev_kqueue.cpp" ABSOLUTE)
|
||||
# TODO: _actually_ port to solaris/illumos (it's fairly complete...except for TUN) -rick
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
|
||||
get_filename_component(EV_SRC "llarp/ev/ev_epoll.cpp" ABSOLUTE)
|
||||
if (SOLARIS_HAVE_EPOLL)
|
||||
get_filename_component(EV_SRC "llarp/ev/ev_epoll.cpp" ABSOLUTE)
|
||||
else()
|
||||
get_filename_component(EV_SRC "llarp/ev/ev_poll.cpp" ABSOLUTE)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Your operating system is not supported yet")
|
||||
endif()
|
||||
|
|
|
@ -69,7 +69,11 @@ endif()
|
|||
list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# -std=X
|
||||
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS} -fno-ident")
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS} -fno-ident")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}")
|
||||
endif(WIN32)
|
||||
|
||||
# -fexceptions
|
||||
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
#error ABSL_HAVE_TLS cannot be directly set
|
||||
#elif defined(__linux__) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
|
||||
#define ABSL_HAVE_TLS 1
|
||||
#elif defined(__sun)
|
||||
#define ABSL_HAVE_TLS 1
|
||||
#endif
|
||||
|
||||
// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
|
||||
|
@ -104,7 +106,7 @@
|
|||
#elif defined(_LIBCPP_VERSION) || \
|
||||
(!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
|
||||
defined(_MSC_VER)
|
||||
defined(_MSC_VER) || defined(__sun)
|
||||
#define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
|
||||
#endif
|
||||
|
||||
|
@ -127,7 +129,7 @@
|
|||
(!defined(__clang__) && defined(__GNUC__) && \
|
||||
(__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)) && \
|
||||
(defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \
|
||||
defined(_MSC_VER)
|
||||
defined(_MSC_VER) || defined(__sun)
|
||||
#define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
|
||||
#define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
|
||||
#endif
|
||||
|
@ -263,6 +265,7 @@
|
|||
// WebAssembly __wasm__
|
||||
// Fuchsia __Fuchsia__
|
||||
// OpenBSD __OpenBSD__
|
||||
// Solaris 2.x __sun
|
||||
//
|
||||
// Note that since Android defines both __ANDROID__ and __linux__, one
|
||||
// may probe for either Linux or Android by simply testing for __linux__.
|
||||
|
@ -276,7 +279,7 @@
|
|||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
||||
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
|
||||
defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \
|
||||
defined(__ASYLO__) || defined(__OpenBSD__)
|
||||
defined(__ASYLO__) || defined(__OpenBSD__) || defined(__sun_)
|
||||
#define ABSL_HAVE_MMAP 1
|
||||
#endif
|
||||
|
||||
|
@ -287,7 +290,7 @@
|
|||
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
|
||||
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
|
||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
||||
defined(__ros__) || defined(__OpenBSD__)
|
||||
defined(__ros__) || defined(__OpenBSD__) || defined(__sun)
|
||||
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
|
||||
#endif
|
||||
|
||||
|
@ -297,7 +300,8 @@
|
|||
// POSIX.1-2001.
|
||||
#ifdef ABSL_HAVE_SCHED_YIELD
|
||||
#error ABSL_HAVE_SCHED_YIELD cannot be directly set
|
||||
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__)
|
||||
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \
|
||||
defined(__sun)
|
||||
#define ABSL_HAVE_SCHED_YIELD 1
|
||||
#endif
|
||||
|
||||
|
@ -312,7 +316,7 @@
|
|||
// platforms.
|
||||
#ifdef ABSL_HAVE_SEMAPHORE_H
|
||||
#error ABSL_HAVE_SEMAPHORE_H cannot be directly set
|
||||
#elif defined(__linux__) || defined(__ros__) || defined(__OpenBSD__)
|
||||
#elif defined(__linux__) || defined(__ros__) || defined(__OpenBSD__) || defined(__sun_)
|
||||
#define ABSL_HAVE_SEMAPHORE_H 1
|
||||
#endif
|
||||
|
||||
|
@ -333,6 +337,8 @@
|
|||
#elif defined(__EMSCRIPTEN__)
|
||||
// emscripten doesn't support signals
|
||||
#elif defined(__native_client__)
|
||||
#elif defined(__sun)
|
||||
#define ABSL_HAVE_ALARM 1
|
||||
#else
|
||||
// other standard libraries
|
||||
#define ABSL_HAVE_ALARM 1
|
||||
|
|
|
@ -164,6 +164,7 @@ namespace cpp17
|
|||
// printf("directory_iterator::impl::type\n");
|
||||
if(e)
|
||||
{
|
||||
#ifdef DT_BLK
|
||||
switch(e->d_type)
|
||||
{
|
||||
case DT_FIFO:
|
||||
|
@ -197,6 +198,7 @@ namespace cpp17
|
|||
default:
|
||||
break;
|
||||
} // switch
|
||||
#endif
|
||||
}
|
||||
|
||||
return file_type::unknown;
|
||||
|
|
Loading…
Reference in New Issue