diff --git a/CMakeLists.txt b/CMakeLists.txt index 465f5f7..45db2f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL add_subdirectory(external) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_subdirectory(linux_jemalloc_helper) endif() if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 0922a66..46b15a4 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -37,7 +37,7 @@ if (add_hunspell_library) add_checked_subdirectory(hunspell) endif() add_checked_subdirectory(iconv) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) endif() add_checked_subdirectory(jpeg) diff --git a/options_linux.cmake b/options_linux.cmake index 9312468..5a4c298 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -62,10 +62,16 @@ if (DESKTOP_APP_SPECIAL_TARGET) target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() +if (NOT DESKTOP_APP_DISABLE_JEMALLOC) + target_link_libraries(common_options + INTERFACE + $ + $ + ) +endif() + target_link_libraries(common_options INTERFACE - $ - $ ${CMAKE_DL_LIBS} ) diff --git a/variables.cmake b/variables.cmake index 4d6c9bd..aaafc6a 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,6 +31,7 @@ option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF) option(DESKTOP_APP_NO_PDB "Disable PDB file generation. (Windows only)" OFF) +option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc (Linux only)." OFF) if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch. (macOS only)")