-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathjemalloc.cmake
More file actions
65 lines (50 loc) · 2.35 KB
/
jemalloc.cmake
File metadata and controls
65 lines (50 loc) · 2.35 KB
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
# Copyright 2019-2022 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
## \author Gvozden Nešković, Frankfurt Institute for Advanced Studies and Goethe University Frankfurt
## \brief build jemalloc dependency
#--- EXTERNAL PROJECTS --------------------------------------------------------------
include(ExternalProject)
ExternalProject_Add(jemalloc
GIT_REPOSITORY "https://github.com/jemalloc/jemalloc.git"
GIT_TAG "5.3.0"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
UPDATE_COMMAND ""
PATCH_COMMAND ""
SOURCE_DIR "${CMAKE_BINARY_DIR}/3rdparty/jemalloc"
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${jemalloc_STATIC} ${jemalloc_STATIC_PIC}
CONFIGURE_COMMAND ./autogen.sh
COMMAND ./configure --disable-shared
--disable-doc
--prefix=${CMAKE_BINARY_DIR}/jemalloc
--with-malloc-conf=abort_conf:true,background_thread:true,metadata_thp:auto,dirty_decay_ms:300000,muzzy_decay_ms:300000
"CFLAGS=${CMAKE_C_FLAGS} -Wno-missing-attributes"
BUILD_COMMAND ${MAKE}
# TODO: -j1 is a workaround for GH-39628: [C++] Use -j1 for cmake >= 3.28
# Similar solution in Apache Arrow: https://github.com/apache/arrow/pull/39629
INSTALL_COMMAND make install -j1
LOG_DOWNLOAD True
LOG_UPDATE True
LOG_INSTALL True
LOG_OUTPUT_ON_FAILURE True
)
set(jemalloc_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/include)
add_library(jemalloc_STATIC STATIC IMPORTED)
set_property(TARGET jemalloc_STATIC PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc.a)
add_dependencies(jemalloc_STATIC jemalloc)
add_library(jemalloc_STATIC_PIC STATIC IMPORTED)
set_property(TARGET jemalloc_STATIC_PIC PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc_pic.a)
add_dependencies(jemalloc_STATIC_PIC jemalloc)
if (!APPLE)
link_libraries(-Wl,--no-as-needed)
endif(!APPLE)
link_libraries(dl ${jemalloc_STATIC_PIC})