diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-09-12 08:41:16 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-09-12 08:41:16 +0200 |
commit | 3d9452363848a5de70260f5b72900fb016075b3c (patch) | |
tree | b7a1c8d52a4cca17538da77eb5e125ed14aa285a /cmake/jemalloc.cmake | |
parent | ae3cc4f1b7530da66ff1f65d4416451446da36a9 (diff) | |
download | mariadb-git-3d9452363848a5de70260f5b72900fb016075b3c.tar.gz |
MDEV-6613 build system endianness test fails for ppc64le (i.e. Ubuntu)
* remove bundled jemalloc, use the system one
* force jemalloc in release builds on linux
Diffstat (limited to 'cmake/jemalloc.cmake')
-rw-r--r-- | cmake/jemalloc.cmake | 64 |
1 files changed, 11 insertions, 53 deletions
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake index bc6bf60781d..3ad24f8f6cb 100644 --- a/cmake/jemalloc.cmake +++ b/cmake/jemalloc.cmake @@ -1,65 +1,23 @@ -# old cmake does not have ExternalProject file -IF(CMAKE_VERSION VERSION_LESS "2.8.6") - MACRO (CHECK_JEMALLOC) - ENDMACRO() - RETURN() -ENDIF() +INCLUDE (CheckLibraryExists) -INCLUDE(ExternalProject) +SET(WITH_JEMALLOC auto CACHE STRING + "Build with jemalloc (possible values are 'yes', 'no', 'auto')") -MACRO (USE_BUNDLED_JEMALLOC) - SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/extra/jemalloc") - SET(BINARY_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/extra/jemalloc/build") - SET(LIBJEMALLOC "libjemalloc") - SET(JEMALLOC_CONFIGURE_OPTS "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" "--with-private-namespace=jemalloc_internal_" "--enable-cc-silence") - IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT APPLE) # see the comment in CMakeLists.txt - LIST(APPEND JEMALLOC_CONFIGURE_OPTS --enable-debug) +MACRO (CHECK_JEMALLOC) + # compatibility with old WITH_JEMALLOC values + IF(WITH_JEMALLOC STREQUAL "bundled") + MESSAGE(FATAL_ERROR "MariaDB no longer bundles jemalloc") ENDIF() - - IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(MAKE_COMMAND ${CMAKE_MAKE_PROGRAM}) - ELSE() # Xcode/Ninja generators - SET(MAKE_COMMAND make) + IF(WITH_JEMALLOC STREQUAL "system") + SET(WITH_JEMALLOC "yes") ENDIF() - - ExternalProject_Add(jemalloc - PREFIX extra/jemalloc - SOURCE_DIR ${SOURCE_DIR} - BINARY_DIR ${BINARY_DIR} - STAMP_DIR ${BINARY_DIR} - CONFIGURE_COMMAND "${SOURCE_DIR}/configure" ${JEMALLOC_CONFIGURE_OPTS} - BUILD_COMMAND ${MAKE_COMMAND} "build_lib_static" - INSTALL_COMMAND "" - ) - ADD_LIBRARY(libjemalloc STATIC IMPORTED) - SET_TARGET_PROPERTIES(libjemalloc PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/lib/libjemalloc_pic.a") - ADD_DEPENDENCIES(libjemalloc jemalloc) -ENDMACRO() - -IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR APPLE) - # Linux and OSX are the only systems where bundled jemalloc can be built without problems, - # as they both have GNU make and jemalloc actually compiles. - # Also, BSDs use jemalloc as malloc already - SET(WITH_JEMALLOC_DEFAULT "yes") -ELSE() - SET(WITH_JEMALLOC_DEFAULT "no") -ENDIF() -SET(WITH_JEMALLOC ${WITH_JEMALLOC_DEFAULT} CACHE STRING - "Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") - -MACRO (CHECK_JEMALLOC) - IF(WITH_JEMALLOC STREQUAL "system" OR WITH_JEMALLOC STREQUAL "yes") + IF(WITH_JEMALLOC STREQUAL "yes" OR WITH_JEMALLOC STREQUAL "auto") CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC) IF (HAVE_JEMALLOC) SET(LIBJEMALLOC jemalloc) - ELSEIF (WITH_JEMALLOC STREQUAL "system") - MESSAGE(FATAL_ERROR "system jemalloc is not found") ELSEIF (WITH_JEMALLOC STREQUAL "yes") - SET(trybundled 1) + MESSAGE(FATAL_ERROR "jemalloc is not found") ENDIF() ENDIF() - IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled) - USE_BUNDLED_JEMALLOC() - ENDIF() ENDMACRO() |