summarylogtreecommitdiffstats
path: root/system-tcmalloc.patch
blob: d223da9935e7890d7df625304b1e42f4eea197d6 (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
@@ -543,39 +543,19 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src/binfhe/include )
 
 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/src/core )
 
-### Handle third-party gperftools for optional tcmalloc
-
-add_custom_target(
-    tcm
-    COMMAND ./autogen.sh
-    COMMAND ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/third-party --enable-minimal
-    COMMAND make
-    COMMAND make install
-    WORKING_DIRECTORY ${THIRDPARTYDIR}/gperftools
-)
-
-add_custom_target(
-    tcm_clean
-    COMMAND rm -rf include/gperftools include/google lib/libtcmalloc_minimal* lib/pkgconfig/libtcmalloc* lib/pkgconfig/libprofiler.pc share/doc/gperftools
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-party
-)
+### Handle optional tcmalloc
 
 if(BUILD_STATIC)
-add_library(tcmalloc_static STATIC IMPORTED GLOBAL)
-set_target_properties(tcmalloc_static PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/third-party/lib/libtcmalloc_minimal${CMAKE_STATIC_LIBRARY_SUFFIX})
+find_library(TCMALLOC_STATIC_LIB NAMES libtcmalloc_minimal.a)
 endif()
 
 if(BUILD_SHARED)
-add_library(tcmalloc SHARED IMPORTED GLOBAL)
-set_target_properties(tcmalloc PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/third-party/lib/libtcmalloc_minimal${CMAKE_SHARED_LIBRARY_SUFFIX})
+find_library(TCMALLOC_LIB NAMES tcmalloc_minimal)
 endif()
 
 if(WITH_TCM)
-    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-party/lib DESTINATION .
-        FILES_MATCHING PATTERN "libtcmalloc_minimal.*")
-    list(APPEND THIRDPARTYLIBS "tcmalloc")
-    list(APPEND THIRDPARTYSTATICLIBS "tcmalloc_static")
-    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-party/include DESTINATION include/openfhe/third-party/)
+    list(APPEND THIRDPARTYLIBS "${TCMALLOC_LIB}")
+    list(APPEND THIRDPARTYSTATICLIBS "${TCMALLOC_STATIC_LIB}")
 endif()
 
 if(WITH_NTL)