blob: a4bf860af362df4c25f2ca5bca7ff36227d2fd28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
cmake_minimum_required(VERSION 3.5)
project(gperftools LANGUAGES C CXX)
include(GNUInstallDirs)
option(GPERFTOOLS_BUILD_TOOLS "Build tools" ON)
if(WIN32) # TODO: MINGW, MSYS
option(GPERFTOOLS_WIN32_OVERRIDE "Override allocators" OFF)
endif()
set(deprecated_public_headers
src/google/heap-checker.h
src/google/heap-profiler.h
src/google/malloc_extension.h
src/google/malloc_extension_c.h
src/google/malloc_hook.h
src/google/malloc_hook_c.h
src/google/profiler.h
src/google/stacktrace.h
)
set(gperftools_public_headers
src/gperftools/heap-checker.h
src/gperftools/heap-profiler.h
src/gperftools/malloc_extension.h
src/gperftools/malloc_extension_c.h
src/gperftools/malloc_hook.h
src/gperftools/malloc_hook_c.h
src/gperftools/nallocx.h
src/gperftools/profiler.h
src/gperftools/stacktrace.h
)
if(WIN32) # TODO: MINGW, MSYS
list(APPEND deprecated_public_headers
src/windows/google/tcmalloc.h
)
list(APPEND gperftools_public_headers
src/windows/gperftools/tcmalloc.h
)
set(libtcmalloc_minimal_headers
src/addressmap-inl.h
src/base/arm_instruction_set_select.h
src/base/atomicops-internals-arm-generic.h
src/base/atomicops-internals-arm-v6plus.h
src/base/atomicops-internals-gcc.h
src/base/atomicops-internals-linuxppc.h
src/base/atomicops-internals-macosx.h
src/base/atomicops-internals-mips.h
src/base/atomicops-internals-windows.h
src/base/atomicops-internals-x86.h
src/base/atomicops.h
src/base/basictypes.h
src/base/commandlineflags.h
src/base/googleinit.h
src/base/logging.h
src/base/low_level_alloc.h
src/base/spinlock.h
src/base/spinlock_internal.h
src/base/spinlock_linux-inl.h
src/base/spinlock_posix-inl.h
src/base/spinlock_win32-inl.h
src/base/stl_allocator.h
src/base/sysinfo.h
src/base/thread_annotations.h
src/central_freelist.h
src/common.h
src/gperftools/heap-checker.h
src/gperftools/heap-profiler.h
src/gperftools/malloc_extension.h
src/gperftools/malloc_hook.h
src/gperftools/profiler.h
src/gperftools/stacktrace.h
src/heap-profile-table.h
src/internal_logging.h
src/malloc_hook-inl.h
src/memory_region_map.h
src/packed-cache-inl.h
src/pagemap.h
src/page_heap.h
src/page_heap_allocator.h
src/raw_printer.h
src/sampler.h
src/span.h
src/stacktrace_win32-inl.h
src/stack_trace_table.h
src/static_vars.h
src/symbolize.h
src/system-alloc.h
src/tcmalloc.h
src/thread_cache.h
src/windows/config.h
src/windows/mini_disassembler.h
src/windows/mini_disassembler_types.h
src/windows/port.h
src/windows/preamble_patcher.h
)
set(libtcmalloc_minimal_sources
src/base/dynamic_annotations.c
src/base/logging.cc
src/base/low_level_alloc.cc
src/base/spinlock.cc
src/base/spinlock_internal.cc
src/base/sysinfo.cc
src/central_freelist.cc
src/common.cc
src/fake_stacktrace_scope.cc
src/heap-profile-table.cc
src/internal_logging.cc
src/malloc_extension.cc
src/malloc_hook.cc
src/memory_region_map.cc
src/page_heap.cc
src/raw_printer.cc
src/sampler.cc
src/span.cc
src/stacktrace.cc
src/stack_trace_table.cc
src/static_vars.cc
src/symbolize.cc
src/thread_cache.cc
src/windows/ia32_modrm_map.cc
src/windows/ia32_opcode_map.cc
src/windows/mini_disassembler.cc
src/windows/port.cc
src/windows/preamble_patcher.cc
src/windows/preamble_patcher_with_stub.cc
src/windows/system-alloc.cc
)
if(GPERFTOOLS_WIN32_OVERRIDE)
list(APPEND libtcmalloc_minimal_sources src/windows/override_functions.cc)
else()
list(APPEND libtcmalloc_minimal_sources src/windows/patch_functions.cc)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
source_group("Header Files" FILES ${libtcmalloc_minimal_headers})
source_group("Source Files" FILES ${libtcmalloc_minimal_sources})
if(GPERFTOOLS_WIN32_OVERRIDE)
add_library(libtcmalloc_minimal
STATIC
${libtcmalloc_minimal_headers}
${libtcmalloc_minimal_sources}
)
else()
add_library(libtcmalloc_minimal
${libtcmalloc_minimal_headers}
${libtcmalloc_minimal_sources}
)
endif()
target_compile_definitions(
libtcmalloc_minimal
PRIVATE
$<$<BOOL:${GPERFTOOLS_WIN32_OVERRIDE}>:
WIN32_OVERRIDE_ALLOCATORS
PERFTOOLS_DLL_DECL=
>
)
target_compile_options(
libtcmalloc_minimal
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/wd4141
/wd4251
>
)
target_include_directories(
libtcmalloc_minimal
PUBLIC
$<BUILD_INTERFACE:
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/src/windows
>
)
install(FILES ${deprecated_public_headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/google
)
install(FILES ${gperftools_public_headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gperftools
)
install(TARGETS libtcmalloc_minimal
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(GPERFTOOLS_BUILD_TOOLS)
add_executable(addr2line-pdb src/windows/addr2line-pdb.c)
target_link_libraries(addr2line-pdb PRIVATE DbgHelp)
add_executable(nm-pdb src/windows/nm-pdb.c)
target_link_libraries(nm-pdb PRIVATE DbgHelp)
install(TARGETS addr2line-pdb nm-pdb DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
else()
endif()
|