mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-03 20:13:47 +03:00
Add TCMalloc
This commit is contained in:
parent
c31cb1e450
commit
a3b72c2ffe
@ -49,12 +49,20 @@ if(USE_CUDNN)
|
||||
endif(CUDNN_FOUND)
|
||||
endif(USE_CUDNN)
|
||||
|
||||
find_package(Tcmalloc)
|
||||
if(Tcmalloc_FOUND)
|
||||
include_directories(${Tcmalloc_INCLUDE_DIR})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${Tcmalloc_LIBRARIES})
|
||||
else(Tcmalloc_FOUND)
|
||||
message(WARNING "Cannot find TCMalloc library. Continuing.")
|
||||
endif(Tcmalloc_FOUND)
|
||||
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${ZLIB_LIBRARIES})
|
||||
else(ZLIB_FOUND)
|
||||
message(SEND_ERROR "Cannot find zlib" )
|
||||
message(SEND_ERROR "Cannot find zlib.")
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
set(BOOST_COMPONENTS system timer iostreams filesystem chrono program_options thread)
|
||||
@ -66,7 +74,7 @@ if(PYTHONLIBS_FOUND)
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${PYTHON_LIBRARIES})
|
||||
else(PYTHONLIBS_FOUND)
|
||||
message(WARNING "Cannot find python libraries. Building without bindings." )
|
||||
message(WARNING "Cannot find python libraries. Building without bindings.")
|
||||
endif(PYTHONLIBS_FOUND)
|
||||
|
||||
find_package(OpenSSL)
|
||||
@ -76,7 +84,7 @@ if(OpenSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${OPENSSL_CRYPTO_LIBRARY})
|
||||
else(OpenSSL_FOUND)
|
||||
message(WARNING "Cannot find OpenSSL library. Not compiling server." )
|
||||
message(WARNING "Cannot find OpenSSL library. Not compiling server.")
|
||||
endif(OpenSSL_FOUND)
|
||||
|
||||
find_package(Boost COMPONENTS ${BOOST_COMPONENTS})
|
||||
@ -84,7 +92,7 @@ if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${Boost_LIBRARIES})
|
||||
else(Boost_FOUND)
|
||||
message(SEND_ERROR "Cannot find Boost libraries. Terminating." )
|
||||
message(SEND_ERROR "Cannot find Boost libraries. Terminating.")
|
||||
endif(Boost_FOUND)
|
||||
|
||||
if(COMPILE_TESTS)
|
||||
|
39
cmake/FindTcmalloc.cmake
Normal file
39
cmake/FindTcmalloc.cmake
Normal file
@ -0,0 +1,39 @@
|
||||
# - Find Tcmalloc
|
||||
# Find the native Tcmalloc includes and library
|
||||
#
|
||||
# Tcmalloc_INCLUDE_DIR - where to find Tcmalloc.h, etc.
|
||||
# Tcmalloc_LIBRARIES - List of libraries when using Tcmalloc.
|
||||
# Tcmalloc_FOUND - True if Tcmalloc found.
|
||||
|
||||
find_path(Tcmalloc_INCLUDE_DIR google/tcmalloc.h)
|
||||
|
||||
if (USE_TCMALLOC)
|
||||
set(Tcmalloc_NAMES tcmalloc)
|
||||
else ()
|
||||
set(Tcmalloc_NAMES tcmalloc_minimal tcmalloc)
|
||||
endif ()
|
||||
|
||||
find_library(Tcmalloc_LIBRARY NAMES ${Tcmalloc_NAMES})
|
||||
|
||||
if (Tcmalloc_INCLUDE_DIR AND Tcmalloc_LIBRARY)
|
||||
set(Tcmalloc_FOUND TRUE)
|
||||
set( Tcmalloc_LIBRARIES ${Tcmalloc_LIBRARY} )
|
||||
else ()
|
||||
set(Tcmalloc_FOUND FALSE)
|
||||
set( Tcmalloc_LIBRARIES )
|
||||
endif ()
|
||||
|
||||
if (Tcmalloc_FOUND)
|
||||
message(STATUS "Found Tcmalloc: ${Tcmalloc_LIBRARY}")
|
||||
else ()
|
||||
message(STATUS "Not Found Tcmalloc")
|
||||
if (Tcmalloc_FIND_REQUIRED)
|
||||
message(STATUS "Looked for Tcmalloc libraries named ${Tcmalloc_NAMES}.")
|
||||
message(FATAL_ERROR "Could NOT find Tcmalloc library")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(
|
||||
Tcmalloc_LIBRARY
|
||||
Tcmalloc_INCLUDE_DIR
|
||||
)
|
Loading…
Reference in New Issue
Block a user