Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:saturneric/GpgFrontend into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
saturneric committed Jul 28, 2024
2 parents 1b39252 + 28b2798 commit dcd771c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 32 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -256,30 +272,37 @@ 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/://')
mkdir build && cd build
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 }}
Expand Down
8 changes: 0 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
22 changes: 21 additions & 1 deletion src/core/function/SecureMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "SecureMemoryAllocator.h"

#ifndef MACOS

#include <mimalloc.h>

namespace GpgFrontend {
Expand All @@ -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
34 changes: 17 additions & 17 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit dcd771c

Please sign in to comment.