diff options
Diffstat (limited to 'vcpkg/ports/avro-cpp')
| -rw-r--r-- | vcpkg/ports/avro-cpp/fix-cmake.patch | 97 | ||||
| -rw-r--r-- | vcpkg/ports/avro-cpp/fix-fmt.patch | 38 | ||||
| -rw-r--r-- | vcpkg/ports/avro-cpp/fix-std32_t.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/avro-cpp/portfile.cmake | 53 | ||||
| -rw-r--r-- | vcpkg/ports/avro-cpp/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/avro-cpp/vcpkg.json | 39 |
6 files changed, 243 insertions, 0 deletions
diff --git a/vcpkg/ports/avro-cpp/fix-cmake.patch b/vcpkg/ports/avro-cpp/fix-cmake.patch new file mode 100644 index 0000000..dc55ed4 --- /dev/null +++ b/vcpkg/ports/avro-cpp/fix-cmake.patch @@ -0,0 +1,97 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 19059a4..c49e9c2 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -58,17 +58,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}) + if (WIN32 AND NOT CYGWIN AND NOT MSYS) + add_definitions (/EHa) + add_definitions ( +- -DNOMINMAX +- -DBOOST_REGEX_DYN_LINK +- -DBOOST_FILESYSTEM_DYN_LINK +- -DBOOST_SYSTEM_DYN_LINK +- -DBOOST_IOSTREAMS_DYN_LINK +- -DBOOST_PROGRAM_OPTIONS_DYN_LINK +- -DBOOST_ALL_NO_LIB) ++ -DNOMINMAX) + endif() + + if (CMAKE_COMPILER_IS_GNUCXX) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wconversion -pedantic -Werror") ++ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wconversion -pedantic") + if (AVRO_ADD_PROTECTOR_FLAGS) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector-all -D_GLIBCXX_DEBUG") + # Unset _GLIBCXX_DEBUG for avrogencpp.cc because using Boost Program Options +@@ -82,16 +77,7 @@ endif () + find_package (Boost 1.38 REQUIRED + COMPONENTS filesystem iostreams program_options regex system) + +-include(FetchContent) +-FetchContent_Declare( +- fmt +- GIT_REPOSITORY https://github.com/fmtlib/fmt.git +- GIT_TAG 10.2.1 +- GIT_PROGRESS TRUE +- USES_TERMINAL_DOWNLOAD TRUE +-) +-FetchContent_MakeAvailable(fmt) +- ++find_package(fmt CONFIG REQUIRED) + find_package(Snappy) + if (SNAPPY_FOUND) + set(SNAPPY_PKG libsnappy) +@@ -128,7 +114,7 @@ set (AVRO_SOURCE_FILES + impl/CustomAttributes.cc + ) + +-add_library (avrocpp SHARED ${AVRO_SOURCE_FILES}) ++add_library (avrocpp ${AVRO_SOURCE_FILES}) + + set_property (TARGET avrocpp + APPEND PROPERTY COMPILE_DEFINITIONS AVRO_DYN_LINK) +@@ -194,6 +180,7 @@ target_include_directories(avrocpp PUBLIC + $<INSTALL_INTERFACE:include> + ) + ++if(BUILD_TESTING) + enable_testing() + + macro (unittest name) +@@ -220,23 +207,26 @@ unittest (CommonsSchemasTests) + add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh) + + add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh +- tweet_hh +- union_array_union_hh union_map_union_hh union_conflict_hh +- recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh +- primitivetypes_hh empty_record_hh cpp_reserved_words_union_typedef_hh +- union_empty_record_hh) +- ++ tweet_hh ++ union_array_union_hh union_map_union_hh union_conflict_hh ++ recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh ++ primitivetypes_hh empty_record_hh cpp_reserved_words_union_typedef_hh ++ union_empty_record_hh) ++endif() + include (InstallRequiredSystemLibraries) + + set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}") + + include (CPack) + +-install (TARGETS avrocpp avrocpp_s +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib +- RUNTIME DESTINATION lib) ++install(TARGETS avrocpp EXPORT unofficial-avro-cpp) + ++install( ++ EXPORT unofficial-avro-cpp ++ FILE unofficial-avro-cpp-config.cmake ++ DESTINATION share/unofficial-avro-cpp ++ NAMESPACE unofficial::avro-cpp:: ++) + install (TARGETS avrogencpp RUNTIME DESTINATION bin) + + install (DIRECTORY include/avro DESTINATION include diff --git a/vcpkg/ports/avro-cpp/fix-fmt.patch b/vcpkg/ports/avro-cpp/fix-fmt.patch new file mode 100644 index 0000000..35155ea --- /dev/null +++ b/vcpkg/ports/avro-cpp/fix-fmt.patch @@ -0,0 +1,38 @@ +diff --git a/lang/c++/include/avro/Node.hh b/lang/c++/include/avro/Node.hh +index f76078b..75619d9 100644 +--- a/lang/c++/include/avro/Node.hh ++++ b/lang/c++/include/avro/Node.hh +@@ -219,8 +219,8 @@ inline std::ostream &operator<<(std::ostream &os, const avro::Node &n) { + template<> + struct fmt::formatter<avro::Name> : fmt::formatter<std::string> { + template<typename FormatContext> +- auto format(const avro::Name &n, FormatContext &ctx) { +- return fmt::formatter<std::string>::format(n.fullname(), ctx); ++ auto format(const avro::Name &n, FormatContext &ctx) const { ++ return fmt::format_to(ctx.out(), "{}", n.fullname()); + } + }; + +diff --git a/lang/c++/include/avro/Types.hh b/lang/c++/include/avro/Types.hh +index 84a3397..4fe018e 100644 +--- a/lang/c++/include/avro/Types.hh ++++ b/lang/c++/include/avro/Types.hh +@@ -19,6 +19,7 @@ + #ifndef avro_Types_hh__ + #define avro_Types_hh__ + ++#include <fmt/core.h> + #include <fmt/format.h> + #include <iostream> + +@@ -113,8 +114,8 @@ std::ostream &operator<<(std::ostream &os, const Null &null); + template<> + struct fmt::formatter<avro::Type> : fmt::formatter<std::string> { + template<typename FormatContext> +- auto format(avro::Type t, FormatContext &ctx) { +- return fmt::formatter<std::string>::format(avro::toString(t), ctx); ++ auto format(avro::Type t, FormatContext &ctx) const { ++ return fmt::format_to(ctx.out(), "{}", avro::toString(const_cast<avro::Type&>(t))); + } + }; + diff --git a/vcpkg/ports/avro-cpp/fix-std32_t.patch b/vcpkg/ports/avro-cpp/fix-std32_t.patch new file mode 100644 index 0000000..1f0ff42 --- /dev/null +++ b/vcpkg/ports/avro-cpp/fix-std32_t.patch @@ -0,0 +1,12 @@ +diff --git a/lang/c++/include/avro/LogicalType.hh b/lang/c++/include/avro/LogicalType.hh +index b2a7d0294..7b113b3aa 100644 +--- a/lang/c++/include/avro/LogicalType.hh ++++ b/lang/c++/include/avro/LogicalType.hh +@@ -22,6 +22,7 @@ + #include <iostream> + + #include "Config.hh" ++#include <cstdint> + + namespace avro { + diff --git a/vcpkg/ports/avro-cpp/portfile.cmake b/vcpkg/ports/avro-cpp/portfile.cmake new file mode 100644 index 0000000..d3b3a5d --- /dev/null +++ b/vcpkg/ports/avro-cpp/portfile.cmake @@ -0,0 +1,53 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/avro + REF "release-${VERSION}" + SHA512 8cc6ef3cf1e0a919118c8ba5817a1866dc4f891fa95873c0fe1b4b388858fbadee8ed50406fa0006882cab40807fcf00c5a2dcd500290f3868d9d06b287eacb6 + HEAD_REF master + PATCHES + fix-cmake.patch + fix-fmt.patch + fix-std32_t.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + INVERTED_FEATURES + snappy CMAKE_DISABLE_FIND_PACKAGE_Snappy +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/lang/c++" + OPTIONS + -DBUILD_TESTING=OFF + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT}) + +file(READ "${CURRENT_PACKAGES_DIR}/share/unofficial-avro-cpp/unofficial-avro-cpp-config.cmake" cmake_config) +if("snappy" IN_LIST FEATURES) + file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-avro-cpp/unofficial-avro-cpp-config.cmake" +"include(CMakeFindDependencyMacro) +find_dependency(Boost REQUIRED COMPONENTS filesystem iostreams program_options regex system) +find_dependency(fmt CONFIG) +find_dependency(Snappy) +${cmake_config} +") +else() + file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-avro-cpp/unofficial-avro-cpp-config.cmake" +"include(CMakeFindDependencyMacro) +find_dependency(Boost REQUIRED COMPONENTS filesystem iostreams program_options regex system) +find_dependency(fmt CONFIG) +${cmake_config} +") +endif() + +vcpkg_copy_pdbs() +vcpkg_copy_tools(TOOL_NAMES avrogencpp AUTO_CLEAN) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/lang/c++/LICENSE") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/vcpkg/ports/avro-cpp/usage b/vcpkg/ports/avro-cpp/usage new file mode 100644 index 0000000..243b52d --- /dev/null +++ b/vcpkg/ports/avro-cpp/usage @@ -0,0 +1,4 @@ +avro-cpp provides CMake targets: + + find_package(unofficial-avro-cpp CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::avro-cpp::avrocpp) diff --git a/vcpkg/ports/avro-cpp/vcpkg.json b/vcpkg/ports/avro-cpp/vcpkg.json new file mode 100644 index 0000000..ab8cf5e --- /dev/null +++ b/vcpkg/ports/avro-cpp/vcpkg.json @@ -0,0 +1,39 @@ +{ + "name": "avro-cpp", + "version": "1.12.0", + "port-version": 2, + "description": "Apache Avro is a data serialization system", + "homepage": "https://github.com/apache/avro", + "license": "Apache-2.0", + "dependencies": [ + "boost-algorithm", + "boost-any", + "boost-crc", + "boost-filesystem", + "boost-format", + "boost-iostreams", + "boost-lexical-cast", + "boost-math", + "boost-program-options", + "boost-random", + "boost-tuple", + "fmt", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "features": { + "snappy": { + "description": "Support Snappy for compression", + "dependencies": [ + "snappy" + ] + } + } +} |