diff options
| author | Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> | 2020-06-02 08:55:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-01 17:55:23 -0700 |
| commit | 5a80a8e9dd4d18e1491f57cf0d1f03ee8016acfd (patch) | |
| tree | 358449a14826543a2fa9ca6ace38df0d4cd7a91d | |
| parent | c967db5c7048ea8a05ca33482ea1797d53568eca (diff) | |
| download | vcpkg-5a80a8e9dd4d18e1491f57cf0d1f03ee8016acfd.tar.gz vcpkg-5a80a8e9dd4d18e1491f57cf0d1f03ee8016acfd.zip | |
[vcpkg-baseline][zxing-cpp] Fix build failure (#11586)
* [zxing-cpp] Fix build failure
* [libiconv] Add vcpkg-cmake-wrapper to find libcharset
* [zxing-cpp] Use FindIconv and wrapper to find libiconv, add features
* [libiconv] Add include code to wrapper
| -rw-r--r-- | ports/libiconv/CONTROL | 2 | ||||
| -rw-r--r-- | ports/libiconv/portfile.cmake | 2 | ||||
| -rw-r--r-- | ports/libiconv/vcpkg-cmake-wrapper.cmake | 10 | ||||
| -rw-r--r-- | ports/zxing-cpp/0002-improve-features.patch | 39 | ||||
| -rw-r--r-- | ports/zxing-cpp/CONTROL | 12 | ||||
| -rw-r--r-- | ports/zxing-cpp/portfile.cmake | 25 |
6 files changed, 77 insertions, 13 deletions
diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL index 098a30bcc..acff1a893 100644 --- a/ports/libiconv/CONTROL +++ b/ports/libiconv/CONTROL @@ -1,4 +1,4 @@ Source: libiconv -Version: 1.16-2 +Version: 1.16-3 Homepage: https://www.gnu.org/software/libiconv/ Description: GNU Unicode text conversion diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake index 5f184079f..b36c995b6 100644 --- a/ports/libiconv/portfile.cmake +++ b/ports/libiconv/portfile.cmake @@ -37,6 +37,8 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-iconv TARGET_PATH share/u vcpkg_copy_pdbs() +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/Iconv) + file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_test_cmake(PACKAGE_NAME unofficial-iconv) diff --git a/ports/libiconv/vcpkg-cmake-wrapper.cmake b/ports/libiconv/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..472dd8082 --- /dev/null +++ b/ports/libiconv/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,10 @@ +include(SelectLibraryConfigurations)
+
+_find_package(${ARGS})
+if(Iconv_FOUND)
+ find_library(CHARSET_LIBRARY_DEBUG NAMES charsetd libcharsetd charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
+ find_library(CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
+ find_library(CHARSET_LIBRARY_RELEASE NAMES charset libcharset NAMES_PER_DIR PATH_SUFFIXES lib)
+ select_library_configurations(CHARSET)
+ list(APPEND Iconv_LIBRARIES ${CHARSET_LIBRARIES})
+endif()
diff --git a/ports/zxing-cpp/0002-improve-features.patch b/ports/zxing-cpp/0002-improve-features.patch new file mode 100644 index 000000000..5776c36ea --- /dev/null +++ b/ports/zxing-cpp/0002-improve-features.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ade734..54071bd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.0) + project(zxing) + set(CMAKE_CXX_STANDARD 11) + option(BUILD_TESTING "Enable generation of test targets" OFF) ++option(WITH_OPENCV "Build with opencv" OFF) ++option(WITH_ICONV "Build with iconv" OFF) + + set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) + +@@ -43,8 +45,8 @@ if(WIN32) + endif() + + # OpenCV classes +-find_package(OpenCV) +-if(OpenCV_FOUND) ++if(WITH_OPENCV) ++ find_package(OpenCV REQUIRED) + list(APPEND LIBZXING_FILES + opencv/src/zxing/MatSource.cpp + opencv/src/zxing/MatSource.h +@@ -58,10 +60,10 @@ include_directories(core/src) + add_library(libzxing ${LIBZXING_FILES}) + set_target_properties(libzxing PROPERTIES PREFIX "") + +-find_package(Iconv) +-if(ICONV_FOUND) +- include_directories(${ICONV_INCLUDE_DIR}) +- target_link_libraries(libzxing ${ICONV_LIBRARIES}) ++if(WITH_ICONV) ++ find_package(Iconv REQUIRED) ++ include_directories(${Iconv_INCLUDE_DIRS}) ++ target_link_libraries(libzxing ${Iconv_LIBRARIES}) + else() + add_definitions(-DNO_ICONV=1) + endif() diff --git a/ports/zxing-cpp/CONTROL b/ports/zxing-cpp/CONTROL index fdf894097..89a07a222 100644 --- a/ports/zxing-cpp/CONTROL +++ b/ports/zxing-cpp/CONTROL @@ -1,5 +1,13 @@ Source: zxing-cpp -Version: 3.3.3-6 +Version: 3.3.3-7 Homepage: https://github.com/glassechidna/zxing-cpp -Build-Depends: opencv Description: Barcode detection and decoding library. +Default-Features: opencv, iconv + +Feature: opencv +Build-Depends: opencv +Description: Build with opencv + +Feature: iconv +Build-Depends: libiconv +Description: Build with libiconv
\ No newline at end of file diff --git a/ports/zxing-cpp/portfile.cmake b/ports/zxing-cpp/portfile.cmake index 044342ed6..3e9666390 100644 --- a/ports/zxing-cpp/portfile.cmake +++ b/ports/zxing-cpp/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( @@ -10,16 +8,29 @@ vcpkg_from_github( HEAD_REF master PATCHES 0001-opencv4-compat.patch + 0002-improve-features.patch +) + +file(REMOVE ${SOURCE_PATH}/cmake/FindModules/FindIconv.cmake) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + opencv WITH_OPENCV + iconv WITH_ICONV ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_Iconv=ON + OPTIONS ${FEATURE_OPTIONS} ) vcpkg_install_cmake() +vcpkg_copy_pdbs() + +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/zxing/cmake TARGET_PATH share/zxing) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}) @@ -28,18 +39,12 @@ if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor else() file(COPY ${CURRENT_PACKAGES_DIR}/bin/zxing DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) endif() -vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) -vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/zxing) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/zxing) # Handle copyright -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/zxing-cpp) -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/zxing-cpp) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/zxing-cpp/COPYING ${CURRENT_PACKAGES_DIR}/share/zxing-cpp/copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) |
