forked from gperftools/gperftools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1526 lines (1358 loc) · 61.3 KB
/
CMakeLists.txt
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cmake_minimum_required(VERSION 3.12)
# Please note that cmake support is very preliminary. Autotools-based
# build is the only fully supported build for now.
# Based on configure.ac
project(gperftools VERSION 2.10.0 LANGUAGES C CXX
DESCRIPTION "Performance tools for C++"
HOMEPAGE_URL http://code.google.com/p/gperftools/)
# Update this value for every release!
set(TCMALLOC_SO_VERSION 9.10.5)
set(PROFILER_SO_VERSION 5.5.5)
set(TCMALLOC_AND_PROFILER_SO_VERSION 10.5.6)
# The user can choose not to compile in the heap-profiler, the
# heap-checker, or the cpu-profiler. There's also the possibility
# for a 'fully minimal' compile, which leaves out the stacktrace
# code as well. By default, we include all of these that the
# target system supports.
set(DEFAULT_BUILD_CPU_PROFILER ON)
set(DEFAULT_BUILD_HEAP_PROFILER ON)
set(DEFAULT_BUILD_HEAP_CHECKER ON)
set(DEFAULT_BUILD_DEBUGALLOC ON)
set(DEFAULT_BUILD_MINIMAL OFF)
set(DEFAULT_TCMALLOC_ALIGNMENT 16)
set(NEED_NANOSLEEP ON) # Used later, to decide if to run ACX_NANOSLEEP
set(HOST string(TOLOWER "${CMAKE_SYSTEM_NAME}"))
if(MINGW OR MSVC)
set(DEFAULT_BUILD_MINIMAL ON)
set(DEFAULT_BUILD_DEBUGALLOC OFF)
set(NEED_NANOSLEEP OFF)
elseif(CYGWIN)
set(DEFAULT_BUILD_HEAP_CHECKER OFF)
set(DEFAULT_BUILD_CPU_PROFILER OFF)
elseif(HOST MATCHES "freebsd")
set(DEFAULT_BUILD_HEAP_CHECKER OFF)
elseif(APPLE)
set(DEFAULT_BUILD_HEAP_CHECKER OFF)
endif()
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckTypeSize)
include(CheckVariableExists)
include(CMakeDependentOption)
include(CTest)
include(CPack)
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(DefineTargetVariables)
include(FindObjcopyWithWeaken)
include(PCFromUContext)
define_target_variables()
# Currently only backtrace works on s390.
if(s390 OR OSX)
set(default_enable_libunwind OFF)
set(default_enable_backtrace ON)
else()
set(default_enable_libunwind ON)
set(default_enable_backtrace OFF)
endif()
# Disable libunwind linking on ppc64 by default.
if(PPC64)
set(default_enable_libunwind OFF)
set(default_tcmalloc_pagesize 64)
else()
set(default_enable_libunwind ON)
set(default_tcmalloc_pagesize 8)
endif()
cmake_dependent_option(
GPERFTOOLS_BUILD_CPU_PROFILER "Build cpu-profiler" ${DEFAULT_BUILD_CPU_PROFILER}
"NOT gperftools_build_minimal" OFF)
cmake_dependent_option(
GPERFTOOLS_BUILD_HEAP_PROFILER "Build heap-profiler" ${DEFAULT_BUILD_HEAP_PROFILER}
"NOT gperftools_build_minimal" OFF)
cmake_dependent_option(
GPERFTOOLS_BUILD_HEAP_CHECKER "Build heap-checker" ${DEFAULT_BUILD_HEAP_CHECKER}
"NOT gperftools_build_minimal" OFF)
cmake_dependent_option(
GPERFTOOLS_BUILD_DEBUGALLOC "Build debugalloc" ${DEFAULT_BUILD_DEBUGALLOC}
"NOT gperftools_build_minimal" OFF)
option(
gperftools_build_minimal
"Build only tcmalloc-minimal (and maybe tcmalloc-minimal-debug)"
${DEFAULT_BUILD_MINIMAL})
if(gperftools_build_minimal)
set(GPERFTOOLS_BUILD_CPU_PROFILER OFF)
set(GPERFTOOLS_BUILD_HEAP_PROFILER OFF)
set(GPERFTOOLS_BUILD_HEAP_CHECKER OFF)
endif()
cmake_dependent_option(
gperftools_build_benchmark "Build benchmark" ON "NOT MINGW AND NOT MSVC" OFF)
option(gperftools_enable_stacktrace_via_backtrace
"Enable use of backtrace() for stacktrace capturing (may deadlock)"
${default_enable_backtrace})
option(gperftools_enable_libunwind
"Enable libunwind linking"
${default_enable_libunwind})
set(enable_backtrace ${gperftools_enable_stacktrace_via_backtrace})
set(enable_libunwind ${gperftools_enable_libunwind})
set(gperftools_tcmalloc_pagesize ${default_tcmalloc_pagesize}
CACHE STRING "Set the tcmalloc internal page size")
set_property(CACHE gperftools_tcmalloc_pagesize PROPERTY STRINGS "8" "32" "64")
if(NOT gperftools_tcmalloc_pagesize STREQUAL "8" AND
NOT gperftools_tcmalloc_pagesize STREQUAL "32" AND
NOT gperftools_tcmalloc_pagesize STREQUAL "64")
message(WARNING
"Invalid gperftools_tcmalloc_pagesize (${gperftools_tcmalloc_pagesize}), "
"setting to default value (${default_tcmalloc_pagesize})")
set(gperftools_tcmalloc_pagesize ${default_tcmalloc_pagesize})
endif()
if (gperftools_tcmalloc_pagesize STREQUAL "32" OR
gperftools_tcmalloc_pagesize STREQUAL "64")
set(TCMALLOC_${gperftools_tcmalloc_pagesize}K_PAGES ON)
endif()
set(gperftools_tcmalloc_alignment ${DEFAULT_TCMALLOC_ALIGNMENT}
CACHE STRING "Set the tcmalloc allocation alignment")
set_property(CACHE gperftools_tcmalloc_alignment PROPERTY STRINGS "8" "16")
if(NOT gperftools_tcmalloc_alignment STREQUAL "8" AND
NOT gperftools_tcmalloc_alignment STREQUAL "16")
message(WARNING
"Invalid gperftools_tcmalloc_alignment (${gperftools_tcmalloc_alignment}), "
"setting to default value (${DEFAULT_TCMALLOC_ALIGNMENT})")
set(gperftools_tcmalloc_alignment ${DEFAULT_TCMALLOC_ALIGNMENT})
endif()
if(gperftools_tcmalloc_alignment STREQUAL "8")
set(TCMALLOC_ALIGN_8BYTES ON)
endif()
# AX_CXX_COMPILE_STDCXX(11, ext, mandatory)
if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
set(CMAKE_CXX_STANDARD 17) # std::align_val_t
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# Check if we have an objcopy installed that supports -W
find_objcopy_with_weaken()
# AX_C___ATTRIBUTE__
check_c_source_compiles("#include <stdlib.h>
static void foo(void) __attribute__ ((unused));
void foo(void) { exit(1); }
int main() { return 0; }"
HAVE___ATTRIBUTE__)
set(CMAKE_EXTRA_INCLUDE_FILES "malloc.h")
check_type_size("struct mallinfo" STRUCT_MALLINFO LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES "elf.h")
check_type_size("Elf32_Versym" ELF32_VERSYM LANGUAGE CXX) # for vdso_support.h
set(CMAKE_EXTRA_INCLUDE_FILES)
check_function_exists("sbrk" HAVE_SBRK) # for tcmalloc to get memory
check_function_exists("__sbrk" HAVE_SBRK) # for tcmalloc to get memory
check_function_exists("geteuid" HAVE_GETEUID) # for turning off services when run as root
check_function_exists("fork" HAVE_FORK) # for the pthread_atfork setup
check_include_file("features.h" HAVE_FEATURES_H) # for vdso_support.h, Where __GLIBC__ is defined
check_include_file("malloc.h" HAVE_MALLOC_H) # some systems define stuff there, others not
check_include_file("glob.h" HAVE_GLOB_H) # for heap-profile-table (cleaning up profiles)
check_include_file("execinfo.h" HAVE_EXECINFO_H) # for stacktrace? and heapchecker_unittest
check_include_file("unwind.h" HAVE_UNWIND_H) # for stacktrace
check_include_file("sched.h" HAVE_SCHED_H) # for being nice in our spinlock code
check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H) # for thread_lister (needed by leak-checker)
check_include_file("linux/ptrace.h" HAVE_LINUX_PTRACE_H) # also needed by leak-checker
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) # optional; for forking out to symbolizer
check_include_file("sys/wait.h" HAVE_SYS_WAIT_H) # optional; for forking out to symbolizer
check_include_file("poll.h" HAVE_POLL_H) # optional; for forking out to symbolizer
check_include_file("fcntl.h" HAVE_FCNTL_H) # for tcmalloc_unittest
check_include_file("grp.h" HAVE_GRP_H) # for heapchecker_unittest
check_include_file("pwd.h" HAVE_PWD_H) # for heapchecker_unittest
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H) # for memalign_unittest.cc
check_include_file("sys/cdefs.h" HAVE_SYS_CDEFS_H) # Where glibc defines __THROW
check_include_file("unistd.h" HAVE_UNISTD_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
# We also need <ucontext.h>/<sys/ucontext.h>, but we get those from
# AC_PC_FROM_UCONTEXT, below.
# We override a lot of memory allocation routines, not all of which are
# standard. For those the system doesn't declare, we'll declare ourselves.
set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE=600)
check_symbol_exists("cfree" "stdlib.h;malloc.h" HAVE_DECL_CFREE)
check_symbol_exists("posix_memalign" "stdlib.h;malloc.h" HAVE_DECL_POSIX_MEMALIGN)
check_symbol_exists("memalign" "stdlib.h;malloc.h" HAVE_DECL_MEMALIGN)
check_symbol_exists("valloc" "stdlib.h;malloc.h" HAVE_DECL_VALLOC)
check_symbol_exists("pvalloc" "stdlib.h;malloc.h" HAVE_DECL_PVALLOC)
set(CMAKE_REQUIRED_DEFINITIONS)
if(HAVE_STRUCT_MALLINFO)
set(HAVE_STRUCT_MALLINFO 1)
else()
set(HAVE_STRUCT_MALLINFO 0)
endif()
# We hardcode HAVE_MMAP to 1. There are no interesting systems anymore
# without functional mmap. And our windows (except mingw) builds
# aren't using autoconf. So we keep HAVE_MMAP define, but only to
# distingush windows and rest.
if(NOT WIN32)
set(HAVE_MMAP 1)
endif()
# If AtomicWord != Atomic32, we need to define two versions of all the
# atomicops functions. If they're the same, we want to define only one.
check_c_source_compiles("
#include <stdint.h>
int main()
{
int32_t v1 = 0;
intptr_t v2 = 0;
return (&v1 - &v2);
}"
INT32_EQUALS_INTPTR)
# We want to access the "PC" (Program Counter) register from a struct
# ucontext. Every system has its own way of doing that. We try all the
# possibilities we know about. Note REG_PC should come first (REG_RIP
# is also defined on solaris, but does the wrong thing). But don't
# bother if we're not doing cpu-profiling.
# [*] means that we've not actually tested one of these systems
if (GPERFTOOLS_BUILD_CPU_PROFILER)
pc_from_ucontext(PC_FROM_UCONTEXT_DEF)
endif ()
# Some tests test the behavior of .so files, and only make sense for dynamic.
option(GPERFTOOLS_BUILD_STATIC "Enable Static" ON)
if(gperftools_enable_libunwind)
check_include_file("libunwind.h" HAVE_LIBUNWIND_H)
if(HAVE_LIBUNWIND_H)
find_library(libunwind_location NAMES unwind)
if(libunwind_location)
check_library_exists(
unwind backtrace ${libunwind_location} have_libunwind)
endif()
if(have_libunwind)
set(unwind_libs ${libunwind_location})
set(will_use_libunwind ON)
endif()
endif()
endif()
# On x86_64, we know that default is to omit frame pointer.
if(x86_64)
set(omit_fp_by_default ON)
endif()
# See if the compiler supports -Wno-unused-result.
# Newer ubuntu's turn on -D_FORTIFY_SOURCE=2, enabling
# __attribute__((warn_unused_result)) for things like write(),
# which we don't care about.
check_c_compiler_flag("-Wno-unused-result" have_w_no_unused_result)
option(gperftools_dynamic_sized_delete_support
"Try to build run-time switch for sized delete operator"
OFF)
if(gperftools_dynamic_sized_delete_support)
set(ENABLE_DYNAMIC_SIZED_DELETE 1)
endif()
option(gperftools_sized_delete "Build sized delete operator" OFF)
if(gperftools_sized_delete)
set(ENABLE_SIZED_DELETE 1)
endif()
if(NOT MSVC)
set(CMAKE_REQUIRED_FLAGS -fsized-deallocation)
check_cxx_source_compiles("
#include <new>
int main() { (::operator delete)(0, 256); return 0; }"
have_sized_deallocation)
set(CMAKE_REQUIRED_FLAGS)
endif()
check_cxx_source_compiles("
#include <new>
int main() { (::operator delete)((::operator new)(256, std::align_val_t(16)), std::align_val_t(16)); return 0; }"
HAVE_STD_ALIGN_VAL_T)
if(HAVE_STD_ALIGN_VAL_T)
set(HAVE_STD_ALIGN_VAL_T 1)
else()
set(HAVE_STD_ALIGN_VAL_T 0)
endif()
check_c_source_compiles("
#include <unwind.h>
int main()
{
#if __APPLE__
#error OSX _Unwind_Backtrace recurses back to malloc
#endif
&_Unwind_Backtrace;
return 0;
}"
HAVE_UNWIND_BACKTRACE)
if(enable_backtrace)
set(default_emergency_malloc ON)
else()
set(default_emergency_malloc OFF)
endif()
if(will_use_libunwind AND ARM)
set(default_emergency_malloc ON)
endif()
option(gperftools_emergency_malloc
"Build emergency malloc"
${default_emergency_malloc})
check_c_source_compiles(
"int main() { return __builtin_expect(main != 0, 1); }"
HAVE_BUILTIN_EXPECT)
check_c_source_compiles("
#include <unistd.h>
int main()
{
char** env = __environ;
return 0;
}"
HAVE___ENVIRON)
# If we support __thread, that can speed up tcmalloc a bit.
# Note, however, that our code tickles a bug in gcc < 4.1.2
# involving TLS and -fPIC (which our libraries will use) on x86:
# http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
#
# And mingw also does compile __thread but resultant code actually
# fails to work correctly at least in some not so ancient version:
# http://mingw-users.1079350.n2.nabble.com/gcc-4-4-multi-threaded-exception-handling-amp-thread-specifier-not-working-td3440749.html
#
# Also it was reported that earlier gcc versions for mips compile
# __thread but it doesn't really work
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.1.2")
message(WARNING "gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html")
elseif(APPLE)
message(WARNING "OSX __thread support is known to call malloc which makes "
"it unsafe to use from malloc replacement")
elseif(MINGW)
message(WARNING "mingw doesn't really support tls")
else()
check_c_source_compiles("static __thread int p = 0; int main() {}" HAVE_TLS)
endif()
if(NEED_NANOSLEEP)
check_c_source_compiles(
"#include <time.h>
int main()
{ static struct timespec ts; nanosleep(&ts, NULL); return 0; }"
nanosleep_ok)
if(NOT nanosleep_ok)
set(CMAKE_REQUIRED_LIBRARIES rt)
check_c_source_compiles(
"#include <time.h>
int main()
{ static struct timespec ts; nanosleep(&ts, NULL); return 0; }"
nanosleep_ok)
if(nanosleep_ok)
set(nanosleep_libs rt)
else()
message(FATAL_ERROR "cannot find the nanosleep function")
endif()
set(CMAKE_REQUIRED_LIBRARIES)
endif()
endif()
# Nanosleep requires extra libraries on some architectures (solaris).
# This sets NANOSLEEP_LIBS. nanosleep doesn't exist on mingw, which
# is fine for us because we don't compile libspinlock, which uses it.
if(enable_backtrace)
check_symbol_exists("backtrace" "execinfo.h" HAVE_DECL_BACKTRACE)
check_function_exists("backtrace" backtrace_exists)
if(NOT backtrace_exists)
set(CMAKE_REQUIRED_LIBRARIES execinfo)
check_function_exists("backtrace" backtrace_exists)
set(CMAKE_REQUIRED_LIBRARIES)
if(backtrace_exists)
list(INSERT unwind_libs 0 execinfo)
endif()
endif()
endif()
find_package(Threads REQUIRED)
set(HAVE_PTHREAD ${CMAKE_USE_PTHREADS_INIT})
foreach(attr "PTHREAD_CREATE_JOINABLE" "PTHREAD_CREATE_UNDETACHED")
check_c_source_compiles("
#include <pthread.h>
int main() { int attr = ${attr}; return attr; }"
${attr}_ATTR)
if(${attr}_ATTR)
set(PTHREAD_CREATE_JOINABLE ${attr})
break()
endif()
endforeach()
if(FreeBSD)
set(PTHREADS_CRASHES_IF_RUN_TOO_EARLY ON)
endif()
set(libstdcxx_la_linker_flag)
if(EXISTS /usr/sfw/lib/libstdc++.la)
file(READ /usr/sfw/lib/libstdc++.la _ch LIMIT 1)
if(string(LENGTH _ch) EQUAL 0)
set(libstdcxx_la_linker_flag "-L${CMAKE_CURRENT_SOURCE_DIR}/src/solaris")
endif()
endif()
check_cxx_source_compiles(
"#include <string>
#include <vector>
int main() { pthread_t th; pthread_join(th, 0); return 0; }"
have_pthread_despite_asking_for)
check_variable_exists("program_invocation_name" HAVE_PROGRAM_INVOCATION_NAME)
if(MINGW)
check_symbol_exists("sleep" "unistd.h" HAVE_DECL_SLEEP)
check_symbol_exists("nanosleep" "time.h" HAVE_DECL_NANOSLEEP)
endif()
if(LINUX)
check_c_source_compiles("
#include <signal.h>
#include <time.h>
int main() { return SIGEV_THREAD_ID || CLOCK_THREAD_CPUTIME_ID; }"
HAVE_LINUX_SIGEV_THREAD_ID)
endif()
configure_file(cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
configure_file(cmake/tcmalloc.h.in
${CMAKE_CURRENT_BINARY_DIR}/gperftools/tcmalloc.h
@ONLY)
if(GPERFTOOLS_BUILD_CPU_PROFILER OR
GPERFTOOLS_BUILD_HEAP_PROFILER OR
GPERFTOOLS_BUILD_HEAP_CHECKER)
set(WITH_STACK_TRACE ON)
endif()
# The following matters only if we're not using libunwind and if we
# care about backtrace capturing, and frame pointers are not available
# to capture backtraces. The idea is to warn user about less stable or
# known bad configurations (e.g. encourage to install libunwind).
if (NOT unwind_libs AND NOT gperftools_build_minimal AND
omit_fp_by_default AND NOT gperftools_enable_frame_pointers)
if(HAVE_UNWIND_BACKTRACE)
message(WARNING "No frame pointers and no libunwind. "
"Using experimental backtrace capturing via libgcc. "
"Expect crashy cpu profiler.")
elseif(gperftools_enable_stacktrace_via_backtrace)
message(WARNING "No frame pointers and no libunwind. "
"Using experimental backtrace(). "
"Expect crashy cpu profiler.")
else()
message(FATAL_ERROR "No frame pointers and no libunwind. "
"The compilation will fail.")
endif()
endif()
# Based on Makefile.am
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# This is so we can #include <gperftools/foo>
include_directories($<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
if(NOT WITH_STACK_TRACE)
add_compile_definitions(NO_TCMALLOC_SAMPLES)
endif()
# These are good warnings to turn on by default.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare")
# On i386, -mmmx is needed for the mmx-based instructions in
# atomicops-internal-x86.h. Also as of gcc 4.6, -fomit-frame-pointer
# is the default. Since we must always have frame pointers for I386
# in order to generate backtraces we now specify -fno-omit-frame-pointer
# by default.
if(i386)
add_compile_options(-mmmx -fno-omit-frame-pointer)
endif()
endif()
if(have_w_no_unused_result)
add_compile_options(-Wno-unused-result)
endif()
if(have_sized_deallocation)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsized-deallocation")
endif()
if(have_f_aligned_new)
add_compile_options(-faligned-new)
endif()
# LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug.
add_link_options(${libstdcxx_la_linker_flag})
option(
gperftools_enable_frame_pointers
"Compile with -fno-omit-frame-pointer (see INSTALL)"
OFF)
if(gperftools_enable_frame_pointers)
add_compile_options(-fno-omit-frame-pointer)
endif()
if(omit_fp_by_default AND NOT gperftools_enable_frame_pointers)
add_compile_definitions(NO_FRAME_POINTER)
endif()
# For windows systems (at least, mingw), we need to tell all our
# tests to link in libtcmalloc using -u. This is because libtcmalloc
# accomplishes its tasks via patching, leaving no work for the linker
# to identify, so the linker will ignore libtcmalloc by default unless
# we explicitly create a dependency via -u.
set(TCMALLOC_FLAGS)
if(MINGW)
list(APPEND TCMALLOC_FLAGS "-Wl,-u__tcmalloc")
endif()
set(googleinclude_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
src/google/tcmalloc.h
)
install(FILES ${googleinclude_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/google
)
# This is a 'convenience library' -- it's not actually installed or anything
set(LOGGING_INCLUDES
src/base/logging.h
src/base/commandlineflags.h
src/base/basictypes.h
src/base/dynamic_annotations.h)
set(liblogging_la_SOURCES src/base/logging.cc
src/base/dynamic_annotations.c
${LOGGING_INCLUDES})
add_library(logging STATIC ${liblogging_la_SOURCES})
set(SYSINFO_INCLUDES
src/base/sysinfo.h
src/getenv_safe.h
src/base/logging.h
src/base/commandlineflags.h
src/base/arm_instruction_set_select.h
src/base/basictypes.h)
set(libsysinfo_la_SOURCES src/base/sysinfo.cc
${SYSINFO_INCLUDES})
set(libsysinfo_la_LIBADD ${NANOSLEEP_LIBS})
add_library(sysinfo STATIC ${libsysinfo_la_SOURCES})
target_link_libraries(sysinfo ${libsysinfo_la_LIBADD})
# For MinGW, we use also have to use libwindows Luckily, we need the
# windows.a library in exactly the same place we need spinlock.a
# (pretty much everywhere), so we can use the same variable name for
# each. We can also optimize the MinGW rule a bit by leaving out
# files we know aren't used on windows, such as
# atomicops-internals-x86.cc. libwindows also obsoletes the need for
# other files like system_alloc.cc.
if(MINGW OR MSVC)
set(WINDOWS_INCLUDES
src/windows/port.h
src/windows/mingw.h
src/windows/mini_disassembler.h
src/windows/mini_disassembler_types.h
src/windows/preamble_patcher.h)
set(libwindows_la_SOURCES ${WINDOWS_INCLUDES}
src/windows/port.cc
src/windows/system-alloc.cc
src/windows/ia32_modrm_map.cc
src/windows/ia32_opcode_map.cc
src/windows/mini_disassembler.cc
src/windows/patch_functions.cc
src/windows/preamble_patcher.cc
src/windows/preamble_patcher_with_stub.cc)
add_library(windows_object OBJECT ${libwindows_la_SOURCES})
add_library(windows INTERFACE)
target_sources(windows INTERFACE $<TARGET_OBJECTS:windows_object>)
# patch_functions.cc uses Psapi.lib. MSVC has a #pragma for that, but not us.
target_link_libraries(windows INTERFACE psapi)
set(SPINLOCK_INCLUDES src/base/spinlock.h
src/base/spinlock_internal.h
src/base/spinlock_win32-inl.h
src/base/spinlock_linux-inl.h
src/base/spinlock_posix-inl.h
src/base/atomicops-internals-macosx.h
src/base/atomicops-internals-linuxppc.h
src/base/atomicops-internals-arm-generic.h
src/base/atomicops-internals-arm-v6plus.h
src/base/atomicops-internals-mips.h
src/base/atomicops-internals-windows.h
src/base/atomicops-internals-gcc.h
src/base/atomicops-internals-x86.h)
set(libspinlock_la_SOURCES src/base/spinlock.cc
src/base/spinlock_internal.cc
src/base/atomicops-internals-x86.cc
${SPINLOCK_INCLUDES})
add_library(spinlock STATIC ${libspinlock_la_SOURCES})
set(LIBSPINLOCK windows spinlock sysinfo logging)
# We also need to tell mingw that sysinfo.cc needs shlwapi.lib.
# (We do this via a #pragma for msvc, but need to do it here for mingw).
target_link_libraries(sysinfo shlwapi)
if(have_pthread_despite_asking_for)
add_library(maybe_threads STATIC src/maybe_threads.cc)
set(maybe_threads_lib maybe_threads)
endif()
else()
set(SPINLOCK_INCLUDES src/base/spinlock.h
src/base/spinlock_internal.h
src/base/atomicops.h
src/base/atomicops-internals-macosx.h
src/base/atomicops-internals-linuxppc.h
src/base/atomicops-internals-windows.h
src/base/atomicops-internals-x86.h)
set(libspinlock_la_SOURCES src/base/spinlock.cc
src/base/spinlock_internal.cc
src/base/atomicops-internals-x86.cc
${SPINLOCK_INCLUDES})
add_library(spinlock STATIC ${libspinlock_la_SOURCES})
target_link_libraries(spinlock ${nanosleep_libs})
set(LIBSPINLOCK spinlock sysinfo logging)
set(TCMALLOC_CC "src/tcmalloc.cc")
set(SYSTEM_ALLOC_CC "src/system-alloc.cc")
add_library(maybe_threads STATIC src/maybe_threads.cc)
set(maybe_threads_lib maybe_threads)
endif()
if(BUILD_TESTING)
set(LOW_LEVEL_ALLOC_UNITTEST_INCLUDES
src/base/low_level_alloc.h
src/base/basictypes.h
src/gperftools/malloc_hook.h
src/gperftools/malloc_hook_c.h
src/malloc_hook-inl.h
src/malloc_hook_mmap_linux.h
src/malloc_hook_mmap_freebsd.h
${SPINLOCK_INCLUDES}
${LOGGING_INCLUDES})
set(low_level_alloc_unittest_SOURCES src/base/low_level_alloc.cc
src/malloc_hook.cc
src/tests/low_level_alloc_unittest.cc
${LOW_LEVEL_ALLOC_UNITTEST_INCLUDES})
if(MSVC OR MINGW)
list(APPEND low_level_alloc_unittest_SOURCES src/windows/port.cc)
endif()
add_executable(low_level_alloc_unittest ${low_level_alloc_unittest_SOURCES})
# 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.
target_compile_definitions(low_level_alloc_unittest PRIVATE NO_TCMALLOC_SAMPLES)
target_link_libraries(low_level_alloc_unittest spinlock sysinfo logging ${maybe_threads_lib})
add_test(low_level_alloc_unittest low_level_alloc_unittest)
set(ATOMICOPS_UNITTEST_INCLUDES src/base/atomicops.h
src/base/atomicops-internals-macosx.h
src/base/atomicops-internals-windows.h
src/base/atomicops-internals-x86.h
${LOGGING_INCLUDES})
set(atomicops_unittest_SOURCES src/tests/atomicops_unittest.cc
${ATOMICOPS_UNITTEST_INCLUDES})
if(MSVC OR MINGW)
list(APPEND atomicops_unittest_SOURCES src/windows/port.cc)
endif()
add_executable(atomicops_unittest ${atomicops_unittest_SOURCES})
target_link_libraries(atomicops_unittest spinlock sysinfo logging)
add_test(atomicops_unittest atomicops_unittest)
endif()
### ------- stack trace
if(WITH_STACK_TRACE)
set(S_STACKTRACE_INCLUDES src/stacktrace_impl_setup-inl.h
src/stacktrace_generic-inl.h
src/stacktrace_libgcc-inl.h
src/stacktrace_libunwind-inl.h
src/stacktrace_arm-inl.h
src/stacktrace_powerpc-inl.h
src/stacktrace_powerpc-darwin-inl.h
src/stacktrace_powerpc-linux-inl.h
src/stacktrace_x86-inl.h
src/stacktrace_win32-inl.h
src/stacktrace_instrument-inl.h
src/base/elf_mem_image.h
src/base/vdso_support.h)
set(SG_STACKTRACE_INCLUDES src/gperftools/stacktrace.h)
set(STACKTRACE_INCLUDES ${S_STACKTRACE_INCLUDES} ${SG_STACKTRACE_INCLUDES})
list(APPEND perftoolsinclude_HEADERS ${SG_STACKTRACE_INCLUDES})
### Making the library
set(libstacktrace_la_SOURCES src/stacktrace.cc
src/base/elf_mem_image.cc
src/base/vdso_support.cc
${STACKTRACE_INCLUDES})
add_library(stacktrace INTERFACE)
add_library(stacktrace_object OBJECT ${libstacktrace_la_SOURCES})
target_link_libraries(stacktrace INTERFACE ${unwind_libs} ${LIBSPINLOCK})
target_sources(stacktrace INTERFACE $<TARGET_OBJECTS:stacktrace_object>)
set(libfake_stacktrace_scope_la_SOURCES src/fake_stacktrace_scope.cc)
add_library(fake_stacktrace_scope ${libfake_stacktrace_scope_la_SOURCES})
if(BUILD_TESTING)
set(STACKTRACE_UNITTEST_INCLUDES src/config_for_unittests.h
src/base/commandlineflags.h
${STACKTRACE_INCLUDES}
${LOGGING_INCLUDES})
set(stacktrace_unittest_SOURCES src/tests/stacktrace_unittest.cc
${STACKTRACE_UNITTEST_INCLUDES})
add_executable(stacktrace_unittest ${stacktrace_unittest_SOURCES})
target_link_libraries(stacktrace_unittest stacktrace logging fake_stacktrace_scope)
add_test(stacktrace_unittest stacktrace_unittest)
endif()
endif()
### ------- pprof
# If we are not compiling with stacktrace support, pprof is worthless
if(WITH_STACK_TRACE)
install(FILES src/pprof DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME pprof-symbolize)
if(BUILD_TESTING)
add_test(NAME pprof_unittest
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/src/pprof" -test
VERBATIM)
list(APPEND TESTS_ENVIRONMENT "PPROF_PATH=${CMAKE_CURRENT_SOURCE_DIR}/src/pprof")
endif()
if(INSTALL_PPROF)
install(FILES src/pprof DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
### ------- tcmalloc_minimal (thread-caching malloc)
### The header files we use. We divide into categories based on directory
set(S_TCMALLOC_MINIMAL_INCLUDES src/common.h
src/internal_logging.h
src/system-alloc.h
src/packed-cache-inl.h
${SPINLOCK_INCLUDES}
src/tcmalloc_guard.h
src/base/commandlineflags.h
src/base/basictypes.h
src/pagemap.h
src/sampler.h
src/central_freelist.h
src/linked_list.h
src/libc_override.h
src/libc_override_gcc_and_weak.h
src/libc_override_glibc.h
src/libc_override_osx.h
src/libc_override_redefine.h
src/page_heap.h
src/page_heap_allocator.h
src/span.h
src/static_vars.h
src/symbolize.h
src/thread_cache.h
src/stack_trace_table.h
src/base/thread_annotations.h
src/malloc_hook-inl.h
src/malloc_hook_mmap_linux.h
src/malloc_hook_mmap_freebsd.h)
set(SG_TCMALLOC_MINIMAL_INCLUDES src/gperftools/malloc_hook.h
src/gperftools/malloc_hook_c.h
src/gperftools/malloc_extension.h
src/gperftools/malloc_extension_c.h
src/gperftools/nallocx.h)
set(TCMALLOC_MINIMAL_INCLUDES ${S_TCMALLOC_MINIMAL_INCLUDES} ${SG_TCMALLOC_MINIMAL_INCLUDES} ${SG_STACKTRACE_INCLUDES})
list(APPEND perftoolsinclude_HEADERS ${SG_TCMALLOC_MINIMAL_INCLUDES})
### Making the library
set(libtcmalloc_minimal_internal_la_SOURCES src/common.cc
src/internal_logging.cc
${SYSTEM_ALLOC_CC}
src/memfs_malloc.cc
src/central_freelist.cc
src/page_heap.cc
src/sampler.cc
src/span.cc
src/stack_trace_table.cc
src/static_vars.cc
src/symbolize.cc
src/thread_cache.cc
src/malloc_hook.cc
src/malloc_extension.cc
${TCMALLOC_MINIMAL_INCLUDES})
add_library(tcmalloc_minimal_internal_object OBJECT ${libtcmalloc_minimal_internal_la_SOURCES})
# We #define NO_TCMALLOC_SAMPLES, since sampling is turned off for _minimal.
target_compile_definitions(tcmalloc_minimal_internal_object PRIVATE NO_TCMALLOC_SAMPLES NO_HEAP_CHECK NDEBUG)
add_library(tcmalloc_minimal_internal INTERFACE)
target_link_libraries(tcmalloc_minimal_internal INTERFACE ${LIBSPINLOCK} ${maybe_threads_lib})
target_sources(tcmalloc_minimal_internal INTERFACE $<TARGET_OBJECTS:tcmalloc_minimal_internal_object>)
set(libtcmalloc_minimal_la_SOURCES ${TCMALLOC_CC} ${TCMALLOC_MINIMAL_INCLUDES})
set(libtcmalloc_minimal_la_DEFINES NO_TCMALLOC_SAMPLES NDEBUG)
add_library(tcmalloc_minimal SHARED ${libtcmalloc_minimal_la_SOURCES})
target_compile_definitions(tcmalloc_minimal PRIVATE ${libtcmalloc_minimal_la_DEFINES})
set(libtcmalloc_minimal_la_LIBADD tcmalloc_minimal_internal)
target_link_libraries(tcmalloc_minimal PRIVATE tcmalloc_minimal_internal Threads::Threads)
if(MINGW)
target_link_libraries(tcmalloc_minimal PRIVATE stacktrace)
endif()
set_target_properties(tcmalloc_minimal PROPERTIES
VERSION ${TCMALLOC_SO_VERSION}
SOVERSION ${TCMALLOC_SO_VERSION})
weaken_object(tcmalloc_minimal)
install(TARGETS tcmalloc_minimal)
if(GPERFTOOLS_BUILD_STATIC)
add_library(tcmalloc_minimal_static STATIC ${libtcmalloc_minimal_internal_la_SOURCES})
target_compile_definitions(tcmalloc_minimal_static PRIVATE NO_TCMALLOC_SAMPLES NDEBUG)
target_link_libraries(tcmalloc_minimal_static PRIVATE tcmalloc_minimal_internal Threads::Threads)
if(MINGW)
target_link_libraries(tcmalloc_minimal_static PRIVATE stacktrace)
endif()
if(NOT MSVC)
set_target_properties(tcmalloc_minimal_static PROPERTIES
OUTPUT_NAME tcmalloc_minimal)
endif()
weaken_object(tcmalloc_minimal_static)
install(TARGETS tcmalloc_minimal_static)
endif()
if(BUILD_TESTING)
set(tcmalloc_minimal_unittest_SOURCES
src/tests/tcmalloc_unittest.cc
src/tests/testutil.h src/tests/testutil.cc
${TCMALLOC_UNITTEST_INCLUDES})
set(tcmalloc_minimal_unittest_LDADD
${TCMALLOC_FLAGS} Threads::Threads logging)
# We want libtcmalloc last on the link line, but due to a bug in
# libtool involving convenience libs, they need to come last on the
# link line in order to get dependency ordering right. This is ok:
# convenience libraries are .a's, so tcmalloc is still the last .so.
# We also put pthreads after tcmalloc, because some pthread
# implementations define their own malloc, and we need to go on the
# first linkline to make sure our malloc 'wins'.
add_executable(tcmalloc_minimal_unittest ${tcmalloc_minimal_unittest_SOURCES})
target_link_libraries(tcmalloc_minimal_unittest tcmalloc_minimal ${tcmalloc_minimal_unittest_LDADD})
add_test(tcmalloc_minimal_unittest tcmalloc_minimal_unittest)
if(NOT MSVC)
add_executable(tcm_min_asserts_unittest
src/tests/tcmalloc_unittest.cc
src/tests/testutil.cc)
target_compile_definitions(tcm_min_asserts_unittest PUBLIC NO_TCMALLOC_SAMPLES NO_HEAP_CHECK)
target_link_libraries(tcm_min_asserts_unittest tcmalloc_minimal Threads::Threads)
add_test(tcm_min_asserts_unittest tcm_min_asserts_unittest)
endif()
add_executable(tcmalloc_minimal_large_unittest
src/tests/tcmalloc_large_unittest.cc
src/tests/testutil.cc
src/tests/testutil.h)
target_link_libraries(tcmalloc_minimal_large_unittest tcmalloc_minimal Threads::Threads)
add_test(tcmalloc_minimal_large_unittest tcmalloc_minimal_large_unittest)
add_executable(tcmalloc_minimal_large_heap_fragmentation_unittest
src/tests/large_heap_fragmentation_unittest.cc)
target_link_libraries(
tcmalloc_minimal_large_heap_fragmentation_unittest PUBLIC tcmalloc_minimal)
add_test(tcmalloc_minimal_large_heap_fragmentation_unittest tcmalloc_minimal_large_heap_fragmentation_unittest)
if(BUILD_SHARED_LIBS AND NOT MINGW)
add_custom_target(maybe_threads_unittest
COMMAND src/tests/maybe_threads_unittest.sh
VERBATIM)
add_test(maybe_threads_unittest maybe_threads_unittest)
endif()
if(MINGW OR MSVC)
set(port_src src/windows/port.cc)
endif()
add_executable(addressmap_unittest
src/tests/addressmap_unittest.cc
src/addressmap-inl.h
${port_src})
target_link_libraries(addressmap_unittest logging)
add_test(addressmap_unittest addressmap_unittest)
if(NOT MINGW)
add_executable(system_alloc_unittest src/tests/system-alloc_unittest.cc)
target_link_libraries(system_alloc_unittest PUBLIC tcmalloc_minimal)
add_test(system_alloc_unittest system_alloc_unittest)
endif()
add_executable(packed_cache_test src/tests/packed-cache_test.cc)
target_link_libraries(packed_cache_test PUBLIC tcmalloc_minimal)
add_test(packed_cache_test packed_cache_test)
add_executable(frag_unittest src/tests/frag_unittest.cc)
target_link_libraries(frag_unittest PUBLIC tcmalloc_minimal)
add_test(frag_unittest frag_unittest)
add_executable(markidle_unittest
src/tests/markidle_unittest.cc
src/tests/testutil.cc)
target_link_libraries(markidle_unittest tcmalloc_minimal Threads::Threads)
add_test(markidle_unittest markidle_unittest)
add_executable(current_allocated_bytes_test
src/tests/current_allocated_bytes_test.cc)
target_link_libraries(current_allocated_bytes_test PUBLIC tcmalloc_minimal)
add_test(current_allocated_bytes_test current_allocated_bytes_test)
add_executable(malloc_hook_test
src/tests/malloc_hook_test.cc
src/tests/testutil.cc)
target_link_libraries(malloc_hook_test tcmalloc_minimal Threads::Threads)
add_test(malloc_hook_test malloc_hook_test)
set(malloc_extension_test_SOURCES src/tests/malloc_extension_test.cc
src/config_for_unittests.h
src/base/logging.h
src/gperftools/malloc_extension.h
src/gperftools/malloc_extension_c.h)
set(malloc_extension_test_LIBADD Threads::Threads ${TCMALLOC_FLAGS})
add_executable(malloc_extension_test ${malloc_extension_test_SOURCES})
target_link_libraries(malloc_extension_test tcmalloc_minimal ${malloc_extension_test_LIBADD})
add_test(malloc_extension_test malloc_extension_test)
if(NOT MSVC)
add_executable(malloc_extension_c_test src/tests/malloc_extension_c_test.c)
target_link_libraries(malloc_extension_c_test PUBLIC
tcmalloc_minimal stdc++ m)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(malloc_extension_c_test PUBLIC "-ansi")
endif()
add_test(malloc_extension_c_test malloc_extension_c_test)
endif()
if(NOT MINGW AND NOT MSVC AND NOT APPLE)
set(memalign_unittest_SOURCES src/tests/memalign_unittest.cc
src/tcmalloc.h
src/config_for_unittests.h
src/tests/testutil.h src/tests/testutil.cc)
add_executable(memalign_unittest ${memalign_unittest_SOURCES})
target_link_libraries(memalign_unittest tcmalloc_minimal Threads::Threads)
add_test(memalign_unittest memalign_unittest)
endif()
add_executable(page_heap_test src/tests/page_heap_test.cc)
if(MSVC)
target_link_libraries(page_heap_test tcmalloc_minimal_static)
else()
target_link_libraries(page_heap_test tcmalloc_minimal)
endif()
add_test(page_heap_test page_heap_test)
add_executable(pagemap_unittest src/tests/pagemap_unittest.cc)
target_link_libraries(pagemap_unittest PUBLIC tcmalloc_minimal)
add_test(pagemap_unittest pagemap_unittest)
set(realloc_unittest_SOURCES src/tests/realloc_unittest.cc
src/config_for_unittests.h
src/base/logging.h)
set(realloc_unittest_LDFLAGS Threads::Threads ${TCMALLOC_FLAGS})
add_executable(realloc_unittest ${realloc_unittest_SOURCES})
target_link_libraries(realloc_unittest PUBLIC tcmalloc_minimal ${realloc_unittest_LDFLAGS})
add_test(realloc_unittest realloc_unittest)
add_executable(stack_trace_table_test src/tests/stack_trace_table_test.cc)