From ab2cba0aa4ca1843201136c738992cd58d9d786a Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Wed, 7 Jan 2026 18:37:23 +0800 Subject: [PATCH] [qzxing] new port (#48950) --- ports/qzxing/add-cmake-config.patch | 58 +++++++++++++++++++++++++++ ports/qzxing/allow-shared-build.patch | 17 ++++++++ ports/qzxing/portfile.cmake | 29 ++++++++++++++ ports/qzxing/use-qt6.patch | 47 ++++++++++++++++++++++ ports/qzxing/vcpkg.json | 24 +++++++++++ versions/baseline.json | 4 ++ versions/q-/qzxing.json | 9 +++++ 7 files changed, 188 insertions(+) create mode 100644 ports/qzxing/add-cmake-config.patch create mode 100644 ports/qzxing/allow-shared-build.patch create mode 100644 ports/qzxing/portfile.cmake create mode 100644 ports/qzxing/use-qt6.patch create mode 100644 ports/qzxing/vcpkg.json create mode 100644 versions/q-/qzxing.json diff --git a/ports/qzxing/add-cmake-config.patch b/ports/qzxing/add-cmake-config.patch new file mode 100644 index 0000000000..28def45113 --- /dev/null +++ b/ports/qzxing/add-cmake-config.patch @@ -0,0 +1,58 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 8af58db..40406f2 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -130,5 +130,38 @@ target_include_directories(qzxing + zxing/bigint + PUBLIC + $ ++ $ + ) + ++include(CMakePackageConfigHelpers) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-qzxing-version.cmake" ++ VERSION ${VERSION} ++ COMPATIBILITY SameMajorVersion ++) ++configure_package_config_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/unofficial-qzxing-config.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-qzxing-config.cmake" ++ INSTALL_DESTINATION share/unofficial-qzxing ++) ++install(TARGETS qzxing ++ EXPORT QzxingTargets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) ++install(EXPORT QzxingTargets ++ FILE unofficial-qzxing-targets.cmake ++ NAMESPACE unofficial::qzxing:: ++ DESTINATION share/unofficial-qzxing ++) ++install(FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-qzxing-config.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-qzxing-version.cmake" ++ DESTINATION share/unofficial-qzxing ++) ++install(FILES ++ QZXing.h ++ QZXing_global.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) +diff --git a/src/cmake/unofficial-qzxing-config.cmake.in b/src/cmake/unofficial-qzxing-config.cmake.in +new file mode 100644 +index 0000000..2563ca8 +--- /dev/null ++++ b/src/cmake/unofficial-qzxing-config.cmake.in +@@ -0,0 +1,8 @@ ++@PACKAGE_INIT@ ++ ++include(CMakeFindDependencyMacro) ++find_dependency(Qt6 COMPONENTS Core Gui) ++ ++include(${CMAKE_CURRENT_LIST_DIR}/unofficial-qzxing-targets.cmake) ++ ++check_required_components(unofficial-qzxing) +\ No newline at end of file diff --git a/ports/qzxing/allow-shared-build.patch b/ports/qzxing/allow-shared-build.patch new file mode 100644 index 0000000000..c9ca4271db --- /dev/null +++ b/ports/qzxing/allow-shared-build.patch @@ -0,0 +1,17 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index f8cb91a..555a4f1 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -114,7 +114,11 @@ endif() + + + # Change Global Definitions depending on how you want to use the library +-target_compile_definitions(qzxing PUBLIC DISABLE_LIBRARY_FEATURES) ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(qzxing PUBLIC $) ++else() ++ target_compile_definitions(qzxing PUBLIC DISABLE_LIBRARY_FEATURES) ++endif() + + # Target includes + target_include_directories(qzxing diff --git a/ports/qzxing/portfile.cmake b/ports/qzxing/portfile.cmake new file mode 100644 index 0000000000..7e876cb3b1 --- /dev/null +++ b/ports/qzxing/portfile.cmake @@ -0,0 +1,29 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ftylitak/qzxing + REF "v${VERSION}" + SHA512 21ab9960fafc5eb5e2907e22e31d29d9b4db66480e65ba26d86bededa708d51abc2fd1a9e959357402104e993653dc4aa9a6e6fcf9de362a74030c8bddad8411 + HEAD_REF master + PATCHES + use-qt6.patch + allow-shared-build.patch + add-cmake-config.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/src" + OPTIONS + -DQZXING_MULTIMEDIA=OFF + -DQZXING_USE_QML=OFF + -DVERSION=${VERSION} +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-qzxing) +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/qzxing/use-qt6.patch b/ports/qzxing/use-qt6.patch new file mode 100644 index 0000000000..f5ab851e4d --- /dev/null +++ b/ports/qzxing/use-qt6.patch @@ -0,0 +1,47 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 427ae19..f8cb91a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1,10 +1,14 @@ + cmake_minimum_required(VERSION 3.3) + project(QZXing) + +-find_package(Qt5 COMPONENTS Core REQUIRED) +-find_package(Qt5 COMPONENTS Gui REQUIRED) +-find_package(Qt5 COMPONENTS Multimedia ) +-find_package(Qt5 REQUIRED Svg Quick QuickControls2) ++find_package(Qt6 COMPONENTS Core REQUIRED) ++find_package(Qt6 COMPONENTS Gui REQUIRED) ++if(QZXING_MULTIMEDIA) ++ find_package(Qt6 COMPONENTS Multimedia ) ++endif() ++if(QZXING_USE_QML) ++ find_package(Qt6 REQUIRED Svg Quick QuickControls2) ++endif() + + SET(BIGINT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zxing/bigint) + SET(WIN32_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zxing/win32/zxing) +@@ -65,18 +69,18 @@ add_subdirectory(zxing/bigint) + + add_subdirectory(zxing/zxing) + +-target_link_libraries(qzxing Qt5::Core Qt5::Gui) ++target_link_libraries(qzxing Qt6::Core Qt6::Gui) + + if(QZXING_MULTIMEDIA) +- target_link_libraries(qzxing Qt5::Multimedia) ++ target_link_libraries(qzxing Qt6::Multimedia) + target_compile_definitions(qzxing PUBLIC -DQZXING_MULTIMEDIA) + endif(QZXING_MULTIMEDIA) + + if(QZXING_USE_QML) + target_link_libraries(qzxing +- Qt5::Svg +- Qt5::Quick +- Qt5::QuickControls2) ++ Qt6::Svg ++ Qt6::Quick ++ Qt6::QuickControls2) + target_compile_definitions(qzxing PUBLIC -DQZXING_QML) + endif(QZXING_USE_QML) + diff --git a/ports/qzxing/vcpkg.json b/ports/qzxing/vcpkg.json new file mode 100644 index 0000000000..3a3f4589a7 --- /dev/null +++ b/ports/qzxing/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "qzxing", + "version": "3.3.0", + "description": "Qt/QML wrapper library for the ZXing library. 1D/2D barcode image processing library.", + "homepage": "https://github.com/ftylitak/qzxing", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "qtbase", + "default-features": false, + "features": [ + "gui" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index baa90506f4..d90ae58b12 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8356,6 +8356,10 @@ "baseline": "3.1.0", "port-version": 5 }, + "qzxing": { + "baseline": "3.3.0", + "port-version": 0 + }, "rabit": { "baseline": "0.1", "port-version": 5 diff --git a/versions/q-/qzxing.json b/versions/q-/qzxing.json new file mode 100644 index 0000000000..76440f5ea5 --- /dev/null +++ b/versions/q-/qzxing.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "e57201610af0aad4ea6f80b3c5458b791a026daf", + "version": "3.3.0", + "port-version": 0 + } + ] +}