From 1ae452ef2e204df7f1af7f11fe42ce56be66dd27 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Lazo <30321688+EddyTheCo@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:54:48 +0100 Subject: [PATCH] Develop (#78) * Added explicit export for Windows shared libs * Use ifw (#77) * use common for cpack and exports * used versioned ccomon and latest dependencies --- .github/workflows/build-docs.yml | 12 -- .github/workflows/build-test-install.yml | 50 +++++++- CMakeLists.txt | 44 ++----- Config.cmake.in | 2 +- QrDec/CMakeLists.txt | 7 +- QrDec/README.md | 6 +- QrGen/CMakeLists.txt | 7 +- QrGen/README.md | 6 +- QtQrDec/CMakeLists.txt | 149 ++++++++++++----------- QtQrDec/README.md | 6 +- QtQrDec/examples/CMakeLists.txt | 8 +- QtQrDec/include/Qrimagedecoder.hpp | 12 +- QtQrGen/CMakeLists.txt | 142 +++++++++++---------- QtQrGen/README.md | 6 +- QtQrGen/examples/CMakeLists.txt | 7 +- QtQrGen/include/Qrimageprovider.hpp | 8 +- README.md | 24 +++- 17 files changed, 274 insertions(+), 222 deletions(-) delete mode 100644 .github/workflows/build-docs.yml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml deleted file mode 100644 index b35e7fc..0000000 --- a/.github/workflows/build-docs.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: build-docs -run-name: ${{ github.actor }} ${{ github.event_name }} to ${{ github.base_ref }} -on: - push: - tags: - - 'v*' -jobs: - build_doxygen: - uses: EddyTheCo/Common/.github/workflows/build-docs.yml@v0.1.2 - permissions: - pages: write - id-token: write diff --git a/.github/workflows/build-test-install.yml b/.github/workflows/build-test-install.yml index 4b43073..654b563 100644 --- a/.github/workflows/build-test-install.yml +++ b/.github/workflows/build-test-install.yml @@ -13,21 +13,33 @@ jobs: matrix: os: [ubuntu-latest,macos-latest,windows-latest] - uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@v0.1.2 - permissions: - contents: write + uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@v0.3.0 with: os: ${{ matrix.os }} qtVersion: '6.6.0' + cmakeArgs: "-DQTDEPLOY=ON -DBUILD_EXAMPLES=ON -DCPACK_PACKAGE_CONTACT=estervtech@gmail.com -DREPO_URL=https://eddytheco.github.io/qrCode -DCPACK_PACKAGE_VENDOR=estervtech" qtModules: 'qtshadertools qtmultimedia' test: false + + build_doxygen: + if: startsWith(github.ref, 'refs/tags/v') + uses: EddyTheCo/Common/.github/workflows/build-docs.yml@v0.3.0 + with: + cmakeArgs: "-DBUILD_QRDEC=OFF -DBUILD_QRGEN=OFF" + release: if: startsWith(github.ref, 'refs/tags/v') - needs: build_test_package + needs: [build_test_package, build_doxygen] runs-on: ubuntu-latest permissions: contents: write + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} steps: @@ -36,7 +48,35 @@ jobs: - uses: actions/download-artifact@v4 with: path: artifacts + - name: Display structure of downloaded files + run: ls -R + + - name: Move repositories to webpage + run: | + mv artifacts/docs/html github-pages + rm -rf artifacts/docs + mkdir github-pages/packages/ ${{runner.temp}}/platforms/ + mv artifacts/*/_CPack_Packages/* ${{runner.temp}}/platforms/ + for i in ${{runner.temp}}/platforms/*; do mv $i/IFW/*/repository/* $i/; rm -rf $i/IFW $i/TGZ; done; + mv ${{runner.temp}}/platforms/* github-pages/packages/ + rm -rf artifacts/*/_CPack_Packages + + - name: Package github-page + working-directory: ${{ github.workspace }}/github-pages/ + run: | + cmake -E make_directory ${{runner.temp}}/page-packages + cmake -E tar c ${{runner.temp}}/page-packages/github-pages.tar -- . + - name: Releases uses: softprops/action-gh-release@v1 with: - files: ./artifacts/*/* + files: ./artifacts/*/* + + - uses: actions/upload-artifact@v4 + with: + name: 'github-pages' + path: ${{runner.temp}}/page-packages/* + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a619e2..605030e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ include(FetchContent) FetchContent_Declare( ccommon GIT_REPOSITORY https://github.com/EddyTheCo/Common.git - GIT_TAG main + GIT_TAG v0.3.0 ) FetchContent_MakeAvailable(ccommon) version_from_git( @@ -24,50 +24,20 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) include(GNUInstallDirs) if(BUILD_QRDEC) - add_subdirectory(QrDec) + add_subdirectory(QrDec) endif(BUILD_QRDEC) if(BUILD_QRENC) - add_subdirectory(QrGen) + add_subdirectory(QrGen) endif(BUILD_QRENC) add_subdirectory(QtQrDec) add_subdirectory(QtQrGen) - -install(EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - NAMESPACE ${PROJECT_NAME}:: - COMPONENT ${PROJECT_NAME} - ) -include(CMakePackageConfigHelpers) -configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - ) -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${VERSION} - COMPATIBILITY SameMajorVersion - ) -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - ) -export(EXPORT ${PROJECT_NAME}-config - FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" - ) +build_exports() if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - set(CPACK_PACKAGE_CONTACT "estervtech") - include(CTest) - set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-v${SEMVER}-${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}") - if(NOT BUILD_SHARED_LIBS) - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-static") - endif(NOT BUILD_SHARED_LIBS) - include(CPack) -endif() + build_cpack() +endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) if(BUILD_DOCS) - get_target_property(build_docs cmake_build_docs SOURCES) - include(${build_docs}) + build_docs() endif() diff --git a/Config.cmake.in b/Config.cmake.in index 7aba8d3..df85b34 100644 --- a/Config.cmake.in +++ b/Config.cmake.in @@ -2,5 +2,5 @@ include(CMakeFindDependencyMacro) find_dependency(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg OPTIONAL_COMPONENTS Multimedia ) find_dependency(OpenCV COMPONENTS core objdetect imgproc flann features2d calib3d ) -find_dependency(EstervDesigns 1.1 COMPONENTS SimpleStyle CustomControls CONFIG) +find_dependency(EstervDesigns 1.2 COMPONENTS SimpleStyle CustomControls CONFIG) include ( "${CMAKE_CURRENT_LIST_DIR}/qrCode-config.cmake" ) diff --git a/QrDec/CMakeLists.txt b/QrDec/CMakeLists.txt index 9e26af9..2c02e87 100755 --- a/QrDec/CMakeLists.txt +++ b/QrDec/CMakeLists.txt @@ -48,19 +48,20 @@ if(OpenCV_FOUND) add_library(QrDec qrcodedec.cpp) add_library(${PROJECT_NAME}::QrDec ALIAS QrDec) + set_target_properties(QrDec PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) target_include_directories(QrDec PUBLIC $) target_link_libraries(QrDec PUBLIC ${OpenCV_LIBS}) target_include_directories(QrDec PUBLIC $ - "$") + "$") install(TARGETS QrDec EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT QrDec ) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME} - COMPONENT QrDec + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv + COMPONENT ${PROJECT_NAME} ) else() message(STATUS "The QRCODE decoding library will not be built") diff --git a/QrDec/README.md b/QrDec/README.md index 8a1a3ca..1d91ca7 100644 --- a/QrDec/README.md +++ b/QrDec/README.md @@ -1,5 +1,7 @@ # QrDec +[TOC] + This repo detect and decode a Qr code in a image. The detection and decoding is performed by [OpenCV](https://opencv.org/) libraries. In case OpenCV is not found on your system CMake will download pre compiled libraries from [my action releases](https://github.com/EddyTheCo/install-OpenCV-action). @@ -10,8 +12,8 @@ include(FetchContent) FetchContent_Declare( qrCode GIT_REPOSITORY https://github.com/EddyTheCo/qrCode.git - GIT_TAG v1.0.0 - FIND_PACKAGE_ARGS 1.0 COMPONENTS QrDec CONFIG + GIT_TAG vMAJOR.MINOR.PATCH + FIND_PACKAGE_ARGS MAJOR.MINOR COMPONENTS QrDec CONFIG ) FetchContent_MakeAvailable(qrCode) diff --git a/QrGen/CMakeLists.txt b/QrGen/CMakeLists.txt index 7cd2870..3bfadff 100755 --- a/QrGen/CMakeLists.txt +++ b/QrGen/CMakeLists.txt @@ -3,9 +3,10 @@ add_library(${PROJECT_NAME}::QrGen ALIAS QrGen) set_target_properties(QrGen PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_target_properties(QrGen PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) target_include_directories(QrGen PUBLIC $ - "$") + "$") install(TARGETS QrGen EXPORT ${PROJECT_NAME}-config @@ -13,7 +14,7 @@ install(TARGETS QrGen COMPONENT QrGen ) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME} - COMPONENT QrGen + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv + COMPONENT ${PROJECT_NAME} ) diff --git a/QrGen/README.md b/QrGen/README.md index 897b479..4844de8 100644 --- a/QrGen/README.md +++ b/QrGen/README.md @@ -1,5 +1,7 @@ # QrGen +[TOC] + The code is based on [QR Code generator library](https://github.com/nayuki/QR-Code-generator) and produce a library for the generation of a QR code of certain data. ## Adding the libraries to your CMake project @@ -8,8 +10,8 @@ include(FetchContent) FetchContent_Declare( qrCode GIT_REPOSITORY https://github.com/EddyTheCo/qrCode.git - GIT_TAG v1.0.0 - FIND_PACKAGE_ARGS 1.0 COMPONENTS QrGen CONFIG + GIT_TAG vMAJOR.MINOR.PATCH + FIND_PACKAGE_ARGS MAJOR.MINOR COMPONENTS QrGen CONFIG ) FetchContent_MakeAvailable(qrCode) diff --git a/QtQrDec/CMakeLists.txt b/QtQrDec/CMakeLists.txt index c38472e..553116d 100644 --- a/QtQrDec/CMakeLists.txt +++ b/QtQrDec/CMakeLists.txt @@ -1,89 +1,90 @@ if(EMSCRIPTEN) - find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools) + find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools) else() - find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools Multimedia) + find_package(Qt6 COMPONENTS Core Gui Qml Quick ShaderTools Multimedia) endif(EMSCRIPTEN) -FetchContent_Declare( - EstervDesigns - GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git - GIT_TAG v1.1.0 - FIND_PACKAGE_ARGS 1.1 COMPONENTS SimpleStyle CustomControls CONFIG -) -FetchContent_MakeAvailable(EstervDesigns) if (Qt6_FOUND AND TARGET QrDec) - qt_standard_project_setup() - qt6_add_qml_module(QtQrDec - URI Esterv.CustomControls.QrDec - VERSION 1.0 - SOURCES Qrimagedecoder.cpp include/Qrimagedecoder.hpp - QML_FILES - "qml/QrCam.qml" - "qml/QrDecPop.qml" - "qml/QrTextField.qml" - RESOURCE_PREFIX - "/esterVtech.com/imports" - OUTPUT_TARGETS out_targets_var - OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrDec - IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_LIBDIR} - ) + FetchContent_Declare( + EstervDesigns + GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git + GIT_TAG v1.2.0 + FIND_PACKAGE_ARGS 1.2 COMPONENTS SimpleStyle CustomControls CONFIG + ) + FetchContent_MakeAvailable(EstervDesigns) + qt_standard_project_setup() + qt6_add_qml_module(QtQrDec + URI Esterv.CustomControls.QrDec + VERSION 1.0 + SOURCES Qrimagedecoder.cpp include/Qrimagedecoder.hpp + QML_FILES + "qml/QrCam.qml" + "qml/QrDecPop.qml" + "qml/QrTextField.qml" + RESOURCE_PREFIX + "/esterVtech.com/imports" + OUTPUT_TARGETS out_targets_var + OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrDec + IMPORT_PATH ${CMAKE_BINARY_DIR} + ) -add_library(${PROJECT_NAME}::QtQrDec ALIAS QtQrDec) -add_library(${PROJECT_NAME}::QtQrDecplugin ALIAS QtQrDecplugin) + add_library(${PROJECT_NAME}::QtQrDec ALIAS QtQrDec) + add_library(${PROJECT_NAME}::QtQrDecplugin ALIAS QtQrDecplugin) + target_compile_definitions(QtQrDec PRIVATE WINDOWS_DEC) + set_target_properties(QtQrDec PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) + qt6_add_shaders(QtQrDec "esterVtech.com.imports.QtQrDec.shaders" + BATCHABLE + PRECOMPILE + OPTIMIZED + OUTPUT_TARGETS out_targets_var2 + PREFIX + "/esterVtech.com/imports/Designs" + FILES + "frag/qrscanner.frag" + ) + target_include_directories(QtQrDec PUBLIC $ + "$") + if(EMSCRIPTEN) + target_compile_definitions(QtQrDec PRIVATE USE_EMSCRIPTEN) + else() + target_link_libraries(QtQrDec PUBLIC Qt6::Multimedia) + endif(EMSCRIPTEN) + target_link_libraries(QtQrDec PUBLIC Qt6::Gui Qt6::Quick QrDec + EstervDesigns::SimpleStyle EstervDesigns::CustomControls + $<$,STATIC_LIBRARY>:EstervDesigns::SimpleStyleplugin> + $<$,STATIC_LIBRARY>:EstervDesigns::CustomControlsplugin>) -qt6_add_shaders(QtQrDec "esterVtech.com.imports.QtQrDec.shaders" - BATCHABLE - PRECOMPILE - OPTIMIZED - OUTPUT_TARGETS out_targets_var2 - PREFIX - "/esterVtech.com/imports/Designs" - FILES - "frag/qrscanner.frag" -) -target_include_directories(QtQrDec PUBLIC $ - "$") -if(EMSCRIPTEN) - target_compile_definitions(QtQrDec PRIVATE USE_EMSCRIPTEN) -else() - target_link_libraries(QtQrDec PUBLIC Qt6::Multimedia) -endif(EMSCRIPTEN) -target_link_libraries(QtQrDec PUBLIC Qt6::Gui Qt6::Quick QrDec - EstervDesigns::SimpleStyle EstervDesigns::CustomControls - $<$,STATIC_LIBRARY>:EstervDesigns::SimpleStyleplugin> - $<$,STATIC_LIBRARY>:EstervDesigns::CustomControlsplugin>) + install(TARGETS QtQrDec ${out_targets_var} ${out_targets_var2} + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT QtQrDec + ) + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv + COMPONENT QtQrDec + ) + install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrDec + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls + COMPONENT QtQrDec + ) -install(TARGETS QtQrDec ${out_targets_var} ${out_targets_var2} - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT QtQrDec -) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME} - COMPONENT QtQrDec -) -install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrDec - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls - COMPONENT QtQrDec -) + install(TARGETS QtQrDecplugin + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrDec + COMPONENT QtQrDec + ) -install(TARGETS QtQrDecplugin - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrDec - COMPONENT QtQrDec -) - -if(EMSCRIPTEN) - target_compile_definitions(QtQrDec PRIVATE USE_EMSCRIPTEN) -endif(EMSCRIPTEN) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - add_subdirectory(examples) -endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + if(EMSCRIPTEN) + target_compile_definitions(QtQrDec PRIVATE USE_EMSCRIPTEN) + endif(EMSCRIPTEN) + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + add_subdirectory(examples) + endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) else(Qt6_FOUND AND TARGET QrDec) - message(STATUS "The QML Module for QRCODE decoding will not be built") + message(STATUS "The QML Module for QRCODE decoding will not be built") endif(Qt6_FOUND AND TARGET QrDec) diff --git a/QtQrDec/README.md b/QtQrDec/README.md index 16dfb32..01dfb94 100644 --- a/QtQrDec/README.md +++ b/QtQrDec/README.md @@ -1,5 +1,7 @@ # QtQrDec +[TOC] + This repo produce a QML Module with custom types that can detect and decode QRCODEs. The types should be style independent, but the colors used relies on the [EstervDesigns](https://github.com/EddyTheCo/MyDesigns) @@ -37,8 +39,8 @@ include(FetchContent) FetchContent_Declare( qrCode GIT_REPOSITORY https://github.com/EddyTheCo/qrCode.git - GIT_TAG v1.0.0 - FIND_PACKAGE_ARGS 1.0 COMPONENTS QtQrDec CONFIG + GIT_TAG vMAJOR.MINOR.PATCH + FIND_PACKAGE_ARGS MAJOR.MINOR COMPONENTS QtQrDec CONFIG ) FetchContent_MakeAvailable(qrCode) diff --git a/QtQrDec/examples/CMakeLists.txt b/QtQrDec/examples/CMakeLists.txt index 576e240..927ef93 100644 --- a/QtQrDec/examples/CMakeLists.txt +++ b/QtQrDec/examples/CMakeLists.txt @@ -28,17 +28,17 @@ if(BUILD_EXAMPLES) WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) - install(TARGETS ${example} - BUNDLE DESTINATION . - DESTINATION ${CMAKE_INSTALL_BINDIR} + install(TARGETS ${example} COMPONENT examples + BUNDLE DESTINATION . COMPONENT examples LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT examples ) if(QTDEPLOY) qt_generate_deploy_qml_app_script( TARGET ${example} OUTPUT_SCRIPT deploy_script ) - install(SCRIPT ${deploy_script}) + install(SCRIPT ${deploy_script} COMPONENT examples) endif(QTDEPLOY) if(ANDROID) set_property(TARGET ${example} APPEND PROPERTY QT_ANDROID_MIN_SDK_VERSION 30) diff --git a/QtQrDec/include/Qrimagedecoder.hpp b/QtQrDec/include/Qrimagedecoder.hpp index 76c2795..58af70a 100644 --- a/QtQrDec/include/Qrimagedecoder.hpp +++ b/QtQrDec/include/Qrimagedecoder.hpp @@ -17,7 +17,15 @@ #include -class QRImageDecoder : public QObject +#include +#if defined(WINDOWS_DEC) +# define DEC_EXPORT Q_DECL_EXPORT +#else +#define DEC_EXPORT Q_DECL_IMPORT +#endif + + +class DEC_EXPORT QRImageDecoder : public QObject { Q_OBJECT Q_PROPERTY(QString source READ get_source NOTIFY sourceChanged) @@ -66,7 +74,7 @@ class QRImageDecoder : public QObject }; -class WasmImageProvider : public QQuickImageProvider +class DEC_EXPORT WasmImageProvider : public QQuickImageProvider { public: WasmImageProvider():QQuickImageProvider(QQuickImageProvider::Image) diff --git a/QtQrGen/CMakeLists.txt b/QtQrGen/CMakeLists.txt index ebbd8b7..bbc88e2 100644 --- a/QtQrGen/CMakeLists.txt +++ b/QtQrGen/CMakeLists.txt @@ -1,76 +1,86 @@ find_package(Qt6 COMPONENTS Core Gui Qml Quick OPTIONAL_COMPONENTS Svg) if (Qt6_FOUND AND TARGET QrGen) - qt_standard_project_setup() - qt6_add_qml_module(QtQrGen - URI Esterv.CustomControls.QrGen - VERSION ${VERSION} - SOURCES Qrimageprovider.cpp include/Qrimageprovider.hpp - QML_FILES - "qml/QrGenImage.qml" - "qml/QrGenPop.qml" - "qml/QrText.qml" - RESOURCE_PREFIX - "/esterVtech.com/imports" - OUTPUT_TARGETS out_targets_var - OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrGen - IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_LIBDIR} - ) + FetchContent_Declare( + EstervDesigns + GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git + GIT_TAG v1.2.0 + FIND_PACKAGE_ARGS 1.2 COMPONENTS SimpleStyle CustomControls CONFIG + ) + FetchContent_MakeAvailable(EstervDesigns) + qt_standard_project_setup() + qt6_add_qml_module(QtQrGen + URI Esterv.CustomControls.QrGen + VERSION ${VERSION} + SOURCES Qrimageprovider.cpp include/Qrimageprovider.hpp + QML_FILES + "qml/QrGenImage.qml" + "qml/QrGenPop.qml" + "qml/QrText.qml" + RESOURCE_PREFIX + "/esterVtech.com/imports" + OUTPUT_TARGETS out_targets_var + OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrGen + IMPORT_PATH ${CMAKE_BINARY_DIR} + ) -add_library(${PROJECT_NAME}::QtQrGen ALIAS QtQrGen) -add_library(${PROJECT_NAME}::QtQrGenplugin ALIAS QtQrGenplugin) -qt6_add_shaders(QtQrGen "esterVtech.com.imports.QtQrGen.shaders" - BATCHABLE - PRECOMPILE - OPTIMIZED - OUTPUT_TARGETS out_targets_var2 - PREFIX - "/esterVtech.com/imports/Designs" - FILES - "frag/qrscanner.frag" -) + add_library(${PROJECT_NAME}::QtQrGen ALIAS QtQrGen) + add_library(${PROJECT_NAME}::QtQrGenplugin ALIAS QtQrGenplugin) + set_target_properties(QtQrGen PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) + target_compile_definitions(QtQrGen PRIVATE WINDOWS_GEN) -target_include_directories(QtQrGen PUBLIC $ - "$") -if(NOT TARGET Qt6::Svg) - FetchContent_Declare( - qtsvg - GIT_REPOSITORY git://code.qt.io/qt/qtsvg.git - GIT_TAG 6.5.0 - ) -FetchContent_MakeAvailable(qtsvg) -endif() + qt6_add_shaders(QtQrGen "esterVtech.com.imports.QtQrGen.shaders" + BATCHABLE + PRECOMPILE + OPTIMIZED + OUTPUT_TARGETS out_targets_var2 + PREFIX + "/esterVtech.com/imports/Designs" + FILES + "frag/qrscanner.frag" + ) + target_include_directories(QtQrGen PUBLIC $ + "$") + if(NOT TARGET Qt6::Svg) + FetchContent_Declare( + qtsvg + GIT_REPOSITORY https://github.com/qt/qtsvg.git + GIT_TAG 6.6.0 + ) + FetchContent_MakeAvailable(qtsvg) + endif() -target_link_libraries(QtQrGen PUBLIC - Qt6::Quick -) -target_link_libraries(QtQrGen PRIVATE QrGen Qt6::Core Qt6::Gui Qt6::Qml Qt6::Svg - EstervDesigns::SimpleStyle EstervDesigns::CustomControls - $<$,STATIC_LIBRARY>:EstervDesigns::SimpleStyleplugin> - $<$,STATIC_LIBRARY>:EstervDesigns::CustomControlsplugin>) -install(TARGETS QtQrGen ${out_targets_var} ${out_targets_var2} - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT QtQrGen -) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME} - COMPONENT QtQrGen -) -install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrGen - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls - COMPONENT QtQrGen -) + target_link_libraries(QtQrGen PUBLIC + Qt6::Quick + ) + target_link_libraries(QtQrGen PRIVATE QrGen Qt6::Core Qt6::Gui Qt6::Qml Qt6::Svg + EstervDesigns::SimpleStyle EstervDesigns::CustomControls + $<$,STATIC_LIBRARY>:EstervDesigns::SimpleStyleplugin> + $<$,STATIC_LIBRARY>:EstervDesigns::CustomControlsplugin>) -install(TARGETS QtQrGenplugin - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrGen - COMPONENT QtQrGen -) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - add_subdirectory(examples) -endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + install(TARGETS QtQrGen ${out_targets_var} ${out_targets_var2} + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT QtQrGen + ) + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv + COMPONENT QtQrGen + ) + install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/CustomControls/QrGen + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls + COMPONENT QtQrGen + ) + + install(TARGETS QtQrGenplugin + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/CustomControls/QrGen + COMPONENT QtQrGen + ) + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + add_subdirectory(examples) + endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif(Qt6_FOUND AND TARGET QrGen) diff --git a/QtQrGen/README.md b/QtQrGen/README.md index 3e3e8ae..658dbe3 100644 --- a/QtQrGen/README.md +++ b/QtQrGen/README.md @@ -1,5 +1,7 @@ # QtQrGen +[TOC] + This code produce a QML module with custom types and a custom ImageProvider of Qt. The custom types are related to the generation and showing of QRCODEs. @@ -34,8 +36,8 @@ include(FetchContent) FetchContent_Declare( qrCode GIT_REPOSITORY https://github.com/EddyTheCo/qrCode.git - GIT_TAG v1.0.0 - FIND_PACKAGE_ARGS 1.0 COMPONENTS QtQrGen CONFIG + GIT_TAG vMAJOR.MINOR.PATCH + FIND_PACKAGE_ARGS MAJOR.MINOR COMPONENTS QtQrGen CONFIG ) FetchContent_MakeAvailable(qrCode) diff --git a/QtQrGen/examples/CMakeLists.txt b/QtQrGen/examples/CMakeLists.txt index 009f3f6..14ce0ba 100644 --- a/QtQrGen/examples/CMakeLists.txt +++ b/QtQrGen/examples/CMakeLists.txt @@ -25,9 +25,8 @@ if(BUILD_EXAMPLES) WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) - install(TARGETS ${example} - BUNDLE DESTINATION . - DESTINATION ${CMAKE_INSTALL_BINDIR} + install(TARGETS ${example} COMPONENT examples + BUNDLE DESTINATION . COMPONENT examples LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) if(QTDEPLOY) @@ -35,7 +34,7 @@ if(BUILD_EXAMPLES) TARGET ${example} OUTPUT_SCRIPT deploy_script ) - install(SCRIPT ${deploy_script}) + install(SCRIPT ${deploy_script} COMPONENT examples) endif(QTDEPLOY) if(ANDROID) set_property(TARGET ${example} APPEND PROPERTY QT_ANDROID_MIN_SDK_VERSION 30) diff --git a/QtQrGen/include/Qrimageprovider.hpp b/QtQrGen/include/Qrimageprovider.hpp index b455aba..df949d0 100644 --- a/QtQrGen/include/Qrimageprovider.hpp +++ b/QtQrGen/include/Qrimageprovider.hpp @@ -1,7 +1,13 @@ #include +#include +#if defined(WINDOWS_GEN) +# define GEN_EXPORT Q_DECL_EXPORT +#else +#define GEN_EXPORT Q_DECL_IMPORT +#endif -class QRImageProvider : public QQuickImageProvider +class GEN_EXPORT QRImageProvider : public QQuickImageProvider { public: QRImageProvider(int erc=0) diff --git a/README.md b/README.md index d403460..94efc35 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # qrCode +[TOC] + This repository is intended to provide a library for working with QR codes from c++. The main purpose is to exploit modern CMake and facilitate reuse and develop. The GUI part will be based on Qt libraries and QML. Examples of this library compiled for Web Assembly can be found on: @@ -13,8 +15,8 @@ include(FetchContent) FetchContent_Declare( qrCode GIT_REPOSITORY https://github.com/EddyTheCo/qrCode.git - GIT_TAG v1.0.0 - FIND_PACKAGE_ARGS 1.0 CONFIG + GIT_TAG vMAJOR.MINOR.PATCH + FIND_PACKAGE_ARGS MAJOR.MINOR CONFIG ) FetchContent_MakeAvailable(qrCode) @@ -26,3 +28,21 @@ For more information check - [QrDec](QrDec/README.md) - [QtQrGen](QtQrGen/README.md) - [QtQrDec](QtQrDec/README.md) + +## API reference + +You can read the [API reference](https://eddytheco.github.io/qrCode/) here, or generate it yourself like +``` +cmake -DBUILD_DOCS=ON ../ +cmake --build . --target doxygen_docs +``` + +## Contributing + +We appreciate any contribution! + + +You can open an issue or request a feature. +You can open a PR to the `develop` branch and the CI/CD will take care of the rest. +Make sure to acknowledge your work, and ideas when contributing. +