Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef _THRIFT_WINDOWS_CONFIG_H_ |
| 21 | #define _THRIFT_WINDOWS_CONFIG_H_ 1 |
| 22 | |
| 23 | #if defined(_MSC_VER) && (_MSC_VER > 1200) |
| 24 | #pragma once |
| 25 | #endif // _MSC_VER |
| 26 | |
| 27 | #ifndef _WIN32 |
James E. King, III | 4d39ac5 | 2016-09-28 11:03:27 -0400 | [diff] [blame] | 28 | #error "This is a Windows header only" |
Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 29 | #endif |
| 30 | |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 31 | // use std::thread in MSVC11 (2012) or newer |
| 32 | #if _MSC_VER >= 1700 |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 33 | #define USE_STD_THREAD 1 |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 34 | #else |
James E. King, III | 4d39ac5 | 2016-09-28 11:03:27 -0400 | [diff] [blame] | 35 | // otherwise use boost threads |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 36 | #define USE_BOOST_THREAD 1 |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 37 | #endif |
| 38 | |
James E. King, III | 4d39ac5 | 2016-09-28 11:03:27 -0400 | [diff] [blame] | 39 | // VS2010 or later has stdint.h |
| 40 | #if _MSC_VER >= 1600 |
| 41 | #define HAVE_STDINT_H 1 |
| 42 | #endif |
| 43 | |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 44 | #ifndef TARGET_WIN_XP |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 45 | #define TARGET_WIN_XP 1 |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #if TARGET_WIN_XP |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 49 | #ifndef WINVER |
| 50 | #define WINVER 0x0501 |
| 51 | #endif |
| 52 | #ifndef _WIN32_WINNT |
| 53 | #define _WIN32_WINNT 0x0501 |
| 54 | #endif |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 55 | #endif |
| 56 | |
| 57 | #ifndef _WIN32_WINNT |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 58 | #define _WIN32_WINNT 0x0601 |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 59 | #endif |
| 60 | |
Roger Meier | f83c0e1 | 2014-07-07 22:06:45 +0200 | [diff] [blame] | 61 | #if defined(_M_IX86) || defined(_M_X64) |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 62 | #define ARITHMETIC_RIGHT_SHIFT 1 |
| 63 | #define SIGNED_RIGHT_SHIFT_IS 1 |
Roger Meier | f83c0e1 | 2014-07-07 22:06:45 +0200 | [diff] [blame] | 64 | #endif |
| 65 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 66 | #pragma warning(disable : 4996) // Deprecated posix name. |
Roger Meier | 8cd3b1a | 2011-09-23 14:25:22 +0000 | [diff] [blame] | 67 | |
Jake Farrell | 6fcecd4 | 2012-10-11 20:34:25 +0000 | [diff] [blame] | 68 | #define VERSION "1.0.0-dev" |
Roger Meier | 8cd3b1a | 2011-09-23 14:25:22 +0000 | [diff] [blame] | 69 | #define HAVE_GETTIMEOFDAY 1 |
Roger Meier | 3faaedf | 2011-10-02 10:51:45 +0000 | [diff] [blame] | 70 | #define HAVE_SYS_STAT_H 1 |
Roger Meier | 8cd3b1a | 2011-09-23 14:25:22 +0000 | [diff] [blame] | 71 | |
James E. King, III | 4d39ac5 | 2016-09-28 11:03:27 -0400 | [diff] [blame] | 72 | // Must be using VS2010 or later, or boost, so that C99 types are defined in the global namespace |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 73 | #ifdef HAVE_STDINT_H |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 74 | #include <stdint.h> |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 75 | #else |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 76 | #include <boost/cstdint.hpp> |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 77 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 78 | typedef boost::int64_t int64_t; |
| 79 | typedef boost::uint64_t uint64_t; |
| 80 | typedef boost::int32_t int32_t; |
| 81 | typedef boost::uint32_t uint32_t; |
| 82 | typedef boost::int16_t int16_t; |
| 83 | typedef boost::uint16_t uint16_t; |
| 84 | typedef boost::int8_t int8_t; |
| 85 | typedef boost::uint8_t uint8_t; |
Carl Yeksigian | 7cb7fc8 | 2013-06-07 07:33:01 -0400 | [diff] [blame] | 86 | #endif |
| 87 | |
| 88 | #include <thrift/transport/PlatformSocket.h> |
Roger Meier | 4285ba2 | 2013-06-10 21:17:23 +0200 | [diff] [blame] | 89 | #include <thrift/windows/GetTimeOfDay.h> |
| 90 | #include <thrift/windows/Operators.h> |
| 91 | #include <thrift/windows/TWinsockSingleton.h> |
| 92 | #include <thrift/windows/WinFcntl.h> |
| 93 | #include <thrift/windows/SocketPair.h> |
Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 94 | |
Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 95 | // windows |
| 96 | #include <Winsock2.h> |
| 97 | #include <ws2tcpip.h> |
henrique | c9bdd50 | 2014-06-25 13:13:23 +0200 | [diff] [blame] | 98 | #ifdef _WIN32_WCE |
| 99 | #pragma comment(lib, "Ws2.lib") |
| 100 | #else |
Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 101 | #pragma comment(lib, "Ws2_32.lib") |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 102 | #pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer |
Konrad Grochowski | 7f4be5f | 2015-11-05 20:23:11 +0100 | [diff] [blame] | 103 | #pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer |
henrique | c9bdd50 | 2014-06-25 13:13:23 +0200 | [diff] [blame] | 104 | #endif |
Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 105 | #endif // _THRIFT_WINDOWS_CONFIG_H_ |