This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/avro.git
commit 1b1e4ba8172c083f65f3e400ab070570a3bb278a Author: Michael Spector <[email protected]> AuthorDate: Thu Jan 23 12:46:13 2020 +0200 Fixed building with Visual Studio (and Snappy enabled) --- MSBUILD.md | 16 ++++++++++++++++ lang/c++/CMakeLists.txt | 2 ++ 2 files changed, 18 insertions(+) diff --git a/MSBUILD.md b/MSBUILD.md new file mode 100644 index 0000000..2f8d942 --- /dev/null +++ b/MSBUILD.md @@ -0,0 +1,16 @@ +# Visual Studio 2019 Build Instructions + +## Prerequisites + + * Microsoft Visual Studio 2019. + * CMake >= 3.12 (should be supplied as part of VS2019 installation). + * Clone [https://github.com/spektom/snappy-visual-cpp](https://github.com/spektom/snappy-visual-cpp), and follow build instructions in `README.md`. + * Install Boost from [https://netcologne.dl.sourceforge.net/project/boost/boost-binaries/1.68.0/boost_1_68_0-msvc-14.1-64.exe](https://netcologne.dl.sourceforge.net/project/boost/boost-binaries/1.68.0/boost_1_68_0-msvc-14.1-64.exe). + * Add `C:\<path to>\boost_1_68_0\lib64-msvc-14.1` to PATH environment variable. + +## Building + + cd lang\c++ + cmake -G "Visual Studio 16 2019" -DBOOST_ROOT=C:\<path to>\boost_1_68_0 -DBOOST_INCLUDEDIR=c:\<path to>\boost_1_68_0\boost -DBOOST_LIBRARYDIR=c:\<path to>\boost_1_68_0\lib64-msvc-14.1 -DSNAPPY_INCLUDE_DIR=C:\<path to>\snappy-visual-cpp -DSNAPPY_LIBRARIES=C:\<path to>\snappy-visual-cpp\x64\Release\snappy.lib .. + msbuild Avro-cpp.sln /p:Configuration=Release /p:Platform=x64 + diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt index ca03f36..69feee5 100644 --- a/lang/c++/CMakeLists.txt +++ b/lang/c++/CMakeLists.txt @@ -110,6 +110,7 @@ set_property (TARGET avrocpp APPEND PROPERTY COMPILE_DEFINITIONS AVRO_DYN_LINK) add_library (avrocpp_s STATIC ${AVRO_SOURCE_FILES}) +target_include_directories(avrocpp_s PRIVATE ${SNAPPY_INCLUDE_DIR}) set_property (TARGET avrocpp avrocpp_s APPEND PROPERTY COMPILE_DEFINITIONS AVRO_SOURCE) @@ -121,6 +122,7 @@ set_target_properties (avrocpp_s PROPERTIES VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH}) target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR}) add_executable (precompile test/precompile.cc)
