diff --git a/CMakeLists.txt b/CMakeLists.txt index 95bfbf6027..7722660ad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,10 @@ if (USE_PPROF) add_definitions(-DUSE_PPROF) endif() +if (USE_HEAPPROF) + message("Heap Profiler is enabled") +endif() + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Set environment variables diff --git a/cmake/OmimHelpers.cmake b/cmake/OmimHelpers.cmake index 93bf4ed4ad..29654f2307 100644 --- a/cmake/OmimHelpers.cmake +++ b/cmake/OmimHelpers.cmake @@ -52,6 +52,19 @@ function(omim_add_executable executable) target_link_libraries(${executable} "-lprofiler") endif() endif() + if (USE_HEAPPROF) + if (PLATFORM_MAC) + find_library(HEAPPROF_LIBRARY libtcmalloc.dylib) + if (NOT HEAPPROF_LIBRARY) + message( + FATAL_ERROR + "Trying to use -ltcmalloc on MacOS, make sure that you have installed it (https://github.com/mapsme/omim/pull/12671).") + endif() + target_link_libraries(${executable} ${HEAPPROF_LIBRARY}) + else() + target_link_libraries(${executable} "-ltcmalloc") + endif() + endif() if (USE_PCH) add_precompiled_headers_to_target(${executable} ${OMIM_PCH_TARGET_NAME}) endif()