blob: dace3662c680a0f3adbd7a8e47f6bd2dc7a005a3 (
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
|
# This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
# We need to generate the jemalloc_def.h header based on platform-specific settings
if (PLATFORM EQUAL 32)
set(JEM_SIZEDEF 2)
set(JEM_TLSMODEL)
else()
set(JEM_SIZEDEF 3)
set(JEM_TLSMODEL "__attribute__\(\(tls_model\(\"initial-exec\"\)\)\)")
endif()
# Create the header, so we can use it
configure_file(
"${CMAKE_SOURCE_DIR}/dep/jemalloc/jemalloc_defs.h.in.cmake"
"${BUILDDIR}/jemalloc_defs.h"
@ONLY
)
# Done, let's continue
set(jemalloc_STAT_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/arena.c
${CMAKE_CURRENT_SOURCE_DIR}/src/atomic.c
${CMAKE_CURRENT_SOURCE_DIR}/src/base.c
${CMAKE_CURRENT_SOURCE_DIR}/src/bitmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_dss.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_mmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ckh.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ctl.c
${CMAKE_CURRENT_SOURCE_DIR}/src/extent.c
${CMAKE_CURRENT_SOURCE_DIR}/src/hash.c
${CMAKE_CURRENT_SOURCE_DIR}/src/huge.c
${CMAKE_CURRENT_SOURCE_DIR}/src/jemalloc.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mb.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mutex.c
${CMAKE_CURRENT_SOURCE_DIR}/src/prof.c
${CMAKE_CURRENT_SOURCE_DIR}/src/quarantine.c
${CMAKE_CURRENT_SOURCE_DIR}/src/rtree.c
${CMAKE_CURRENT_SOURCE_DIR}/src/stats.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tcache.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tsd.c
${CMAKE_CURRENT_SOURCE_DIR}/src/util.c
)
add_library(jemalloc STATIC ${jemalloc_STAT_SRC})
target_include_directories(jemalloc
PRIVATE
${BUILDDIR}
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(jemalloc
PUBLIC
-DNO_BUFFERPOOL
PRIVATE
-D_GNU_SOURCE
-D_REENTRAN)
target_link_libraries(jemalloc
PRIVATE
trinity-dependency-interface
PUBLIC
threads
valgrind)
set_target_properties(jemalloc
PROPERTIES
FOLDER
"dep")
else()
# Provide a dummy target for jemalloc which is used when jemalloc
# is disabled or not supported.
add_library(jemalloc INTERFACE)
target_link_libraries(jemalloc
INTERFACE
valgrind)
endif()
|