diff options
Diffstat (limited to '')
-rw-r--r-- | .github/workflows/release.yml | 35 | ||||
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/core/function/SecureMemoryAllocator.cpp | 22 | ||||
-rw-r--r-- | third_party/CMakeLists.txt | 34 |
4 files changed, 67 insertions, 32 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9db2a8d2..912bed6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -174,18 +174,34 @@ jobs: if: matrix.os == 'windows-2019' - name: Build & Install Full SDK - # Build your GpgFrontend with the given configuration run: | cmake -B ${{github.workspace}}/build-full-sdk -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_FULL_SDK=ON cmake --build ${{github.workspace}}/build-full-sdk --config {{$env.BUILD_TYPE}} -- -v sudo cmake --install ${{github.workspace}}/build-full-sdk --config {{$env.BUILD_TYPE}} + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' + + - name: Build & Install Full SDK (Windows) + shell: msys2 {0} + run: | + cmake -B ${{github.workspace}}/build-full-sdk -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_FULL_SDK=ON + cmake --build ${{github.workspace}}/build-full-sdk --config {{$env.BUILD_TYPE}} -- -v + sudo cmake --install ${{github.workspace}}/build-full-sdk --config {{$env.BUILD_TYPE}} + if: matrix.os == 'windows-2019' - name: Build Integrated Modules - # Build your GpgFrontend with the given configuration run: | cmake -S ${{github.workspace}}/modules -B ${{github.workspace}}/modules/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/modules/build/artifacts cmake --build ${{github.workspace}}/modules/build --config {{$env.BUILD_TYPE}} -- -v cmake --install ${{github.workspace}}/modules/build --config {{$env.BUILD_TYPE}} + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' + + - name: Build Integrated Modules (Windows) + shell: msys2 {0} + run: | + cmake -S ${{github.workspace}}/modules -B ${{github.workspace}}/modules/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/modules/build/artifacts + cmake --build ${{github.workspace}}/modules/build --config {{$env.BUILD_TYPE}} -- -v + cmake --install ${{github.workspace}}/modules/build --config {{$env.BUILD_TYPE}} + if: matrix.os == 'windows-2019' - name: Build & Export GpgFrontend (macOS) # Build your GpgFrontend with the given configuration @@ -256,7 +272,7 @@ jobs: ./linuxdeployqt-continuous-x86_64.AppImage ${{github.workspace}}/build/artifacts/AppDir/usr/share/applications/*.desktop -no-translations -extra-plugins=iconengines,platformthemes/libqgtk3.so -appimage -executable-dir=${{github.workspace}}/build/artifacts/AppDir/usr/modules/ if: matrix.os == 'ubuntu-20.04' - - name: Configure CMake & Build Binary(Windows) + - name: Configure CMake & Build Binary (Windows) shell: msys2 {0} run: | cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') @@ -264,22 +280,29 @@ jobs: cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON .. cmake --build . --config ${{env.BUILD_TYPE}} -- -j 4 if: matrix.os == 'windows-2019' + + - name: Copy Modules & Package (Windows) + shell: msys2 {0} + run: | + cmake -E copy_directory ${{github.workspace}}/modules/build/artifacts/modules ${{github.workspace}}/build/artifacts/modules + windeployqt-qt6 --force --libdir ${{github.workspace}}/build/artifacts --release ${{github.workspace}}/build/artifacts/GpgFrontend.exe + if: matrix.os == 'windows-2019' - - name: Upload Artifact(Linux) + - name: Upload Artifact (Linux) uses: actions/upload-artifact@master with: name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} path: ${{github.workspace}}/build/final-artifact/Gpg_Frontend*.AppImage* if: matrix.os == 'ubuntu-20.04' - - name: Upload Artifact(macOS) + - name: Upload Artifact (macOS) uses: actions/upload-artifact@master with: name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} path: ${{github.workspace}}/build/final-artifact/* if: matrix.os == 'macos-13' || matrix.os == 'macos-12' || matrix.os == 'macos-14' - - name: Upload Artifact(Windows) + - name: Upload Artifact (Windows) uses: actions/upload-artifact@master with: name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6702191..5496572c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -311,14 +311,6 @@ if (BUILD_APPLICATION) if (${CMAKE_BUILD_TYPE} STREQUAL "Release") if (MINGW) add_executable(${AppName} WIN32 ${BASE_SOURCE} ${RESOURCE_FILES}) - # include qt dependencies - if(NOT Qt6_DIR) - add_custom_command(TARGET ${AppName} POST_BUILD - COMMAND windeployqt --force --libdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} --release ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${AppName}.exe) - else() - add_custom_command(TARGET ${AppName} POST_BUILD - COMMAND windeployqt-qt6.exe --force --libdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} --release ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${AppName}.exe) - endif() elseif (LINUX AND NOT LINUX_INSTALL_SOFTWARE) add_executable(${AppName} ${BASE_SOURCE} ${RESOURCE_FILES}) diff --git a/src/core/function/SecureMemoryAllocator.cpp b/src/core/function/SecureMemoryAllocator.cpp index f854f816..651e4085 100644 --- a/src/core/function/SecureMemoryAllocator.cpp +++ b/src/core/function/SecureMemoryAllocator.cpp @@ -28,6 +28,8 @@ #include "SecureMemoryAllocator.h" +#ifndef MACOS + #include <mimalloc.h> namespace GpgFrontend { @@ -38,10 +40,28 @@ auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* { } auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* { - auto* addr = realloc(ptr, size); + auto* addr = mi_realloc(ptr, size); return addr; } void SecureMemoryAllocator::Deallocate(void* p) { mi_free(p); } +#else + +namespace GpgFrontend { + +auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* { + auto* addr = malloc(size); + return addr; +} + +auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* { + auto* addr = realloc(ptr, size); + return addr; +} + +void SecureMemoryAllocator::Deallocate(void* p) { free(p); } + +#endif + } // namespace GpgFrontend
\ No newline at end of file diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index fa3fbf7a..f6658eb1 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -23,35 +23,35 @@ # # SPDX-License-Identifier: GPL-3.0-or-later - # json set(JSON_BuildTests OFF CACHE INTERNAL "") -if (MINGW) +if(MINGW) add_subdirectory(libarchive EXCLUDE_FROM_ALL) endif() -set(MI_SECURE ON) +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() + # 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) + # ASAN checking + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND ENABLE_ASAN) + # if(APPLE) + # set(MI_OVERRIDE OFF) + # endif() - if(APPLE) - set(MI_OVERRIDE OFF) + # set(MI_TRACK_VALGRIND ON) + set(MI_TRACK_ASAN ON) endif() - # set(MI_TRACK_VALGRIND ON) - set(MI_TRACK_ASAN ON) + add_subdirectory(mimalloc EXCLUDE_FROM_ALL) endif() -add_subdirectory(mimalloc EXCLUDE_FROM_ALL) - set(INSTALL_GTEST OFF) add_subdirectory(googletest EXCLUDE_FROM_ALL)
\ No newline at end of file |