THRIFT-4720: documenting breaking changes, minor cleanup
diff --git a/lib/c_glib/test/CMakeLists.txt b/lib/c_glib/test/CMakeLists.txt
index fb3e41c..318b576 100644
--- a/lib/c_glib/test/CMakeLists.txt
+++ b/lib/c_glib/test/CMakeLists.txt
@@ -20,7 +20,7 @@
set(TEST_PREFIX "c_glib")
-include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
+# include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
#Make sure gen-cpp and gen-c_glib files can be included
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index 9ea82c3..9e36665 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -17,7 +17,10 @@
# under the License.
#
-include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
+# Remove the following once lib/cpp no longer depends on boost headers:
+include(BoostMacros)
+REQUIRE_BOOST_HEADERS()
+
include_directories(src)
# SYSLIBS contains libraries that need to be linked to all lib targets
diff --git a/lib/cpp/README.md b/lib/cpp/README.md
index e744a6a..5806f7b 100755
--- a/lib/cpp/README.md
+++ b/lib/cpp/README.md
@@ -33,8 +33,8 @@
Thrift is divided into two libraries.
-* libthrift - The core Thrift library contains all the core Thrift code. It requires
- boost shared pointers, pthreads, and librt.
+* libthrift - The core Thrift library contains all the core Thrift code. This requires
+ openssl, pthreads, and librt.
* libthriftnb - This library contains the Thrift nonblocking server, which uses libevent.
To link this library you will also need to link libevent.
@@ -54,14 +54,12 @@
## Dependencies
-If your C++ environment implements C++11 or later, thrift will automatically use
-std::shared_ptr. Otherwise you will need the boost library to provide a shared_ptr
-implementation for C++ environments pre-C++11. If you are linking against code
-that expects to be using boost::shared_ptr, you can define the preprocessor
-variable FORCE_BOOST_SMART_PTR for your build of thrift to make it use boost instead
-of std for a number of memory related classes. See thrift/stdcxx.h for more.
+C++11 is required at a minimum. C++03/C++98 are not supported after version 0.12.0.
-libevent (for libthriftnb only)
+Boost is required to run the C++ unit tests. It is not necessary to link against
+the runtime library.
+
+libevent (for libthriftnb only) - most linux distributions have dev packages for this:
http://monkey.org/~provos/libevent/
# Using Thrift with C++ on Windows
@@ -85,35 +83,17 @@
## Linking Against Thrift
You need to link your project that uses thrift against all the thrift
-dependencies; in the case of libthrift, boost and for
+dependencies; in the case of libthrift, openssl, pthreads, and librt and for
libthriftnb, libevent.
In the project properties you must also set HAVE_CONFIG_H as force include
-the config header: "windows/confg.h"
+the config header: "windows/config.h"
## Dependencies
-The same dependencies for shared_ptr as described above apply to windows as well.
-
-boost thread
-http://www.boost.org/doc/libs/release/doc/html/thread.html
-
libevent (for libthriftnb only)
http://monkey.org/~provos/libevent/
-## Notes on boost thread (static vs shared):
-
-By default lib/cpp/windows/force_inc.h defines:
-
- #define BOOST_ALL_NO_LIB 1
- #define BOOST_THREAD_NO_LIB 1
-
-This has for effect to have the host application linking against Thrift
-to have to link with boost thread as a static library.
-
-If you wanted instead to link with boost thread as a shared library,
-you'll need to uncomment those two lines, and recompile.
-
## Windows version compatibility
The Thrift library targets Windows XP for broadest compatbility. A notable
@@ -122,6 +102,8 @@
#define TARGET_WIN_XP.
+See Apache Jira THRIFT-2798 for more about TARGET_WIN_XP.
+
## Named Pipes
Named Pipe transport has been added in the TPipe and TPipeServer classes. This
@@ -138,50 +120,16 @@
## Implementation
-There're two main classes TSSLSocketFactory and TSSLSocket. Instances of
+There are two main classes TSSLSocketFactory and TSSLSocket. Instances of
TSSLSocket are always created from TSSLSocketFactory.
-PosixSSLThreadFactory creates PosixSSLThread. The only difference from the
-PthreadThread type is that it cleanups OpenSSL error queue upon exiting
-the thread. Ideally, OpenSSL APIs should only be called from PosixSSLThread.
-
## How to use SSL APIs
-This is for demo. In real code, typically only one TSSLSocketFactory
-instance is needed.
+See the TestClient.cpp and TestServer.cpp files for examples.
- shared_ptr<TSSLSocketFactory> getSSLSocketFactory() {
- shared_ptr<TSSLSocketFactory> factory(new TSSLSocketFactory());
- // client: load trusted certificates
- factory->loadTrustedCertificates("my-trusted-ca-certificates.pem");
- // client: optionally set your own access manager, otherwise,
- // the default client access manager will be loaded.
+### AccessManager (certificate validation)
- factory->loadCertificate("my-certificate-signed-by-ca.pem");
- factory->loadPrivateKey("my-private-key.pem");
- // server: optionally setup access manager
- // shared_ptr<AccessManager> accessManager(new MyAccessManager);
- // factory->access(accessManager);
- ...
- }
-
-
-client code sample
-
- shared_ptr<TSSLSocketFactory> factory = getSSLSocketFactory();
- shared_ptr<TSocket> socket = factory.createSocket(host, port);
- shared_ptr<TBufferedTransport> transport(new TBufferedTransport(socket));
- ...
-
-
-server code sample
-
- shared_ptr<TSSLSocketFactory> factory = getSSLSocketFactory();
- shared_ptr<TSSLServerSocket> socket(new TSSLServerSocket(port, factory));
- shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory));
- ...
-
-## AccessManager
+An example of certificate validation can be found in TestServer.cpp.
AccessManager defines a callback interface. It has three callback methods:
@@ -272,8 +220,29 @@
The PRNG seed is key to the application security. This method should be
overridden if it's not strong enough for you.
+# Deprecations
+
+## 0.12.0
+
+Support for C++03/C++98 was deprecated.
+Support for Boost at runtime was deprecated.
+
# Breaking Changes
+## 1.0.0
+
+Support for C++03/C++98 has been dropped. Use version 0.12.0 to support that
+language level. As a consequence, boost is no longer required as a runtime
+library depenedency, but is is still required to build the runtime library
+and to run the unit tests. We will work towards removing boost as a
+build dependency for folks who just want to build the runtime and not
+run the tests. This means the header thrift/stdcxx.h has been removed and
+anything that relied on it has been changed to directly use C++11 concepts.
+
+The classes BoostThreadFactory, PosixThreadFactory, StdThreadFactory, and
+PlatformThreadFactory will all be removed, and we will use a ThreadFactory
+based on C++11.
+
## 0.11.0
Older versions of thrift depended on the <boost/smart_ptr.hpp> classes which
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index 82d47a6..b30ef17 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -17,11 +17,13 @@
# under the License.
#
-include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
+# Unit tests still require boost
+include(BoostMacros)
+REQUIRE_BOOST_HEADERS()
+set(BOOST_COMPONENTS chrono date_time filesystem random thread unit_test_framework)
+REQUIRE_BOOST_LIBRARIES(BOOST_COMPONENTS)
-if (WITH_DYN_LINK_TEST)
- add_definitions( -DBOOST_TEST_DYN_LINK )
-endif()
+include(ThriftMacros)
# Make sure gen-cpp files can be included
include_directories("${CMAKE_CURRENT_BINARY_DIR}")