blob: bc4aa42f8adda1844fa45556c5bc82fd58a79227 [file] [log] [blame]
Roger Meier84e4a3c2011-09-16 20:58:44 +00001/*
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, III4d39ac52016-09-28 11:03:27 -040028#error "This is a Windows header only"
Roger Meier84e4a3c2011-09-16 20:58:44 +000029#endif
30
James E. King, IIIbff04462017-02-11 01:18:03 -050031// use std::thread in MSVC11 (2012) or newer and in MinGW
32#if (_MSC_VER >= 1700) || defined(__MINGW32__)
Konrad Grochowski16a23a62014-11-13 15:33:38 +010033#define USE_STD_THREAD 1
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040034#else
James E. King, III4d39ac52016-09-28 11:03:27 -040035// otherwise use boost threads
Konrad Grochowski16a23a62014-11-13 15:33:38 +010036#define USE_BOOST_THREAD 1
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040037#endif
38
James E. King, III7edc8fa2017-01-20 10:11:41 -050039// Something that defines PRId64 is required to build
40#define HAVE_INTTYPES_H 1
41
James E. King, IIIbff04462017-02-11 01:18:03 -050042// VS2010 or later has stdint.h as does MinGW
43#if (_MSC_VER >= 1600) || defined(__MINGW32__)
James E. King, III4d39ac52016-09-28 11:03:27 -040044#define HAVE_STDINT_H 1
45#endif
46
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040047#ifndef TARGET_WIN_XP
Konrad Grochowski16a23a62014-11-13 15:33:38 +010048#define TARGET_WIN_XP 1
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040049#endif
50
51#if TARGET_WIN_XP
Konrad Grochowski16a23a62014-11-13 15:33:38 +010052#ifndef WINVER
53#define WINVER 0x0501
54#endif
55#ifndef _WIN32_WINNT
56#define _WIN32_WINNT 0x0501
57#endif
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040058#endif
59
60#ifndef _WIN32_WINNT
Konrad Grochowski16a23a62014-11-13 15:33:38 +010061#define _WIN32_WINNT 0x0601
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040062#endif
63
Roger Meierf83c0e12014-07-07 22:06:45 +020064#if defined(_M_IX86) || defined(_M_X64)
Konrad Grochowski16a23a62014-11-13 15:33:38 +010065#define ARITHMETIC_RIGHT_SHIFT 1
66#define SIGNED_RIGHT_SHIFT_IS 1
Roger Meierf83c0e12014-07-07 22:06:45 +020067#endif
68
James E. King, III07f59972017-03-10 06:18:33 -050069#ifndef __MINGW32__
Konrad Grochowski16a23a62014-11-13 15:33:38 +010070#pragma warning(disable : 4996) // Deprecated posix name.
James E. King, III07f59972017-03-10 06:18:33 -050071#endif
Roger Meier8cd3b1a2011-09-23 14:25:22 +000072
73#define HAVE_GETTIMEOFDAY 1
Roger Meier3faaedf2011-10-02 10:51:45 +000074#define HAVE_SYS_STAT_H 1
Roger Meier8cd3b1a2011-09-23 14:25:22 +000075
James E. King, III4d39ac52016-09-28 11:03:27 -040076// Must be using VS2010 or later, or boost, so that C99 types are defined in the global namespace
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040077#ifdef HAVE_STDINT_H
Konrad Grochowski16a23a62014-11-13 15:33:38 +010078#include <stdint.h>
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040079#else
Konrad Grochowski16a23a62014-11-13 15:33:38 +010080#include <boost/cstdint.hpp>
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040081
Konrad Grochowski16a23a62014-11-13 15:33:38 +010082typedef boost::int64_t int64_t;
83typedef boost::uint64_t uint64_t;
84typedef boost::int32_t int32_t;
85typedef boost::uint32_t uint32_t;
86typedef boost::int16_t int16_t;
87typedef boost::uint16_t uint16_t;
88typedef boost::int8_t int8_t;
89typedef boost::uint8_t uint8_t;
Carl Yeksigian7cb7fc82013-06-07 07:33:01 -040090#endif
91
92#include <thrift/transport/PlatformSocket.h>
Roger Meier4285ba22013-06-10 21:17:23 +020093#include <thrift/windows/GetTimeOfDay.h>
94#include <thrift/windows/Operators.h>
95#include <thrift/windows/TWinsockSingleton.h>
96#include <thrift/windows/WinFcntl.h>
97#include <thrift/windows/SocketPair.h>
Roger Meier84e4a3c2011-09-16 20:58:44 +000098
Roger Meier84e4a3c2011-09-16 20:58:44 +000099// windows
100#include <Winsock2.h>
101#include <ws2tcpip.h>
James E. King, III07f59972017-03-10 06:18:33 -0500102#ifndef __MINGW32__
103 #ifdef _WIN32_WCE
104 #pragma comment(lib, "Ws2.lib")
105 #else
106 #pragma comment(lib, "Ws2_32.lib")
107 #pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer
108 #pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer
109 #endif
110#endif // __MINGW32__
111
Roger Meier84e4a3c2011-09-16 20:58:44 +0000112#endif // _THRIFT_WINDOWS_CONFIG_H_