diff --git a/README.md b/README.md index ec0695e6d3..57f991ae64 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,13 @@ Instructions for RELEASE build cmake -DCMAKE_BUILD_TYPE=RELEASE ../../src make +Instructions for installing gperftools on Ubuntu + + sudo add-apt-repository ppa:agent-8131/ppa + sudo apt-get update + sudo apt-get dist-upgrade + sudo apt-get install libgoogle-perftools-dev + Instructions for installing gcc-4.8 (C++11 compatible) on Ubuntu sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y diff --git a/src/cmake/CheckTcmalloc.cc b/src/cmake/CheckTcmalloc.cc new file mode 100644 index 0000000000..fced3967ea --- /dev/null +++ b/src/cmake/CheckTcmalloc.cc @@ -0,0 +1,37 @@ +/** -*- C++ -*- + * Copyright (C) 2009 Luke Lu (llu@hypertable.org) + * + * This file is part of Hypertable. + * + * Hypertable is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * Hypertable is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Hypertable. If not, see + */ + +#include +#include +#include + +int main() { + int major, minor; + const char *patch; + const char *version = tc_version(&major, &minor, &patch); + + if (major != TC_VERSION_MAJOR || minor != TC_VERSION_MINOR || + strcmp(patch, TC_VERSION_PATCH)) { + fprintf(stderr, "Tcmalloc header/library mismatch:\n " + "header: %s\nlibrary: %s\n", TC_VERSION_STRING, version); + return 1; + } + printf("%d.%d%s", major, minor, patch); + return 0; +} diff --git a/src/cmake/FindGMP.cmake b/src/cmake/FindGMP.cmake new file mode 100644 index 0000000000..795c2cdcde --- /dev/null +++ b/src/cmake/FindGMP.cmake @@ -0,0 +1,13 @@ +if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + # Already in cache, be silent + set(GMP_FIND_QUIETLY TRUE) +endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + +find_path(GMP_INCLUDE_DIR NAMES gmp.h ) +find_library(GMP_LIBRARIES NAMES gmp libgmp REQUIRED) +#find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx ) +#MESSAGE(STATUS "GMP: " ${GMP_LIBRARIES}) # " " ${GMPXX_LIBRARIES} ) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) +mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) \ No newline at end of file diff --git a/src/cmake/FindTcmalloc.cmake b/src/cmake/FindTcmalloc.cmake new file mode 100644 index 0000000000..0a4e2baf88 --- /dev/null +++ b/src/cmake/FindTcmalloc.cmake @@ -0,0 +1,26 @@ +if (TCMALLOC_INCLUDE_DIR AND TCMALLOC_LIBRARIES) + # Already in cache, be silent + set(TCMALLOC_FIND_QUIETLY TRUE) +endif (TCMALLOC_INCLUDE_DIR AND TCMALLOC_LIBRARIES) + +find_path(TCMALLOC_INCLUDE_DIR NAMES google/tcmalloc.h) +find_library(TCMALLOC_LIBRARIES NAMES tcmalloc) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCMALLOC DEFAULT_MSG TCMALLOC_INCLUDE_DIR TCMALLOC_LIBRARIES) + +# Print out version number +if (TCMALLOC_FOUND) + try_run(TC_CHECK TC_CHECK_BUILD + ${LEAN_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${LEAN_SOURCE_DIR}/cmake/CheckTcmalloc.cc + CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${TCMALLOC_INCLUDE_DIR} + -DLINK_LIBRARIES=${TCMALLOC_LIBRARIES} + RUN_OUTPUT_VARIABLE TC_TRY_OUT) + message("-- Found TCMALLOC: version ${TC_TRY_OUT}") +else () + message("*** WARNING: failed to find tcmalloc") + message("*** The (optional) tcmalloc library is available at: https://code.google.com/p/gperftools") +endif () + +mark_as_advanced(TCMALLOC_INCLUDE_DIR TCMALLOC_LIBRARIES)