| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 1 | Thrift C++ Software Library | 
 | 2 |  | 
 | 3 | License | 
 | 4 | ======= | 
 | 5 |  | 
 | 6 | Licensed to the Apache Software Foundation (ASF) under one | 
 | 7 | or more contributor license agreements. See the NOTICE file | 
 | 8 | distributed with this work for additional information | 
 | 9 | regarding copyright ownership. The ASF licenses this file | 
 | 10 | to you under the Apache License, Version 2.0 (the | 
 | 11 | "License"); you may not use this file except in compliance | 
 | 12 | with the License. You may obtain a copy of the License at | 
 | 13 |  | 
 | 14 |   http://www.apache.org/licenses/LICENSE-2.0 | 
 | 15 |  | 
 | 16 | Unless required by applicable law or agreed to in writing, | 
 | 17 | software distributed under the License is distributed on an | 
 | 18 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
 | 19 | KIND, either express or implied. See the License for the | 
 | 20 | specific language governing permissions and limitations | 
 | 21 | under the License. | 
 | 22 |  | 
 | 23 | Using Thrift with C++ | 
 | 24 | ===================== | 
 | 25 |  | 
 | 26 | You need to define an enviroment variable called THIRD_PARTY. The project | 
 | 27 | assumes that you have extracted the dependancies into their default structure | 
 | 28 | into the path defined by THIRD_PARTY. | 
 | 29 |  | 
 | 30 | e.g. $(THIRD_PARTY)/boost/boost_1_47_0/ | 
 | 31 |  | 
 | 32 | Thrift is divided into two libraries. | 
 | 33 |  | 
 | 34 | libthrift | 
 | 35 |   The core Thrift library contains all the core Thrift code. It requires | 
| Roger Meier | 878a948 | 2011-10-11 19:02:37 +0000 | [diff] [blame] | 36 |   boost shared pointers and boost thread. | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 37 |  | 
 | 38 | libthriftnb | 
 | 39 |   This library contains the Thrift nonblocking server, which uses libevent. | 
 | 40 |   To link this library you will also need to link libevent. | 
 | 41 |  | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 42 | Linking Against Thrift | 
 | 43 | ====================== | 
 | 44 |  | 
 | 45 | You need to link your project that uses thrift against all the thrift | 
| Roger Meier | 878a948 | 2011-10-11 19:02:37 +0000 | [diff] [blame] | 46 | dependancies; in the case of libthrift, boost and for | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 47 | libthriftnb, libevent. | 
 | 48 |  | 
 | 49 | In the project properties you must also set HAVE_CONFIG_H as force include | 
 | 50 | the config header: "windows/confg.h" | 
 | 51 |  | 
 | 52 | Dependencies | 
 | 53 | ============ | 
 | 54 |  | 
 | 55 | boost shared pointers | 
 | 56 | http://www.boost.org/libs/smart_ptr/smart_ptr.htm | 
 | 57 |  | 
| Roger Meier | 878a948 | 2011-10-11 19:02:37 +0000 | [diff] [blame] | 58 | boost thread | 
 | 59 | http://www.boost.org/doc/libs/release/doc/html/thread.html | 
 | 60 |  | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 61 | libevent (for libthriftnb only) | 
 | 62 | http://monkey.org/~provos/libevent/ | 
 | 63 |  | 
| Roger Meier | 878a948 | 2011-10-11 19:02:37 +0000 | [diff] [blame] | 64 | Notes on boost thread (static vs shared): | 
 | 65 | ========================================= | 
 | 66 |  | 
 | 67 | By default lib/cpp/windows/force_inc.h defines: | 
 | 68 |  | 
 | 69 | #define BOOST_ALL_NO_LIB 1 | 
 | 70 | #define BOOST_THREAD_NO_LIB 1 | 
 | 71 |  | 
 | 72 | This has for effect to have the host application linking against Thrift | 
 | 73 | to have to link with boost thread as a static library. | 
 | 74 |  | 
 | 75 | If you wanted instead to link with boost thread as a shared library, | 
 | 76 | you'll need to uncomment those two lines, and recompile. | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 77 |  | 
| Roger Meier | 64af51b | 2012-02-06 20:46:06 +0000 | [diff] [blame] | 78 | Windows version compatibility | 
 | 79 | ============================= | 
 | 80 | The Thrift library targets Windows XP for broadest compatbility. A notable | 
 | 81 | difference is in the Windows-specific implementation of the socket poll | 
 | 82 | function. To target Vista, Win7 or other versions, comment out the line | 
 | 83 | #define TARGET_WIN_XP. | 
 | 84 |  | 
| Roger Meier | d1bf5d0 | 2012-04-11 21:38:56 +0000 | [diff] [blame] | 85 | Named Pipes | 
 | 86 | =========== | 
 | 87 | - Named Pipe transport has been added in the TPipe and TPipeServer classes. | 
 | 88 |   This is currently Windows-only (see below). | 
 | 89 |  | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 90 | Known issues | 
 | 91 | ============ | 
 | 92 |  | 
| Roger Meier | d1bf5d0 | 2012-04-11 21:38:56 +0000 | [diff] [blame] | 93 | - Named pipe transport for *NIX has not been implemented. Domain sockets are | 
 | 94 |   a better choice for local IPC under non-Windows OS's. *NIX named pipes  | 
 | 95 |   only support 1:1 client-server connection. | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 96 |  | 
 | 97 | TODO | 
 | 98 | ==== | 
 | 99 |  | 
 | 100 | - Port remaining classes in libthrift: | 
| Roger Meier | 84e4a3c | 2011-09-16 20:58:44 +0000 | [diff] [blame] | 101 |     - TSSLSocket | 
 | 102 |  | 
 | 103 | - Port test cases. (Not even started this. Run test cases in release mode?) | 
 | 104 |  | 
 | 105 | - Autolink libraries depending on debug\release build. | 
 | 106 |  | 
 | 107 | - Auto versioning. |