From e798c3c584f2c6c16d8b3b2567c632807f65216b Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Lazo <30321688+EddyTheCo@users.noreply.github.com> Date: Sun, 24 Mar 2024 16:02:19 +0100 Subject: [PATCH] use IFW and fix deploy bundle --- .github/workflows/build-docs.yml | 12 - .github/workflows/build-test-install.yml | 51 ++++- CMakeLists.txt | 280 ++++++++++++----------- README.md | 2 + 4 files changed, 192 insertions(+), 153 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 a27bf04..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 ca7ac70..b6ee909 100644 --- a/.github/workflows/build-test-install.yml +++ b/.github/workflows/build-test-install.yml @@ -13,19 +13,30 @@ 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@use_IFW with: os: ${{ matrix.os }} - qtVersion: '6.6.0' + qtVersion: '6.6.0' + cmakeArgs: "-DCPACK_PACKAGE_CONTACT=estervtech@gmail.com -DREPO_URL=https://eddytheco.github.io/QVault -DCPACK_PACKAGE_VENDOR=estervtech" + test: false + + build_doxygen: + if: startsWith(github.ref, 'refs/tags/v') + uses: EddyTheCo/Common/.github/workflows/build-docs.yml@use_IFW + 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: @@ -34,7 +45,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 3754e71..74cacb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,16 @@ include(${CMAKE_CURRENT_BINARY_DIR}/local_conf.cmake OPTIONAL) include(FetchContent) FetchContent_Declare( - ccommon - GIT_REPOSITORY https://github.com/EddyTheCo/Common.git - GIT_TAG v0.1.1 -) + ccommon + GIT_REPOSITORY https://github.com/EddyTheCo/Common.git + GIT_TAG use_IFW + ) FetchContent_MakeAvailable(ccommon) version_from_git( - LOG OFF - TIMESTAMP "%Y%m%d%H%M%S" -) -project(QtVault VERSION ${VERSION} DESCRIPTION "Store encrypted and plain data on the system" LANGUAGES CXX) + LOG OFF + TIMESTAMP "%Y%m%d%H%M%S" + ) +project(QtVault VERSION ${VERSION} DESCRIPTION "Store encrypted data on the local system" LANGUAGES CXX) set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_CXX_STANDARD 17) @@ -23,9 +23,9 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) include(GNUInstallDirs) if(USE_QML) - find_package(Qt6 COMPONENTS Core Gui Quick Core Network) + find_package(Qt6 COMPONENTS Core Gui Quick Core Network) else() - find_package(Qt6 COMPONENTS Core Network) + find_package(Qt6 COMPONENTS Core Network) endif() @@ -33,137 +33,147 @@ find_package(OpenSSL) if(NOT OPENSSL_FOUND) - if(EMSCRIPTEN OR ANDROID) - if(EMSCRIPTEN) - set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_true-android_none.tar") - endif(EMSCRIPTEN) - if(ANDROID) - set(android_abi_ossl "android-arm") - if(ANDROID_ABI STREQUAL "arm64-v8a") - set(android_abi_ossl "android-arm64") - endif() - set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_false-android_${android_abi_ossl}.tar") - endif(ANDROID) - FetchContent_Declare( - openssl - DOWNLOAD_EXTRACT_TIMESTAMP true - URL ${builturl} - ) - FetchContent_GetProperties(openssl) - if(NOT openssl_POPULATED) - message(STATUS "openssl prebuilt will be downloaded from ${builturl} if not found on the system") - FetchContent_Populate(openssl) - message(STATUS "openssl is installed in ${openssl_SOURCE_DIR}") - set(OPENSSL_FOUND ON) - endif(NOT openssl_POPULATED) - include(${openssl_SOURCE_DIR}/openssl.cmake) - create_targets() -endif(EMSCRIPTEN OR ANDROID ) + if(EMSCRIPTEN OR ANDROID) + if(EMSCRIPTEN) + set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_true-android_none.tar") + endif(EMSCRIPTEN) + if(ANDROID) + set(android_abi_ossl "android-arm") + if(ANDROID_ABI STREQUAL "arm64-v8a") + set(android_abi_ossl "android-arm64") + endif() + set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_false-android_${android_abi_ossl}.tar") + endif(ANDROID) + FetchContent_Declare( + openssl + DOWNLOAD_EXTRACT_TIMESTAMP true + URL ${builturl} + ) + FetchContent_GetProperties(openssl) + if(NOT openssl_POPULATED) + message(STATUS "openssl prebuilt will be downloaded from ${builturl} if not found on the system") + FetchContent_Populate(openssl) + message(STATUS "openssl is installed in ${openssl_SOURCE_DIR}") + set(OPENSSL_FOUND ON) + endif(NOT openssl_POPULATED) + include(${openssl_SOURCE_DIR}/openssl.cmake) + create_targets() + endif(EMSCRIPTEN OR ANDROID ) endif(NOT OPENSSL_FOUND) if(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND) - qt_standard_project_setup() - add_library(vault include/vault.hpp src/vault.cpp) - add_library(${PROJECT_NAME}::vault ALIAS vault) - if(USE_QML) - qt6_add_qml_module(vault - URI Esterv.Utils.Vault - VERSION 1.0 - RESOURCE_PREFIX - "/esterVtech.com/imports" - OUTPUT_TARGETS out_targets_var - OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault - IMPORT_PATH ${CMAKE_BINARY_DIR} - ) - add_library(${PROJECT_NAME}::vaultplugin ALIAS vaultplugin) - target_link_libraries(vault PUBLIC Qt6::Gui Qt6::Quick) - target_compile_definitions(vault PRIVATE USE_QML) - - install(TARGETS ${out_targets_var} - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT vault - ) -install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils - COMPONENT vault -) -install(TARGETS vaultplugin - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils/Vault - COMPONENT vault -) -endif(USE_QML) - - -target_include_directories(vault PUBLIC $ - "$") - -target_link_libraries(vault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto) -target_compile_definitions(vault PRIVATE WINDOWS_QVAULT) -if(EMSCRIPTEN) - target_compile_definitions(vault PRIVATE USE_EMSCRIPTEN) -endif(EMSCRIPTEN) - -if(NOT EMSCRIPTEN AND NOT ANDROID) - add_executable(QVaultCli src/QVaultCli.cpp) - target_link_libraries(QVaultCli PRIVATE vault) - add_executable(${PROJECT_NAME}::QVaultCli ALIAS QVaultCli) - install(TARGETS QVaultCli - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT QVaultCli - ) -endif(NOT EMSCRIPTEN AND NOT ANDROID) - - -install(TARGETS vault - EXPORT ${PROJECT_NAME}-config - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT vault -) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME} - COMPONENT vault -) - -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" -) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - add_subdirectory(examples) - 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}") - include(CPack) -endif() - + qt_standard_project_setup() + add_library(vault include/vault.hpp src/vault.cpp) + add_library(${PROJECT_NAME}::vault ALIAS vault) + set_target_properties(vault PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) + if(USE_QML) + qt6_add_qml_module(vault + URI Esterv.Utils.Vault + VERSION 1.0 + RESOURCE_PREFIX + "/esterVtech.com/imports" + OUTPUT_TARGETS out_targets_var + OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault + IMPORT_PATH ${CMAKE_BINARY_DIR} + ) + add_library(${PROJECT_NAME}::vaultplugin ALIAS vaultplugin) + target_link_libraries(vault PUBLIC Qt6::Gui Qt6::Quick) + target_compile_definitions(vault PRIVATE USE_QML) + + install(TARGETS ${out_targets_var} + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT vault + ) + install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils + COMPONENT vault + ) + install(TARGETS vaultplugin + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils/Vault + COMPONENT vault + ) + endif(USE_QML) + + + target_include_directories(vault PUBLIC $ + "$") + + target_link_libraries(vault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto) + target_compile_definitions(vault PRIVATE WINDOWS_QVAULT) + if(EMSCRIPTEN) + target_compile_definitions(vault PRIVATE USE_EMSCRIPTEN) + endif(EMSCRIPTEN) + + if(NOT EMSCRIPTEN AND NOT ANDROID) + add_executable(QVaultCli src/QVaultCli.cpp) + target_link_libraries(QVaultCli PRIVATE vault) + add_executable(${PROJECT_NAME}::QVaultCli ALIAS QVaultCli) + install(TARGETS QVaultCli + BUNDLE DESTINATION . + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT vaultCli + ) + qt_generate_deploy_app_script( + TARGET QVaultCli + OUTPUT_SCRIPT deploy_script + ) + install(SCRIPT ${deploy_script} COMPONENT vaultCli) + endif(NOT EMSCRIPTEN AND NOT ANDROID) + + + install(TARGETS vault + EXPORT ${PROJECT_NAME}-config + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT vault + ) + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv + COMPONENT vault + ) + + 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" + ) + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + add_subdirectory(examples) + set(cpack_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_file_name "${cpack_file_name}-static") + endif(NOT BUILD_SHARED_LIBS) + set(CPACK_PACKAGE_FILE_NAME ${cpack_file_name}) + include(CPack) + include(CPackIFW) + cpack_add_component(vault) + cpack_ifw_configure_component(vault LICENSES "License" ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE) + cpack_ifw_add_repository("Repo" URL "${REPO_URL}/packages/${CMAKE_SYSTEM_NAME}/" ) + endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND) if(BUILD_DOCS) - get_target_property(build_docs cmake_build_docs SOURCES) - include(${build_docs}) + build_docs() endif() diff --git a/README.md b/README.md index e29b128..9a67ba2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Esterv.Utils.Vault +[TOC] + This repo implements a C++ class and QML Module for storing encrypted data as a vault. The vault is stored on the local storage of the user. I have tested the library on Linux, Android, and the Browser.