summaryrefslogtreecommitdiff
path: root/lib/cpp/src/thrift/windows/config.h
blob: 9261ca8de60384c22b437ab9caf198f7cab215a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * 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 MSVC header only.
#endif

// use std::thread in MSVC11 (2012) or newer
#if _MSC_VER >= 1700
#  define USE_STD_THREAD 1
// otherwise use boost threads
#else
#  define USE_BOOST_THREAD 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

#pragma warning(disable: 4996) // Deprecated posix name.

#define VERSION "1.0.0-dev"
#define HAVE_GETTIMEOFDAY 1
#define HAVE_SYS_STAT_H 1

#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>
#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
#endif
#endif // _THRIFT_WINDOWS_CONFIG_H_