Skip to content

Commit

Permalink
fix: should build mimalloc separately
Browse files Browse the repository at this point in the history
  • Loading branch information
saturneric committed Jul 29, 2024
1 parent 4a50053 commit 7054d32
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ 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 ${{github.workspace}}/third_party/mimalloc
mkdir build && cd build
cmake -G Ninja -DMI_SECURE=ON ..
ninja
sudo ninja install
if: matrix.os == 'windows-2019'

- name: Configure CMake & Build Binary(Windows)
shell: msys2 {0}
run: |
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,25 @@ 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 ${{github.workspace}}/third_party/mimalloc
mkdir build && cd build
cmake -G Ninja -DMI_SECURE=ON ..
ninja
sudo ninja install
if: matrix.os == 'windows-2019'

- 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
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ endif()
find_package(OpenSSL REQUIRED)

# mimalloc
find_package(mimalloc REQUIRED)
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)
Expand Down
32 changes: 4 additions & 28 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,10 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

# json
set(JSON_BuildTests OFF CACHE INTERNAL "")

# full sdk build on windows will use system installed libarchive
if(MINGW AND NOT STABLE_BUILD_FULL_SDK)
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()

Expand Down

0 comments on commit 7054d32

Please sign in to comment.