mirror of
https://github.com/gperftools/gperftools
synced 2024-12-17 21:14:30 +00:00
structure low_level_alloc as own convenience archive
This commit is contained in:
parent
3c261d9090
commit
d0d4363a34
@ -423,9 +423,15 @@ add_library(common
|
||||
src/base/spinlock.cc
|
||||
src/base/spinlock_internal.cc)
|
||||
|
||||
add_library(low_level_alloc
|
||||
STATIC
|
||||
src/base/low_level_alloc.cc)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set_property(TARGET common
|
||||
PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
set_property(TARGET low_level_alloc
|
||||
PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
else()
|
||||
# windows needs this. Doesn't hurt others.
|
||||
#
|
||||
@ -474,10 +480,10 @@ if(BUILD_TESTING)
|
||||
target_include_directories(gtest INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/googletest/googletest/include>)
|
||||
|
||||
add_executable(low_level_alloc_unittest src/base/low_level_alloc.cc
|
||||
add_executable(low_level_alloc_unittest
|
||||
src/tests/low_level_alloc_unittest.cc)
|
||||
target_compile_definitions(low_level_alloc_unittest PRIVATE NO_TCMALLOC_SAMPLES PERFTOOLS_DLL_DECL= )
|
||||
target_link_libraries(low_level_alloc_unittest common gtest)
|
||||
target_link_libraries(low_level_alloc_unittest low_level_alloc common gtest)
|
||||
add_test(low_level_alloc_unittest low_level_alloc_unittest)
|
||||
endif()
|
||||
|
||||
@ -743,7 +749,6 @@ if(GPERFTOOLS_BUILD_HEAP_PROFILER)
|
||||
|
||||
set(FULL_MALLOC_SRC
|
||||
${MINIMAL_MALLOC_SRC}
|
||||
src/base/low_level_alloc.cc
|
||||
src/heap-profile-table.cc
|
||||
src/heap-profiler.cc
|
||||
${EMERGENCY_MALLOC_CC}
|
||||
@ -751,7 +756,7 @@ if(GPERFTOOLS_BUILD_HEAP_PROFILER)
|
||||
src/heap-checker-stub.cc)
|
||||
add_library(tcmalloc ${TCMALLOC_CC} ${FULL_MALLOC_SRC})
|
||||
target_compile_definitions(tcmalloc PRIVATE ${EMERGENCY_MALLOC_DEFINE})
|
||||
target_link_libraries(tcmalloc PRIVATE stacktrace common)
|
||||
target_link_libraries(tcmalloc PRIVATE stacktrace low_level_alloc common)
|
||||
target_link_options(tcmalloc INTERFACE ${TCMALLOC_FLAGS})
|
||||
|
||||
### Unittests
|
||||
@ -806,7 +811,7 @@ if(GPERFTOOLS_BUILD_DEBUGALLOC)
|
||||
if(GPERFTOOLS_BUILD_HEAP_PROFILER)
|
||||
add_library(tcmalloc_debug src/debugallocation.cc src/symbolize.cc ${FULL_MALLOC_SRC})
|
||||
target_compile_definitions(tcmalloc_debug PRIVATE ${EMERGENCY_MALLOC_DEFINE})
|
||||
target_link_libraries(tcmalloc_debug PRIVATE stacktrace common)
|
||||
target_link_libraries(tcmalloc_debug PRIVATE stacktrace low_level_alloc common)
|
||||
|
||||
### Unittests
|
||||
if(BUILD_TESTING)
|
||||
|
13
Makefile.am
13
Makefile.am
@ -117,6 +117,9 @@ libcommon_la_SOURCES = src/base/logging.cc \
|
||||
src/base/spinlock.cc \
|
||||
src/base/spinlock_internal.cc
|
||||
|
||||
noinst_LTLIBRARIES += liblow_level_alloc.la
|
||||
liblow_level_alloc_la_SOURCES = src/base/low_level_alloc.cc
|
||||
|
||||
if MINGW
|
||||
libcommon_la_SOURCES += src/windows/port.cc \
|
||||
src/windows/ia32_modrm_map.cc \
|
||||
@ -186,13 +189,12 @@ proc_maps_iterator_test_LDADD = libcommon.la libgtest.la
|
||||
|
||||
if WITH_HEAP_PROFILER_OR_CHECKER
|
||||
TESTS += low_level_alloc_unittest
|
||||
low_level_alloc_unittest_SOURCES = src/base/low_level_alloc.cc \
|
||||
src/tests/low_level_alloc_unittest.cc
|
||||
low_level_alloc_unittest_SOURCES = src/tests/low_level_alloc_unittest.cc
|
||||
# By default, MallocHook takes stack traces for use by the heap-checker.
|
||||
# We don't need that functionality here, so we turn it off to reduce deps.
|
||||
low_level_alloc_unittest_CXXFLAGS = -DNO_TCMALLOC_SAMPLES $(AM_CXXFLAGS)
|
||||
low_level_alloc_unittest_CPPFLAGS = $(gtest_CPPFLAGS)
|
||||
low_level_alloc_unittest_LDADD = libcommon.la libgtest.la
|
||||
low_level_alloc_unittest_LDADD = liblow_level_alloc.la libcommon.la libgtest.la
|
||||
endif WITH_HEAP_PROFILER_OR_CHECKER
|
||||
|
||||
### ------- stack trace
|
||||
@ -623,7 +625,6 @@ endif !BUILD_EMERGENCY_MALLOC
|
||||
### Making the library
|
||||
|
||||
FULL_MALLOC_SRC = $(MINIMAL_MALLOC_SRC) \
|
||||
src/base/low_level_alloc.cc \
|
||||
src/heap-profile-table.cc \
|
||||
src/heap-profiler.cc \
|
||||
$(EMERGENCY_MALLOC_CC) \
|
||||
@ -635,7 +636,7 @@ libtcmalloc_la_SOURCES = $(TCMALLOC_CC) $(FULL_MALLOC_SRC)
|
||||
libtcmalloc_la_CXXFLAGS = -DNDEBUG $(AM_CXXFLAGS) \
|
||||
$(EMERGENCY_MALLOC_DEFINE)
|
||||
libtcmalloc_la_LDFLAGS = -version-info @TCMALLOC_SO_VERSION@ $(AM_LDFLAGS)
|
||||
libtcmalloc_la_LIBADD = libstacktrace.la libcommon.la
|
||||
libtcmalloc_la_LIBADD = libstacktrace.la liblow_level_alloc.la libcommon.la
|
||||
|
||||
### Unittests
|
||||
|
||||
@ -654,7 +655,7 @@ tcm_asserts_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
|
||||
tcm_asserts_unittest_CXXFLAGS = $(AM_CXXFLAGS) \
|
||||
$(EMERGENCY_MALLOC_DEFINE)
|
||||
tcm_asserts_unittest_CPPFLAGS = $(gtest_CPPFLAGS)
|
||||
tcm_asserts_unittest_LDADD = libstacktrace.la libcommon.la libgtest.la
|
||||
tcm_asserts_unittest_LDADD = libstacktrace.la liblow_level_alloc.la libcommon.la libgtest.la
|
||||
|
||||
# This makes sure it's safe to link in both tcmalloc and
|
||||
# tcmalloc_minimal. (One would never do this on purpose, but perhaps
|
||||
|
Loading…
Reference in New Issue
Block a user