diff options
author | saturneric <[email protected]> | 2024-07-29 19:23:56 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-29 19:23:56 +0000 |
commit | d0aa53324734306459f7f0062b4801408bbaf58b (patch) | |
tree | d22c1e3ae0eb06405c0abf94d3364973cc651159 | |
parent | fix: distinguishing Error Alerts for Ppaer Key Operation Failures (diff) | |
parent | fix: solve some known issues at ci build configs (diff) | |
download | GpgFrontend-d0aa53324734306459f7f0062b4801408bbaf58b.tar.gz GpgFrontend-d0aa53324734306459f7f0062b4801408bbaf58b.zip |
Merge branch 'develop' of ssh://ssh.git.bktus.com:2222/GpgFrontend/GpgFrontend into develop
-rw-r--r-- | .github/workflows/codeql-analysis.yml | 15 | ||||
-rw-r--r-- | .github/workflows/doxygen-genration.yml | 3 | ||||
-rw-r--r-- | .github/workflows/release-qt5.yml | 59 | ||||
-rw-r--r-- | .github/workflows/release.yml | 69 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 300 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyImportExporter.cpp | 8 | ||||
-rw-r--r-- | src/sdk/GFSDKBuildInfo.h | 36 | ||||
-rw-r--r-- | src/test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 2 | ||||
-rw-r--r-- | third_party/CMakeLists.txt | 36 | ||||
m--------- | third_party/mimalloc | 0 |
13 files changed, 278 insertions, 260 deletions
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 62d41ce4..9ff1d59b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -15,15 +15,12 @@ on: push: branches: [ main ] pull_request: - # The branches below must be a subset of the branches above branches: [ main ] schedule: - cron: '19 14 * * 2' env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Debug - EXECUTABLE_OUTPUT_PATH: ./ jobs: analyze: @@ -38,9 +35,6 @@ jobs: fail-fast: false matrix: language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - name: Checkout repository @@ -49,15 +43,10 @@ jobs: lfs: 'false' submodules: recursive - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Install Dependence run: | @@ -102,8 +91,8 @@ jobs: - name: Configure CMake && Build GpgFrontend run: | - cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_TEST_UI=ON + cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON cmake --build ${{github.workspace}}/build --config {{$env.BUILD_TYPE}} -- -v - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/doxygen-genration.yml b/.github/workflows/doxygen-genration.yml index ddb2723f..c23da8d2 100644 --- a/.github/workflows/doxygen-genration.yml +++ b/.github/workflows/doxygen-genration.yml @@ -4,8 +4,7 @@ on: push: branches: [ main, 'develop' ] paths-ignore: - - 'resource/locale/template/**' - - 'manual/**' + - 'resource/lfs/locale/**' - '**.md' jobs: diff --git a/.github/workflows/release-qt5.yml b/.github/workflows/release-qt5.yml index ae8b857c..c0b18701 100644 --- a/.github/workflows/release-qt5.yml +++ b/.github/workflows/release-qt5.yml @@ -4,20 +4,17 @@ on: push: branches: [ main, 'develop' ] paths-ignore: - - 'resource/locale/**' - - 'manual/**' + - 'resource/lfs/locale/**' - '**.md' pull_request: branches: [ main, 'develop' ] paths-ignore: - - 'resource/locale/**' - - 'manual/**' + - 'resource/lfs/locale/**' - '**.md' env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release - EXECUTABLE_OUTPUT_PATH: ./ jobs: build: @@ -54,7 +51,7 @@ jobs: run: | pacman --noconfirm -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake autoconf pacman --noconfirm -S --needed make texinfo automake - pacman --noconfirm -S --needed mingw-w64-x86_64-qt5 libintl msys2-runtime-devel gettext-devel + pacman --noconfirm -S --needed mingw-w64-x86_64-qt5 mingw-w64-x86_64-angleproject libintl msys2-runtime-devel gettext-devel pacman --noconfirm -S --needed mingw-w64-x86_64-ninja mingw-w64-x86_64-gnupg mingw-w64-x86_64-libarchive if: matrix.os == 'windows-2019' @@ -140,6 +137,35 @@ jobs: cd ${{github.workspace}} if: matrix.os == 'ubuntu-20.04' + - name: Build mimalloc (Linux) + run: | + cd ${{github.workspace}}/third_party/mimalloc + mkdir build && cd build + cmake -G Ninja -DMI_SECURE=ON .. + ninja + sudo ninja install + if: matrix.os == 'ubuntu-20.04' + + - name: Build mimalloc (Windows) + shell: msys2 {0} + run: | + cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') + cd third_party/mimalloc + mkdir build && cd build + cmake -G Ninja -DMI_SECURE=ON .. + ninja + sudo ninja install + if: matrix.os == 'windows-2019' + + - name: Build googletest (Linux) + run: | + cd ${{github.workspace}}/third_party/googletest + mkdir build && cd build + cmake -G Ninja .. + ninja + sudo ninja install + if: matrix.os == 'ubuntu-20.04' + - name: Configure CMake & Build Binary(Windows) shell: msys2 {0} run: | @@ -163,18 +189,31 @@ jobs: wget -c -nv https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage chmod u+x linuxdeployqt-continuous-x86_64.AppImage ./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -no-translations -extra-plugins=iconengines -appimage + echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV} + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV} if: matrix.os == 'ubuntu-20.04' + + + - name: Copy Modules & Package (Windows) + shell: msys2 {0} + run: | + cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') + cd build + windeployqt --no-translations --force ./artifacts/GpgFrontend.exe + echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV} + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV} + if: matrix.os == 'windows-2019' - name: Upload Artifact(Linux) - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{ env.SHORT_SHA }} path: ${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage* if: matrix.os == 'ubuntu-20.04' - name: Upload Artifact(Windows) - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + name: gpgfrontend-${{matrix.os}}--${{env.BUILD_TYPE_LOWER}}-${{ env.SHORT_SHA }} path: ${{github.workspace}}/build/artifacts/* if: matrix.os == 'windows-2019' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 783f5b83..27d679be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,20 +4,17 @@ on: push: branches: [ main, 'develop' ] paths-ignore: - - 'resource/locale/**' - - 'manual/**' + - 'resource/lfs/locale/**' - '**.md' pull_request: branches: [ main, 'develop' ] paths-ignore: - - 'resource/locale/**' - - 'manual/**' + - 'resource/lfs/locale/**' - '**.md' env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + # Customize the CMake build type here (Release, Debug, etc.) BUILD_TYPE: Release - EXECUTABLE_OUTPUT_PATH: ./ jobs: build: @@ -84,7 +81,7 @@ jobs: - name: Install Dependence (macOS) run: | brew install cmake autoconf automake texinfo gettext openssl@3 - brew install ninja libarchive gpgme + brew install ninja libarchive gpgme googletest brew link openssl@3 --force if: matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' @@ -100,14 +97,9 @@ jobs: run: | pacman --noconfirm -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake autoconf pacman --noconfirm -S --needed make texinfo automake - pacman --noconfirm -S --needed libintl msys2-runtime-devel gettext-devel + pacman --noconfirm -S --needed mingw-w64-x86_64-qt6 mingw-w64-x86_64-icu libintl msys2-runtime-devel gettext-devel pacman --noconfirm -S --needed mingw-w64-x86_64-ninja mingw-w64-x86_64-gnupg mingw-w64-x86_64-libarchive - wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-icu-73.2-1-any.pkg.tar.zst - wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-qt6-base-6.5.3-1-any.pkg.tar.zst - wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-qt6-5compat-6.5.3-1-any.pkg.tar.zst - wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-qt6-svg-6.5.3-1-any.pkg.tar.zst - wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-qt6-tools-6.5.3-1-any.pkg.tar.zst - pacman --noconfirm -U *.pkg.tar.zst + pacman --noconfirm -S --needed mingw-w64-x86_64-gtest if: matrix.os == 'windows-2019' - name: Build gpg-error (Linux) @@ -173,6 +165,35 @@ jobs: cd ${{github.workspace}} if: matrix.os == 'windows-2019' + - name: Build mimalloc (Linux) + run: | + cd ${{github.workspace}}/third_party/mimalloc + mkdir build && cd build + cmake -G Ninja -DMI_SECURE=ON .. + ninja + sudo ninja install + if: matrix.os == 'ubuntu-20.04' + + - name: Build mimalloc (Windows) + shell: msys2 {0} + run: | + cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') + cd third_party/mimalloc + mkdir build && cd build + cmake -G Ninja -DMI_SECURE=ON .. + ninja + sudo ninja install + if: matrix.os == 'windows-2019' + + - name: Build googletest (Linux) + run: | + cd ${{github.workspace}}/third_party/googletest + mkdir build && cd build + cmake -G Ninja .. + ninja + sudo ninja install + if: matrix.os == 'ubuntu-20.04' + - name: Build & Install Full SDK run: | cmake -B ${{github.workspace}}/build-full-sdk -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_FULL_SDK=ON @@ -258,6 +279,8 @@ jobs: --team-id ${{secrets.APPLE_DEVELOPER_TEAM_ID}} \ --password ${{secrets.APPLE_DEVELOPER_ID_SECRET}} \ ${{github.workspace}}/build/GpgFrontend-${{env.sha_short}}-x86_64.zip + echo "BUILD_TYPE_LOWER=$(echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_ENV} + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV} if: matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' - name: Build GpgFrontend (Linux) @@ -276,14 +299,16 @@ jobs: chmod u+x linuxdeployqt-continuous-x86_64.AppImage export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -no-translations -extra-plugins=iconengines -appimage -executable-dir=${{github.workspace}}/build/artifacts/AppDir/usr/modules/ + echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV} + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV} if: matrix.os == 'ubuntu-20.04' - - name: Configure CMake & Build Binary (Windows) + - name: Configure CMake & Build Application (Windows) shell: msys2 {0} run: | cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') mkdir build && cd build - cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON .. + cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_ONLY_APPLICATION=ON .. cmake --build . --config ${{env.BUILD_TYPE}} -- -j 4 if: matrix.os == 'windows-2019' @@ -292,28 +317,30 @@ jobs: run: | cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') mkdir -p build/artifacts/modules - cp -r modules/build/artifacts/* build/artifacts/modules + cp -r modules/build/artifacts/bin/* build/artifacts/modules cd build - windeployqt-qt6 --force --libdir ./artifacts --release ./artifacts/GpgFrontend.exe + windeployqt-qt6 --no-translations --force ./artifacts/GpgFrontend.exe + echo "BUILD_TYPE_LOWER=${BUILD_TYPE,,}" >> ${GITHUB_ENV} + echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> ${GITHUB_ENV} if: matrix.os == 'windows-2019' - name: Upload Artifact (Linux) uses: actions/upload-artifact@master with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}} path: ${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage* if: matrix.os == 'ubuntu-20.04' - name: Upload Artifact (macOS) uses: actions/upload-artifact@master with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}} path: ${{github.workspace}}/build/final-artifact/* if: matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' - name: Upload Artifact (Windows) uses: actions/upload-artifact@master with: - name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE_LOWER}}-${{env.SHORT_SHA}} path: ${{github.workspace}}/build/artifacts/* if: matrix.os == 'windows-2019' @@ -4,6 +4,7 @@ src/GpgFrontendBuildInfo.h src/GpgFrontendBuildInstallInfo.h src/core/GpgFrontendCoreExport.h src/ui/GpgFrontendUIExport.h +src/sdk/GFSDKBuildInfo.h docs/ # gettext diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7cc190a3..28f30f13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,11 @@ endif() find_package(OpenSSL REQUIRED) +# mimalloc +if(NOT APPLE) + find_package(mimalloc REQUIRED) +endif() + # Set Build Information configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontend.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontend.h @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h @ONLY) @@ -136,165 +141,190 @@ if(BUILD_APPLICATION) endif() endif() -if(BUILD_APPLICATION) - # Copy Utils Files - if(MINGW) - message(STATUS "Copying Dependent DLL For Windows Runtime Env") - - set(ALL_RUNTIME_DEP_PATH_LIST "") - - # get mingw bin path - find_file(_libGccDllPath NAMES libgcc_s_seh-1.dll NO_CACHE REQUIRED) - cmake_path(GET _libGccDllPath PARENT_PATH _libDllBinPath) - - # find libicu*.dll - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libicu[a-z]*[0-9][0-9].dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libassuan*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libbz*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libcrypto-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libexpat-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libfreetype-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libgcc_s_seh-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) +if(BUILD_APPLICATION AND MINGW) + message(STATUS "Copying Dependent DLL For Windows Runtime Env") - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libglib-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libgpg-error*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + # all dep dll list + set(ALL_RUNTIME_DEP_PATH_LIST "") - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libgpgme*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libgraphite2.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libharfbuzz-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libiconv-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + # /mingw64/libexec + execute_process( + COMMAND cygpath -m /mingw64/bin + OUTPUT_VARIABLE MSYS64_BIN_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libintl-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + # find libicu*.dll + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libicu[a-z]*[0-9][0-9].dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/liblz4.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libassuan*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/liblzma-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libpcre-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libpcre2-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libbz*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libcrypto-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libexpat-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libfreetype-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgcc_s_seh-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libglib-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgpg-error*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgpgme*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgraphite2.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libharfbuzz-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libiconv-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libintl-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/liblz4.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/liblzma-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libpcre-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libpcre2-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libpng*-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libstdc++-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libwinpthread-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/zlib*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libb2-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + # openssl + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libssl-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libcrypto-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + unset(_libDllPath) + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libxml2-*.dll") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + + # /mingw64/libexec + execute_process( + COMMAND cygpath -m /mingw64/libexec + OUTPUT_VARIABLE MSYS64_LIBEXEC_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libpng*-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + # gpgme-w32spawn.exe + unset(_libExEPath) + file(GLOB _libExEPath "${MSYS64_LIBEXEC_PATH}/gpgme-*.exe") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libExEPath}) - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libstdc++-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - - unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libwinpthread-*.dll") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + unset(_libExEPath) + file(GLOB _libExEPath "${MSYS64_BIN_PATH}/gpgme-*.exe") + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libExEPath}) + # add gpgfrontend libraries + if(STABLE_BUILD_ONLY_APPLICATION) unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/zlib*.dll") + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgpgfrontend_*.dll") list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libb2-*.dll") + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libmimalloc*.dll") list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) - # openssl unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libssl-*.dll") + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/mimalloc*.dll") list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libcrypto-*.dll") + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libarchive*.dll") list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) unset(_libDllPath) - file(GLOB _libDllPath "${_libDllBinPath}/libxml2-*.dll") + file(GLOB _libDllPath "${MSYS64_BIN_PATH}/libgtest*.dll") list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libDllPath}) + endif() - # /mingw64/libexec - execute_process( - COMMAND cygpath -m /mingw64/libexec - OUTPUT_VARIABLE MSYS64_LIBEXEC_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - # gpgme-w32spawn.exe - unset(_libExEPath) - file(GLOB _libExEPath "${MSYS64_LIBEXEC_PATH}/gpgme-*.exe") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libExEPath}) - - unset(_libExEPath) - file(GLOB _libExEPath "${_libDllBinPath}/gpgme-*.exe") - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libExEPath}) - - set(ALL_RUNTIME_DLL_FILES "") + # dll with only name + set(ALL_RUNTIME_DLL_FILES "") - if(GPGFRONTEND_QT5_BUILD) - list(APPEND ALL_RUNTIME_DLL_FILES "Qt5Core.dll;Qt5Gui.dll;Qt5Network.dll;Qt5PrintSupport.dll;Qt5Svg.dll;Qt5Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") - else() - list(APPEND ALL_RUNTIME_DLL_FILES "Qt6Core.dll;Qt6Core5Compat.dll;Qt6Gui.dll;Qt6Network.dll;Qt6PrintSupport.dll;Qt6Svg.dll;Qt6Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") - endif() + if(GPGFRONTEND_QT5_BUILD) + list(APPEND ALL_RUNTIME_DLL_FILES "Qt5Core.dll;Qt5Gui.dll;Qt5Network.dll;Qt5PrintSupport.dll;Qt5Svg.dll;Qt5Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + else() + list(APPEND ALL_RUNTIME_DLL_FILES "Qt6Core.dll;Qt6Core5Compat.dll;Qt6Gui.dll;Qt6Network.dll;Qt6PrintSupport.dll;Qt6Svg.dll;Qt6Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + endif() - # find the other dlls - foreach(_dllFileName ${ALL_RUNTIME_DLL_FILES}) - message(STATUS "DLL FILE ${_dllFileName}") - list(APPEND ALL_DLL_NAME ${_dllFileName}) - unset(_runtimeDllLocalPath) + # find the other dlls + foreach(_dllFileName ${ALL_RUNTIME_DLL_FILES}) + message(STATUS "DLL FILE ${_dllFileName}") + list(APPEND ALL_DLL_NAME ${_dllFileName}) + unset(_runtimeDllLocalPath) - find_file(_runtimeDllLocalPath NAMES ${_dllFileName} NO_CACHE REQUIRED) - list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_runtimeDllLocalPath}) - message(STATUS "DLL ${_dllFileName} Path is ${_runtimeDllLocalPath}") - endforeach() + find_file(_runtimeDllLocalPath NAMES ${_dllFileName} NO_CACHE REQUIRED) + list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_runtimeDllLocalPath}) + message(STATUS "DLL: ${_dllFileName} , ITS Full Path is ${_runtimeDllLocalPath}") + endforeach() - message(STATUS "All Runtime Dependencies Path ${ALL_RUNTIME_DEP_PATH_LIST}") + message(STATUS "All the Application Runtime Dependencies Path: ${ALL_RUNTIME_DEP_PATH_LIST}") - # copy dependencies to release path - foreach(_dllRuntimeFilePath ${ALL_RUNTIME_DEP_PATH_LIST}) - file(COPY ${_dllRuntimeFilePath} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) - endforeach() - endif() + # copy dependencies to release path + foreach(_dllRuntimeFilePath ${ALL_RUNTIME_DEP_PATH_LIST}) + file(COPY ${_dllRuntimeFilePath} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ FOLLOW_SYMLINK_CHAIN) + endforeach() endif() if(BUILD_APPLICATION) @@ -491,10 +521,6 @@ if(LINUX AND LINUX_INSTALL_SOFTWARE) gpgfrontend_ui gpgfrontend_test gpgfrontend_module_sdk) - - if(NOT APPLE) - list(APPEND GPGFRONTEND_INSTALL_LIBRARIES mimalloc) - endif() endif() message(STATUS "GpgFrontend Install Libraries: ${GPGFRONTEND_INSTALL_LIBRARIES}") @@ -540,10 +566,6 @@ if(STABLE_BUILD_FULL_SDK) gpgfrontend_test gpgfrontend_module_sdk) - if(NOT APPLE) - list(APPEND GPGFRONTEND_SDK_INSTALL_LIBRARIES mimalloc) - endif() - install(TARGETS ${GPGFRONTEND_SDK_INSTALL_LIBRARIES} EXPORT GpgFrontendTargets PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8993c230..1aeabce3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -54,7 +54,8 @@ target_compile_definitions(gpgfrontend_core PUBLIC GF_CORE) if(NOT APPLE) target_link_libraries(gpgfrontend_core PUBLIC mimalloc) - if(MINGW) + # use system installed libraries or install it system wide + if(MINGW AND NOT STABLE_BUILD_FULL_SDK) set_target_properties(mimalloc PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" @@ -95,7 +96,8 @@ if(NOT MINGW) find_package(LibArchive REQUIRED) target_include_directories(gpgfrontend_core PRIVATE ${LibArchive_INCLUDE_DIR}) else() - if(MINGW) + # use system installed libraries or install it system wide + if(NOT STABLE_BUILD_FULL_SDK) set_target_properties(archive PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" diff --git a/src/core/function/gpg/GpgKeyImportExporter.cpp b/src/core/function/gpg/GpgKeyImportExporter.cpp index 2b4448de..b9875131 100644 --- a/src/core/function/gpg/GpgKeyImportExporter.cpp +++ b/src/core/function/gpg/GpgKeyImportExporter.cpp @@ -91,7 +91,7 @@ auto GpgKeyImportExporter::ExportKey(const GpgKey& key, bool secret, bool ascii, GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); auto err = gpgme_op_export_keys(ctx, keys_array.data(), mode, data_out); - if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return {}; + if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return {err, {}}; return {err, data_out.Read2GFBuffer()}; } @@ -122,7 +122,7 @@ void GpgKeyImportExporter::ExportKeys(const KeyArgsList& keys, bool secret, GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); auto err = gpgme_op_export_keys(ctx, keys_array.data(), mode, data_out); - if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return {}; + if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return err; data_object->Swap({data_out.Read2GFBuffer()}); return err; @@ -152,7 +152,7 @@ void GpgKeyImportExporter::ExportAllKeys(const KeyArgsList& keys, bool secret, GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); auto err = gpgme_op_export_keys(ctx, keys_array.data(), mode, data_out); - if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return {}; + if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return err; auto buffer = data_out.Read2GFBuffer(); @@ -163,7 +163,7 @@ void GpgKeyImportExporter::ExportAllKeys(const KeyArgsList& keys, bool secret, GpgData data_out_secret; auto err = gpgme_op_export_keys(ctx, keys_array.data(), mode, data_out_secret); - if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return {}; + if (gpgme_err_code(err) != GPG_ERR_NO_ERROR) return err; buffer.Append(data_out_secret.Read2GFBuffer()); } diff --git a/src/sdk/GFSDKBuildInfo.h b/src/sdk/GFSDKBuildInfo.h deleted file mode 100644 index a64d95c5..00000000 --- a/src/sdk/GFSDKBuildInfo.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2021 Saturneric <[email protected]> - * - * This file is part of GpgFrontend. - * - * GpgFrontend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GpgFrontend is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>. - * - * The initial version of the source code is inherited from - * the gpg4usb project, which is under GPL-3.0-or-later. - * - * All the source code of GpgFrontend was modified and released by - * Saturneric <[email protected]> starting on May 12, 2021. - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#pragma once - -#define GF_SDK_VERSION_MAJOR "2" -#define GF_SDK_VERSION_MINOR "1" -#define GF_SDK_VERSION_PATCH "3" - -#define GF_SDK_VERSION_STR \ - GF_SDK_VERSION_MAJOR "." GF_SDK_VERSION_MINOR "." GF_SDK_VERSION_PATCH diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index f052e7e2..79f17ac0 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -53,7 +53,8 @@ if(XCODE_BUILD) XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${GPGFRONTEND_XOCDE_CODE_SIGN_IDENTITY}") endif() -if(MINGW) +# use system installed libraries or install it system wide +if(MINGW AND NOT STABLE_BUILD_FULL_SDK) set_target_properties(gtest PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index 2633a50d..c1189fa2 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -681,7 +681,7 @@ void MainWindow::create_tool_bars() { } void MainWindow::create_status_bar() { - auto* status_bar_box = new QWidget(this); + auto* status_bar_box = new QWidget(); auto* status_bar_box_layout = new QHBoxLayout(); // QPixmap* pixmap; diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index f6658eb1..3139ce66 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -23,35 +23,9 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -# json -set(JSON_BuildTests OFF CACHE INTERNAL "") - -if(MINGW) - add_subdirectory(libarchive EXCLUDE_FROM_ALL) -endif() - -if(NOT APPLE) - set(MI_SECURE ON) - - # fix the segment fault issue on M1 chip platform - # refer to https://github.com/microsoft/mimalloc/issues/343 - # if(APPLE) - # set(MI_OSX_ZONE ON) - # set(MI_OSX_INTERPOSE OFF) - # endif() - - # ASAN checking - if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND ENABLE_ASAN) - # if(APPLE) - # set(MI_OVERRIDE OFF) - # endif() - - # set(MI_TRACK_VALGRIND ON) - set(MI_TRACK_ASAN ON) - endif() - +# ASAN checking +if(ENABLE_ASAN AND NOT APPLE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + # set(MI_TRACK_VALGRIND ON) + set(MI_TRACK_ASAN ON) add_subdirectory(mimalloc EXCLUDE_FROM_ALL) -endif() - -set(INSTALL_GTEST OFF) -add_subdirectory(googletest EXCLUDE_FROM_ALL)
\ No newline at end of file +endif()
\ No newline at end of file diff --git a/third_party/mimalloc b/third_party/mimalloc -Subproject 43ce4bd7fd34bcc730c1c7471c9999559741548 +Subproject 8c532c32c3c96e5ba1f2283e032f69ead8add00 |