add illumos support (#1501)
This commit is contained in:
parent
75e593fd51
commit
ed291840d3
@ -5,6 +5,8 @@ function(td_set_up_compiler)
|
|||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON PARENT_SCOPE)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON PARENT_SCOPE)
|
||||||
|
|
||||||
|
include(illumos)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(GCC 1)
|
set(GCC 1)
|
||||||
set(GCC 1 PARENT_SCOPE)
|
set(GCC 1 PARENT_SCOPE)
|
||||||
@ -58,7 +60,9 @@ function(td_set_up_compiler)
|
|||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
if (NOT ILLUMOS)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32 OR CYGWIN)
|
if (WIN32 OR CYGWIN)
|
||||||
@ -81,6 +85,12 @@ function(td_set_up_compiler)
|
|||||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ILLUMOS)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lnsl -lsocket")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lnsl -lsocket")
|
||||||
|
add_definitions(-DTD_ILLUMOS=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(AddCXXCompilerFlag)
|
include(AddCXXCompilerFlag)
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
add_cxx_compiler_flag("-Wall")
|
add_cxx_compiler_flag("-Wall")
|
||||||
|
11
CMake/illumos.cmake
Normal file
11
CMake/illumos.cmake
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||||
|
#
|
||||||
|
# Determine if the host is running an illumos distribution:
|
||||||
|
#
|
||||||
|
execute_process(COMMAND /usr/bin/uname -o OUTPUT_VARIABLE UNAME_O
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
if (UNAME_O STREQUAL "illumos")
|
||||||
|
set(ILLUMOS 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
@ -26,6 +26,8 @@ if (POLICY CMP0060)
|
|||||||
cmake_policy(SET CMP0060 NEW)
|
cmake_policy(SET CMP0060 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(illumos)
|
||||||
|
|
||||||
include(PreventInSourceBuild)
|
include(PreventInSourceBuild)
|
||||||
prevent_in_source_build()
|
prevent_in_source_build()
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ TDLib (Telegram Database library) is a cross-platform library for building [Tele
|
|||||||
|
|
||||||
`TDLib` has many advantages. Notably `TDLib` is:
|
`TDLib` has many advantages. Notably `TDLib` is:
|
||||||
|
|
||||||
* **Cross-platform**: `TDLib` can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, Windows Phone, WebAssembly, watchOS, tvOS, Tizen, Cygwin. It should also work on other *nix systems with or without minimal effort.
|
* **Cross-platform**: `TDLib` can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, illumos, Windows Phone, WebAssembly, watchOS, tvOS, Tizen, Cygwin. It should also work on other *nix systems with or without minimal effort.
|
||||||
* **Multilanguage**: `TDLib` can be easily used with any programming language that is able to execute C functions. Additionally it already has native Java (using `JNI`) bindings and .NET (using `C++/CLI` and `C++/CX`) bindings.
|
* **Multilanguage**: `TDLib` can be easily used with any programming language that is able to execute C functions. Additionally it already has native Java (using `JNI`) bindings and .NET (using `C++/CLI` and `C++/CX`) bindings.
|
||||||
* **Easy to use**: `TDLib` takes care of all network implementation details, encryption and local data storage.
|
* **Easy to use**: `TDLib` takes care of all network implementation details, encryption and local data storage.
|
||||||
* **High-performance**: in the [Telegram Bot API](https://core.telegram.org/bots/api), each `TDLib` instance handles more than 24000 active bots simultaneously.
|
* **High-performance**: in the [Telegram Bot API](https://core.telegram.org/bots/api), each `TDLib` instance handles more than 24000 active bots simultaneously.
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__CYGWIN__)
|
#if defined(__linux__) || defined(__CYGWIN__) || defined(__sun)
|
||||||
|
|
||||||
# include <endian.h>
|
# include <endian.h>
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#elif TD_WINDOWS
|
#elif TD_WINDOWS
|
||||||
#define TD_POLL_WINEVENT 1
|
#define TD_POLL_WINEVENT 1
|
||||||
#define TD_EVENTFD_WINDOWS 1
|
#define TD_EVENTFD_WINDOWS 1
|
||||||
|
#elif TD_ILLUMOS
|
||||||
|
#define TD_POLL_EPOLL 1
|
||||||
|
#define TD_EVENTFD_LINUX 1
|
||||||
#else
|
#else
|
||||||
#error "Poll's implementation is not defined"
|
#error "Poll's implementation is not defined"
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#define TD_CYGWIN 1
|
#define TD_CYGWIN 1
|
||||||
#elif defined(__EMSCRIPTEN__)
|
#elif defined(__EMSCRIPTEN__)
|
||||||
#define TD_EMSCRIPTEN 1
|
#define TD_EMSCRIPTEN 1
|
||||||
|
#elif defined(TD_ILLUMOS)
|
||||||
#elif defined(__unix__) // all unices not caught above
|
#elif defined(__unix__) // all unices not caught above
|
||||||
#warning "Probably unsupported Unix platform. Feel free to try to compile"
|
#warning "Probably unsupported Unix platform. Feel free to try to compile"
|
||||||
#define TD_CYGWIN 1
|
#define TD_CYGWIN 1
|
||||||
|
@ -194,7 +194,7 @@ Slice get_operating_system_version() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
utsname name;
|
struct utsname name;
|
||||||
int err = uname(&name);
|
int err = uname(&name);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
auto os_name = trim(PSTRING() << Slice(name.sysname, std::strlen(name.sysname)) << " "
|
auto os_name = trim(PSTRING() << Slice(name.sysname, std::strlen(name.sysname)) << " "
|
||||||
|
Loading…
Reference in New Issue
Block a user