You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.1KB

  1. # Download and build Jemalloc
  2. set(JEMALLOC_VERSION 5.2.1)
  3. set(JEMALLOC_NAME jemalloc-${JEMALLOC_VERSION})
  4. set(JEMALLOC_TAR_PATH ${DEP_ROOT_DIR}/${JEMALLOC_NAME}.tar.bz2)
  5. list(APPEND jemalloc_CONFIG_ARGS --disable-initial-exec-tls)
  6. list(APPEND jemalloc_CONFIG_ARGS --without-export)
  7. list(APPEND jemalloc_CONFIG_ARGS --disable-stats)
  8. list(APPEND jemalloc_CONFIG_ARGS --disable-libdl)
  9. #list(APPEND jemalloc_CONFIG_ARGS --disable-cxx)
  10. #list(APPEND jemalloc_CONFIG_ARGS --with-jemalloc-prefix=je_)
  11. #list(APPEND jemalloc_CONFIG_ARGS --enable-debug)
  12. if(NOT EXISTS ${JEMALLOC_TAR_PATH})
  13. message(STATUS "Downloading ${JEMALLOC_NAME}...")
  14. file(DOWNLOAD https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/${JEMALLOC_NAME}.tar.bz2
  15. ${JEMALLOC_TAR_PATH})
  16. endif()
  17. SET( DIR_CONTAINING_JEMALLOC ${DEP_ROOT_DIR}/${JEMALLOC_NAME} )
  18. if(NOT EXISTS ${DIR_CONTAINING_JEMALLOC})
  19. message(STATUS "Extracting jemalloc...")
  20. execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${JEMALLOC_TAR_PATH} WORKING_DIRECTORY ${DEP_ROOT_DIR})
  21. endif()
  22. if(NOT EXISTS ${DIR_CONTAINING_JEMALLOC}/Makefile)
  23. message("Configuring jemalloc locally...")
  24. # Builds with "--with-jemalloc-prefix=je_" on OSX
  25. # SET( BASH_COMMAND_TO_RUN bash -l -c "cd ${DIR_CONTAINING_JEMALLOC} && ./configure ${jemalloc_CONFIG_ARGS}" )
  26. #
  27. # EXECUTE_PROCESS( COMMAND ${BASH_COMMAND_TO_RUN}
  28. # WORKING_DIRECTORY ${DIR_CONTAINING_JEMALLOC} RESULT_VARIABLE JEMALLOC_CONFIGURE )
  29. execute_process(COMMAND ./configure ${jemalloc_CONFIG_ARGS} WORKING_DIRECTORY ${DIR_CONTAINING_JEMALLOC} RESULT_VARIABLE JEMALLOC_CONFIGURE)
  30. if(NOT JEMALLOC_CONFIGURE EQUAL 0)
  31. message(FATAL_ERROR "${JEMALLOC_NAME} configure failed!")
  32. message("${JEMALLOC_CONFIGURE}")
  33. endif()
  34. endif()
  35. if(NOT EXISTS ${DIR_CONTAINING_JEMALLOC}/lib/libjemalloc.a)
  36. message("Building jemalloc locally...")
  37. execute_process(COMMAND make "build_lib_static" WORKING_DIRECTORY ${DIR_CONTAINING_JEMALLOC})
  38. if(NOT EXISTS ${DIR_CONTAINING_JEMALLOC}/lib/libjemalloc.a)
  39. message(FATAL_ERROR "${JEMALLOC_NAME} build failed!")
  40. endif()
  41. endif()