mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 05:53:03 +08:00
[avro-cpp] Fix static build (#32854)
* [avro-cpp] Fix windows static build * update version database
This commit is contained in:
parent
25b6dabf06
commit
4bc219e623
99
ports/avro-cpp/fix-cmake.patch
Normal file
99
ports/avro-cpp/fix-cmake.patch
Normal file
@ -0,0 +1,99 @@
|
||||
diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
|
||||
index 472684f4c..edde09e40 100644
|
||||
--- a/lang/c++/CMakeLists.txt
|
||||
+++ b/lang/c++/CMakeLists.txt
|
||||
@@ -51,20 +51,16 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
|
||||
project (Avro-cpp)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
|
||||
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+
|
||||
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)
|
||||
+ add_definitions (-DNOMINMAX)
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
|
||||
+ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon)
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -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
|
||||
@@ -114,7 +110,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)
|
||||
@@ -131,12 +127,12 @@ set_target_properties (avrocpp PROPERTIES
|
||||
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_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR})
|
||||
|
||||
add_executable (precompile test/precompile.cc)
|
||||
|
||||
-target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||||
+target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
|
||||
macro (gen file ns)
|
||||
add_custom_command (OUTPUT ${file}.hh
|
||||
@@ -166,13 +162,14 @@ 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)
|
||||
|
||||
+if(BUILD_TESTING)
|
||||
enable_testing()
|
||||
|
||||
macro (unittest name)
|
||||
- add_executable (${name} test/${name}.cc)
|
||||
- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||||
+ add_executable (${name} test/${name}.cc impl/json/JsonIO.cc impl/json/JsonDom.cc)
|
||||
+ target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name})
|
||||
endmacro (unittest)
|
||||
@@ -197,6 +194,7 @@ add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_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)
|
||||
+endif()
|
||||
|
||||
include (InstallRequiredSystemLibraries)
|
||||
|
||||
@@ -204,10 +202,14 @@ 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)
|
||||
|
@ -1,116 +0,0 @@
|
||||
diff --git "a/lang/c++/CMakeLists.txt" "b/lang/c++/CMakeLists.txt"
|
||||
index 52d6ac8a..39d59cd8 100644
|
||||
--- "a/lang/c++/CMakeLists.txt"
|
||||
+++ "b/lang/c++/CMakeLists.txt"
|
||||
@@ -51,6 +51,8 @@ list(GET AVRO_VERSION 2 AVRO_VERSION_PATCH)
|
||||
project (Avro-cpp)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
|
||||
|
||||
+find_package(ZLIB REQUIRED)
|
||||
+
|
||||
if (WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
add_definitions (/EHa)
|
||||
add_definitions (
|
||||
@@ -64,7 +66,8 @@ if (WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror")
|
||||
+ # Remove " -Werror" because of warning from boost-math (will require C++ 14 soon)
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -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
|
||||
@@ -131,12 +134,12 @@ set_target_properties (avrocpp PROPERTIES
|
||||
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_link_libraries (avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
target_include_directories(avrocpp PRIVATE ${SNAPPY_INCLUDE_DIR})
|
||||
|
||||
add_executable (precompile test/precompile.cc)
|
||||
|
||||
-target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||||
+target_link_libraries (precompile avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
|
||||
macro (gen file ns)
|
||||
add_custom_command (OUTPUT ${file}.hh
|
||||
@@ -166,37 +169,41 @@ 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)
|
||||
+ enable_testing()
|
||||
+endif()
|
||||
|
||||
macro (unittest name)
|
||||
- add_executable (${name} test/${name}.cc)
|
||||
- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES})
|
||||
+ add_executable (${name} test/${name}.cc impl/json/JsonIO.cc impl/json/JsonDom.cc)
|
||||
+ target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ZLIB::ZLIB)
|
||||
add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name})
|
||||
endmacro (unittest)
|
||||
|
||||
-unittest (buffertest)
|
||||
-unittest (unittest)
|
||||
-unittest (SchemaTests)
|
||||
-unittest (LargeSchemaTests)
|
||||
-unittest (CodecTests)
|
||||
-unittest (StreamTests)
|
||||
-unittest (SpecificTests)
|
||||
-unittest (DataFileTests)
|
||||
-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
|
||||
- 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)
|
||||
+if(BUILD_TESTING)
|
||||
+ unittest (buffertest)
|
||||
+ unittest (unittest)
|
||||
+ unittest (SchemaTests)
|
||||
+ unittest (LargeSchemaTests)
|
||||
+ unittest (CodecTests)
|
||||
+ unittest (StreamTests)
|
||||
+ unittest (SpecificTests)
|
||||
+ unittest (DataFileTests)
|
||||
+ 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
|
||||
+ 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)
|
||||
+endif()
|
||||
|
||||
include (InstallRequiredSystemLibraries)
|
||||
|
||||
@@ -207,9 +214,9 @@ include (CPack)
|
||||
install (TARGETS avrocpp avrocpp_s
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
- RUNTIME DESTINATION lib)
|
||||
+ RUNTIME DESTINATION bin)
|
||||
|
||||
-install (TARGETS avrogencpp RUNTIME DESTINATION bin)
|
||||
+install (TARGETS avrogencpp RUNTIME DESTINATION tools/bin)
|
||||
|
||||
install (DIRECTORY api/ DESTINATION include/avro
|
||||
FILES_MATCHING PATTERN *.hh)
|
@ -1,5 +1,3 @@
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO apache/avro
|
||||
@ -7,12 +5,10 @@ vcpkg_from_github(
|
||||
SHA512 932f642f272997b5c0be467d3a3ccc354c6edf425c36b33aa7e61984f67312c712bb1d74cb1a5fd8066169104851e73830f0ed3fdb450e005a5c5bef33c34f20
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
install.patch
|
||||
fix-cmake.patch
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
test BUILD_TESTING
|
||||
INVERTED_FEATURES
|
||||
snappy CMAKE_DISABLE_FIND_PACKAGE_Snappy
|
||||
)
|
||||
@ -20,14 +16,34 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}/lang/c++"
|
||||
OPTIONS
|
||||
-DBUILD_TESTING=OFF
|
||||
${FEATURE_OPTIONS}
|
||||
)
|
||||
|
||||
vcpkg_cmake_install(ADD_BIN_TO_PATH)
|
||||
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(ZLIB)
|
||||
find_dependency(Snappy)
|
||||
${cmake_config}
|
||||
")
|
||||
else()
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-avro-cpp/unofficial-avro-cpp-config.cmake"
|
||||
"include(CMakeFindDependencyMacro)
|
||||
find_dependency(ZLIB)
|
||||
${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")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/lang/c++/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/lang/c++/LICENSE")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
|
@ -1,9 +1,4 @@
|
||||
The package avro-cpp can be used from CMake via:
|
||||
avro-cpp provides CMake targets:
|
||||
|
||||
find_path(AVROCPP_INCLUDE_DIR avro/Encoder.hh)
|
||||
find_library(AVROCPP_LIBRARY_DEBUG avrocpp PATH_SUFFIXES "debug/lib" REQUIRED)
|
||||
get_filename_component(AVROCPP_ROOT_FIND_DIR ${AVROCPP_INCLUDE_DIR} DIRECTORY)
|
||||
find_library(AVROCPP_LIBRARY_RELEASE avrocpp PATHS "${AVROCPP_ROOT_FIND_DIR}/lib/" REQUIRED NO_DEFAULT_PATH)
|
||||
|
||||
target_include_directories(main PRIVATE "${AVROCPP_INCLUDE_DIR}")
|
||||
target_link_libraries(main PRIVATE optimized "${AVROCPP_LIBRARY_RELEASE}" debug "${AVROCPP_LIBRARY_DEBUG}")
|
||||
find_package(unofficial-avro-cpp CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE unofficial::avro-cpp::avrocpp)
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "avro-cpp",
|
||||
"version-date": "2022-11-07",
|
||||
"port-version": 1,
|
||||
"description": "Apache Avro is a data serialization system",
|
||||
"homepage": "https://github.com/apache/avro",
|
||||
"license": "Apache-2.0",
|
||||
"supports": "!(windows & static)",
|
||||
"dependencies": [
|
||||
"boost-algorithm",
|
||||
"boost-any",
|
||||
@ -21,6 +21,10 @@
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
"zlib"
|
||||
],
|
||||
"features": {
|
||||
@ -29,16 +33,6 @@
|
||||
"dependencies": [
|
||||
"snappy"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"description": "Build tests",
|
||||
"dependencies": [
|
||||
"boost-asio",
|
||||
"boost-bind",
|
||||
"boost-smart-ptr",
|
||||
"boost-test",
|
||||
"boost-thread"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,9 +62,6 @@ assimp:arm-neon-android=fail
|
||||
avro-c:arm-neon-android=fail
|
||||
avro-c:arm64-android=fail
|
||||
avro-c:x64-android=fail
|
||||
avro-cpp:arm-neon-android=fail
|
||||
avro-cpp:arm64-android=fail
|
||||
avro-cpp:x64-android=fail
|
||||
azure-identity-cpp:arm-neon-android=fail
|
||||
azure-identity-cpp:arm64-android=fail
|
||||
azure-identity-cpp:x64-android=fail
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "0f04b2076c299b830bfdd3a698db754f4f8cf269",
|
||||
"version-date": "2022-11-07",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "08f82323ee0bb00a297cc1318c04dd3bce5d963e",
|
||||
"version-date": "2022-11-07",
|
||||
|
@ -338,7 +338,7 @@
|
||||
},
|
||||
"avro-cpp": {
|
||||
"baseline": "2022-11-07",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"aws-c-auth": {
|
||||
"baseline": "0.6.22",
|
||||
|
Loading…
Reference in New Issue
Block a user