Repository: avro Updated Branches: refs/heads/master 5ec94b9af -> 273556423
Made C++ work when Snappy is not installed Project: http://git-wip-us.apache.org/repos/asf/avro/repo Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/27355642 Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/27355642 Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/27355642 Branch: refs/heads/master Commit: 27355642317a0c87b4dc7350203a4197232d83b1 Parents: 5ec94b9 Author: Thiruvalluvan M. G <[email protected]> Authored: Tue Feb 21 14:44:39 2017 +0530 Committer: Thiruvalluvan M G <[email protected]> Committed: Tue Feb 21 14:44:39 2017 +0530 ---------------------------------------------------------------------- lang/c++/README | 32 +++++++++++++++++++++----------- lang/c++/test/DataFileTests.cc | 6 ++++-- 2 files changed, 25 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/avro/blob/27355642/lang/c++/README ---------------------------------------------------------------------- diff --git a/lang/c++/README b/lang/c++/README index 7a79971..f1e9b66 100644 --- a/lang/c++/README +++ b/lang/c++/README @@ -23,18 +23,21 @@ The C++ port is thus far incomplete. Currently, it contains: objects of the same data types, and the code to serialize and parse it. -What's missing: Defaults are not yet supported. And the file and rpc -containers are not yet implemented. Documentation, sparse. +What's missing: Rpc containers are not yet implemented. Documentation is sparse. INSTRUCTIONS -To compile requires boost headers, and the boost regex library. -Additionally, to generate the avro spec compiler requires flex and bison. +Pre-requisites: + +To compile requires boost headers, and the boost regex library. Optionally, it requires Snappy compression library. If Snappy is available, it builds support for Snappy compression and skips it otherwise. (Please see your OS-specific instructions on how to install Boost and Snappy for your OS). + To build one requires cmake 2.6 or later. -To generate a Makefile under Unix or Cygwin use: +To generate a Makefile under Unix, MacOS (using GNU) or Cygwin use: -cmake -G "Unix Makefiles" +mkdir build +cd build +cmake -G "Unix Makefiles" .. If it doesn't work, either you are missing some packages (boost, flex or bison), or you need to help configure locate them. @@ -42,11 +45,7 @@ or you need to help configure locate them. If the Makefile is configured correctly, then you can make and run tests: make - ./build/unittest - ./build/buffertest - ./build/testgentest - ./build/CodecTests - ./build/StreamTests + ctest To install @@ -54,6 +53,17 @@ To install and then untar the generated .tar.gz file. +To build and test on MacOS (using Xcode) + +mkdir build.mac +cd build.mac +cmake -G Xcode + +xcodebuild -configuration Release +ctest -C Release + +If debug version is required, replace 'Release' above with 'Debug'. + Note: The LICENSE and NOTICE files in the lang/c++ source directory are used to build the binary distribution. The LICENSE and NOTICE information for the Avro C++ source distribution is in the root directory. http://git-wip-us.apache.org/repos/asf/avro/blob/27355642/lang/c++/test/DataFileTests.cc ---------------------------------------------------------------------- diff --git a/lang/c++/test/DataFileTests.cc b/lang/c++/test/DataFileTests.cc index f1ce789..27a7ce9 100644 --- a/lang/c++/test/DataFileTests.cc +++ b/lang/c++/test/DataFileTests.cc @@ -434,6 +434,7 @@ public: } } +#ifdef SNAPPY_CODEC_AVAILABLE void testSnappy() { // Add enough objects to span multiple blocks const size_t number_of_objects = 1000000; @@ -464,6 +465,7 @@ public: } } } +#endif void testSchemaReadWrite() { uint32_t a=42; @@ -524,9 +526,9 @@ init_unit_test_suite( int argc, char* argv[] ) shared_ptr<DataFileTest> t6(new DataFileTest("test6.df", dsch, dblsch)); ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testZip, t6)); shared_ptr<DataFileTest> t8(new DataFileTest("test8.df", dsch, dblsch)); +#ifdef SNAPPY_CODEC_AVAILABLE ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testSnappy, t8)); - - +#endif shared_ptr<DataFileTest> t7(new DataFileTest("test7.df",fsch,fsch)); ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testSchemaReadWrite,t7)); ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testCleanup,t7));
