From b342ec33e535893312af1ded6a67f8c4f784aee5 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 30 Apr 2021 02:29:41 +0300 Subject: [PATCH] Likely add Solaris support. --- CMake/TdSetUpCompiler.cmake | 11 ++++++----- CMakeLists.txt | 2 -- tdutils/td/utils/port/config.h | 3 +++ tdutils/td/utils/port/path.cpp | 2 +- tdutils/td/utils/port/platform.h | 4 +++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CMake/TdSetUpCompiler.cmake b/CMake/TdSetUpCompiler.cmake index c9b9199c9..c4a580fd8 100644 --- a/CMake/TdSetUpCompiler.cmake +++ b/CMake/TdSetUpCompiler.cmake @@ -56,7 +56,7 @@ function(td_set_up_compiler) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") - if (ILLUMOS) + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,ignore") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,ignore") else() @@ -85,10 +85,11 @@ function(td_set_up_compiler) add_definitions(-D_FILE_OFFSET_BITS=64) 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) + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lsocket -lnsl") + if (ILLUMOS) + add_definitions(-DTD_ILLUMOS=1) + endif() endif() include(AddCXXCompilerFlag) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70acbdc96..93f9a442f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,6 @@ if (POLICY CMP0060) cmake_policy(SET CMP0060 NEW) endif() -include(illumos) - include(PreventInSourceBuild) prevent_in_source_build() diff --git a/tdutils/td/utils/port/config.h b/tdutils/td/utils/port/config.h index b431f41ad..450162cef 100644 --- a/tdutils/td/utils/port/config.h +++ b/tdutils/td/utils/port/config.h @@ -37,6 +37,9 @@ #elif TD_ILLUMOS #define TD_POLL_EPOLL 1 #define TD_EVENTFD_LINUX 1 +#elif TD_SOLARIS + #define TD_POLL_POLL 1 + #define TD_EVENTFD_BSD 1 #else #error "Poll's implementation is not defined" #endif diff --git a/tdutils/td/utils/port/path.cpp b/tdutils/td/utils/port/path.cpp index c61835e14..7f9aabbda 100644 --- a/tdutils/td/utils/port/path.cpp +++ b/tdutils/td/utils/port/path.cpp @@ -294,7 +294,7 @@ Result walk_path_subdir(string &path, DIR *dir, const WalkFunction &func) status = walk_path_file(path, func); } #else -#if !TD_ILLUMOS +#if !TD_SOLARIS #warning "Slow walk_path" #endif status = walk_path(path, func); diff --git a/tdutils/td/utils/port/platform.h b/tdutils/td/utils/port/platform.h index fb881f134..048fe780e 100644 --- a/tdutils/td/utils/port/platform.h +++ b/tdutils/td/utils/port/platform.h @@ -53,7 +53,9 @@ #define TD_CYGWIN 1 #elif defined(__EMSCRIPTEN__) #define TD_EMSCRIPTEN 1 -#elif defined(TD_ILLUMOS) +#elif defined(__sun) + #define TD_SOLARIS 1 + // TD_ILLUMOS can be already defined by CMake #elif defined(__unix__) // all unices not caught above #define TD_UNIX_UNKNOWN 1 #define TD_CYGWIN 1