Skip to content

Commit

Permalink
[avro-cpp] update to latest master and fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort committed May 31, 2021
1 parent b560fcb commit 1b1abc8
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 20 deletions.
10 changes: 0 additions & 10 deletions ports/avro-cpp/CONTROL

This file was deleted.

33 changes: 33 additions & 0 deletions ports/avro-cpp/fix-windows-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/lang/c++/impl/avrogencpp.cc b/lang/c++/impl/avrogencpp.cc
index 61570413..0b6b35a2 100644
--- a/lang/c++/impl/avrogencpp.cc
+++ b/lang/c++/impl/avrogencpp.cc
@@ -804,8 +804,8 @@ static string readGuard(const string &filename) {

int main(int argc, char **argv) {
const string NS("namespace");
- const string OUT("output");
- const string IN("input");
+ const string OUT_FILE("output");
+ const string IN_FILE("input");
const string INCLUDE_PREFIX("include-prefix");
const string NO_UNION_TYPEDEF("no-union-typedef");

@@ -817,14 +817,14 @@ int main(int argc, char **argv) {
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);

- if (vm.count("help") || vm.count(IN) == 0 || vm.count(OUT) == 0) {
+ if (vm.count("help") || vm.count(IN_FILE) == 0 || vm.count(OUT_FILE) == 0) {
std::cout << desc << std::endl;
return 1;
}

string ns = vm.count(NS) > 0 ? vm[NS].as<string>() : string();
- string outf = vm.count(OUT) > 0 ? vm[OUT].as<string>() : string();
- string inf = vm.count(IN) > 0 ? vm[IN].as<string>() : string();
+ string outf = vm.count(OUT_FILE) > 0 ? vm[OUT_FILE].as<string>() : string();
+ string inf = vm.count(IN_FILE) > 0 ? vm[IN_FILE].as<string>() : string();
string incPrefix = vm[INCLUDE_PREFIX].as<string>();
bool noUnion = vm.count(NO_UNION_TYPEDEF) != 0;
if (incPrefix == "-") {
22 changes: 14 additions & 8 deletions ports/avro-cpp/install.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
index 30a5d66..f7f2b94 100644
index bf764ce4..e84524d0 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
@@ -40,6 +40,8 @@ set (AVRO_VERSION_MINOR "0")
@@ -48,6 +48,8 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
project (Avro-cpp)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})

Expand All @@ -11,12 +11,13 @@ index 30a5d66..f7f2b94 100644
if (WIN32 AND NOT CYGWIN AND NOT MSYS)
add_definitions (/EHa)
add_definitions (
@@ -118,11 +120,11 @@ set_target_properties (avrocpp PROPERTIES
@@ -125,12 +127,12 @@ set_target_properties (avrocpp PROPERTIES
set_target_properties (avrocpp_s PROPERTIES
VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR})
VERSION ${AVRO_VERSION_MAJOR}.${AVRO_VERSION_MINOR}.${AVRO_VERSION_PATCH})

-target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
+target_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR})

add_executable (precompile test/precompile.cc)

Expand All @@ -25,13 +26,12 @@ index 30a5d66..f7f2b94 100644

macro (gen file ns)
add_custom_command (OUTPUT ${file}.hh
@@ -151,34 +153,40 @@ gen (crossref cr)
gen (primitivetypes pt)
@@ -160,37 +162,42 @@ gen (primitivetypes pt)
gen (cpp_reserved_words cppres)

add_executable (avrogencpp impl/avrogencpp.cc)
-target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
+target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
+

-enable_testing()
+if(BUILD_TESTING)
Expand All @@ -57,6 +57,9 @@ index 30a5d66..f7f2b94 100644
-unittest (JsonTests)
-unittest (AvrogencppTests)
-unittest (CompilerTests)
-unittest (AvrogencppTestReservedWords)
-
-add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh)
-
-add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh
- tweet_hh
Expand All @@ -75,6 +78,9 @@ index 30a5d66..f7f2b94 100644
+ unittest (JsonTests)
+ unittest (AvrogencppTests)
+ unittest (CompilerTests)
+ unittest (AvrogencppTestReservedWords)
+
+ add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh)
+
+ add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh
+ tweet_hh
Expand All @@ -86,7 +92,7 @@ index 30a5d66..f7f2b94 100644

include (InstallRequiredSystemLibraries)

@@ -189,9 +197,9 @@ include (CPack)
@@ -201,9 +208,9 @@ include (CPack)
install (TARGETS avrocpp avrocpp_s
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
Expand Down
5 changes: 3 additions & 2 deletions ports/avro-cpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apache/avro
REF release-1.9.2
SHA512 6a6980901eea964c050eb3d61fadf28712e2f02c36985bf8e5176b668bba48985f6a666554a1964435448de29b18d790ab86b787d0288a22fd9cba00746a7846
REF 2ab8fa85d05f04387bd5d63b10ad1c8fd2243616
SHA512 fd21f0919b0e5e884bdf4d66c4d5ba056f04c426b309ec0b5ab26642a5f6b00d46f4dd965431b10130bc5f0d81699e2195780e90e127f63049ee5763403ef7c8
HEAD_REF master
PATCHES
install.patch
fix-windows-build.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
30 changes: 30 additions & 0 deletions ports/avro-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "avro-cpp",
"version-date": "2021-06-01",
"description": "Apache Avro is a data serialization system",
"homepage": "https://github.com/apache/avro",
"supports": "!(windows & static)",
"dependencies": [
"boost-crc",
"boost-filesystem",
"boost-format",
"boost-iostreams",
"boost-program-options",
"boost-random",
"boost-test",
"boost-thread",
"bzip2",
"liblzma",
"libzip",
"zlib",
"zstd"
],
"features": {
"snappy": {
"description": "Support Snappy for compression",
"dependencies": [
"snappy"
]
}
}
}

0 comments on commit 1b1abc8

Please sign in to comment.