Commit d20b9bf6 authored by Rich Prohaska's avatar Rich Prohaska

Tokutek/mariadb#12 rebase to mariadb-5.5.34

parent 439465dd
include(ExternalProject) include(ExternalProject)
## add jemalloc with an external project if (NOT DEFINED LIBJEMALLOC)
set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.") ## add jemalloc with an external project
if (NOT EXISTS "${JEMALLOC_SOURCE_DIR}/configure") set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.")
message(FATAL_ERROR "Can't find jemalloc sources. Please check them out to ${JEMALLOC_SOURCE_DIR} or modify JEMALLOC_SOURCE_DIR.") if (NOT EXISTS "${JEMALLOC_SOURCE_DIR}/configure")
endif () message(FATAL_ERROR "Can't find jemalloc sources. Please check them out to ${JEMALLOC_SOURCE_DIR} or modify JEMALLOC_SOURCE_DIR.")
set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence") endif ()
option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF) set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence")
if (JEMALLOC_DEBUG) option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF)
list(APPEND jemalloc_configure_opts --enable-debug) if (JEMALLOC_DEBUG)
endif () list(APPEND jemalloc_configure_opts --enable-debug)
ExternalProject_Add(build_jemalloc endif ()
PREFIX jemalloc ExternalProject_Add(build_jemalloc
SOURCE_DIR "${JEMALLOC_SOURCE_DIR}" PREFIX jemalloc
CONFIGURE_COMMAND SOURCE_DIR "${JEMALLOC_SOURCE_DIR}"
"${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts} CONFIGURE_COMMAND
"--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc" "${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts}
) "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc"
)
add_library(jemalloc STATIC IMPORTED GLOBAL) add_library(jemalloc STATIC IMPORTED GLOBAL)
set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a") "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a")
add_dependencies(jemalloc build_jemalloc) add_dependencies(jemalloc build_jemalloc)
add_library(jemalloc_nopic STATIC IMPORTED GLOBAL) add_library(jemalloc_nopic STATIC IMPORTED GLOBAL)
set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a") "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a")
add_dependencies(jemalloc_nopic build_jemalloc) add_dependencies(jemalloc_nopic build_jemalloc)
# detect when we are being built as a subproject # detect when we are being built as a subproject
if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING) if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
install( install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" DESTINATION .)
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" endif ()
DESTINATION .
)
endif () endif ()
## add lzma with an external project ## add lzma with an external project
......
...@@ -15,13 +15,13 @@ set(tokuportability_srcs ...@@ -15,13 +15,13 @@ set(tokuportability_srcs
) )
add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs}) add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs})
target_link_libraries(${LIBTOKUPORTABILITY} LINK_PRIVATE jemalloc) target_link_libraries(${LIBTOKUPORTABILITY} LINK_PRIVATE ${LIBJEMALLOC})
target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS}) target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
add_library(tokuportability_static_conv STATIC ${tokuportability_srcs}) add_library(tokuportability_static_conv STATIC ${tokuportability_srcs})
set_target_properties(tokuportability_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(tokuportability_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_dependencies(tokuportability_static_conv build_jemalloc) add_dependencies(tokuportability_static_conv build_jemalloc)
set(tokuportability_source_libs tokuportability_static_conv jemalloc ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS}) set(tokuportability_source_libs tokuportability_static_conv ${LIBJEMALLOC} ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
toku_merge_static_libs(${LIBTOKUPORTABILITY}_static ${LIBTOKUPORTABILITY}_static "${tokuportability_source_libs}") toku_merge_static_libs(${LIBTOKUPORTABILITY}_static ${LIBTOKUPORTABILITY}_static "${tokuportability_source_libs}")
maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} tokuportability_static_conv) maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} tokuportability_static_conv)
......
...@@ -93,7 +93,6 @@ PATENT RIGHTS GRANT: ...@@ -93,7 +93,6 @@ PATENT RIGHTS GRANT:
#include <toku_portability.h> #include <toku_portability.h>
#include <stdlib.h> #include <stdlib.h>
#include <jemalloc/include/jemalloc/jemalloc.h>
#if defined(HAVE_MALLOC_H) #if defined(HAVE_MALLOC_H)
# include <malloc.h> # include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H) #elif defined(HAVE_SYS_MALLOC_H)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment