libraries: Add thrift to source_migration

This commit adds scope_exit and typeof boost subprojects.
These are dependencies of Window's thrift library.
This commit is contained in:
Ted Reed 2019-11-09 23:03:21 -05:00 committed by Teddy Reed
parent 6486e6800e
commit 76720bea2f
7 changed files with 310 additions and 2 deletions

View File

@ -252,6 +252,8 @@ function(importBoostInterfaceLibraries)
"process:config"
"circular_buffer:config"
"iostreams:config"
"scope_exit:typeof,config"
"typeof:config"
)
add_library(thirdparty_boost_config INTERFACE)

View File

@ -87,4 +87,6 @@ importSourceSubmodule(
"src/libs/circular_buffer"
"src/libs/winapi"
"src/libs/iostreams"
"src/libs/scope_exit"
"src/libs/typeof"
)

View File

@ -90,25 +90,46 @@ function(thriftMain)
THRIFT_STATIC_DEFINE
)
if(DEFINED PLATFORM_WINDOWS)
target_compile_definitions(thirdparty_thrift PRIVATE
PACKAGE_VERSION="0.12.0"
)
endif()
target_link_libraries(thirdparty_thrift PUBLIC
thirdparty_openssl
thirdparty_zlib
thirdparty_boost
)
if(DEFINED PLATFORM_WINDOWS)
target_link_libraries(thirdparty_thrift PRIVATE
thirdparty_boost_scopeexit
)
endif()
target_link_libraries(thirdparty_thrift PRIVATE
thirdparty_cxx_settings
)
if(DEFINED PLATFORM_LINUX)
set(include_config_dir linux)
elseif(DEFINED PLATFORM_MACOS)
set(include_config_dir macos)
elseif(DEFINED PLATFORM_WINDOWS)
set(include_config_dir windows)
endif()
target_include_directories(thirdparty_thrift PRIVATE
"${library_root}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/config/${include_config_dir}"
)
target_include_directories(thirdparty_thrift SYSTEM INTERFACE
"${library_root}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/config"
"${CMAKE_CURRENT_SOURCE_DIR}/config/${include_config_dir}"
)
endfunction()
thriftMain()

View File

@ -0,0 +1,163 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* config.h generated by CMake from config.h.in */
#ifndef CONFIG_H
#define CONFIG_H
/* Name of package */
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.12.0"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING " 0.12.0"
/************************** DEFINES *************************/
/* Define if the AI_ADDRCONFIG symbol is unavailable */
/* #undef AI_ADDRCONFIG */
/* Possible value for SIGNED_RIGHT_SHIFT_IS */
/* TODO: This is just set to 1 for the moment
port the macro aclocal/ax_signed_right_shift.m4 to CMake to make this work */
#define ARITHMETIC_RIGHT_SHIFT 1
/* Indicates the effect of the right shift operator on negative signed
integers */
/* TODO: This is just set to 1 for the moment */
#define SIGNED_RIGHT_SHIFT_IS 1
/* Use *.h extension for parser header file */
/* TODO: This might now be necessary anymore as it is set only for automake < 1.11
see: aclocal/ac_prog_bison.m4 */
/* #undef BISON_USE_PARSER_H_EXTENSION */
/* replaces POSIX pthread by boost::thread */
/* #undef USE_BOOST_THREAD */
/* replaces POSIX pthread by std::thread */
/* #undef USE_STD_THREAD */
/* Define to 1 if strerror_r returns char *. */
/* #undef STRERROR_R_CHAR_P */
/************************** HEADER FILES *************************/
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/*************************** FUNCTIONS ***************************/
/* Define to 1 if you have the `gethostbyname' function. */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the `gethostbyname_r' function. */
/* #undef HAVE_GETHOSTBYNAME_R */
/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the `sched_get_priority_max' function. */
#define HAVE_SCHED_GET_PRIORITY_MAX 1
/* Define to 1 if you have the `sched_get_priority_min' function. */
#define HAVE_SCHED_GET_PRIORITY_MIN 1
/* Define to 1 if strerror_r returns char *. */
/* #undef STRERROR_R_CHAR_P */
#endif

View File

@ -0,0 +1,113 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _THRIFT_WINDOWS_CONFIG_H_
#define _THRIFT_WINDOWS_CONFIG_H_ 1
#if defined(_MSC_VER) && (_MSC_VER > 1200)
#pragma once
#endif // _MSC_VER
#ifndef _WIN32
#error "This is a Windows header only"
#endif
// use std::thread in MSVC11 (2012) or newer and in MinGW
#if (_MSC_VER >= 1700) || defined(__MINGW32__)
#define USE_STD_THREAD 1
#else
// otherwise use boost threads
#define USE_BOOST_THREAD 1
#endif
// Something that defines PRId64 is required to build
#define HAVE_INTTYPES_H 1
// VS2010 or later has stdint.h as does MinGW
#if (_MSC_VER >= 1600) || defined(__MINGW32__)
#define HAVE_STDINT_H 1
#endif
#ifndef TARGET_WIN_XP
#define TARGET_WIN_XP 1
#endif
#if TARGET_WIN_XP
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
#if defined(_M_IX86) || defined(_M_X64)
#define ARITHMETIC_RIGHT_SHIFT 1
#define SIGNED_RIGHT_SHIFT_IS 1
#endif
#ifndef __MINGW32__
#pragma warning(disable : 4996) // Deprecated posix name.
#endif
#define VERSION "0.11.0"
#define HAVE_GETTIMEOFDAY 1
#define HAVE_SYS_STAT_H 1
// Must be using VS2010 or later, or boost, so that C99 types are defined in the global namespace
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#include <boost/cstdint.hpp>
typedef boost::int64_t int64_t;
typedef boost::uint64_t uint64_t;
typedef boost::int32_t int32_t;
typedef boost::uint32_t uint32_t;
typedef boost::int16_t int16_t;
typedef boost::uint16_t uint16_t;
typedef boost::int8_t int8_t;
typedef boost::uint8_t uint8_t;
#endif
#include <thrift/transport/PlatformSocket.h>
#include <thrift/windows/GetTimeOfDay.h>
#include <thrift/windows/Operators.h>
#include <thrift/windows/TWinsockSingleton.h>
#include <thrift/windows/WinFcntl.h>
#include <thrift/windows/SocketPair.h>
// windows
#include <Winsock2.h>
#include <ws2tcpip.h>
#ifndef __MINGW32__
#ifdef _WIN32_WCE
#pragma comment(lib, "Ws2.lib")
#else
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer
#pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer
#endif
#endif // __MINGW32__
#endif // _THRIFT_WINDOWS_CONFIG_H_

View File

@ -0,0 +1,7 @@
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
include("${CMAKE_SOURCE_DIR}/libraries/cmake/source/modules/Findthrift.cmake")