2019-02-07 19:31:40 +00:00
|
|
|
# Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors)
|
2018-12-14 17:59:36 +00:00
|
|
|
#
|
|
|
|
# This file is part of GNSS-SDR.
|
|
|
|
#
|
|
|
|
# GNSS-SDR 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 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# GNSS-SDR 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 GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# Tries to find Gperftools.
|
|
|
|
#
|
|
|
|
# Usage of this module as follows:
|
|
|
|
#
|
|
|
|
# find_package(GPERFTOOLS)
|
|
|
|
#
|
|
|
|
# Variables used by this module, they can change the default behaviour and need
|
|
|
|
# to be set before calling find_package:
|
|
|
|
#
|
|
|
|
# GPERFTOOLS_ROOT Set this variable to the root installation of
|
|
|
|
# Gperftools if the module has problems finding
|
|
|
|
# the proper installation path.
|
|
|
|
#
|
|
|
|
# Variables defined by this module:
|
|
|
|
#
|
|
|
|
# GPERFTOOLS_FOUND System has Gperftools libs/headers
|
|
|
|
# GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
|
|
|
|
# GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
|
2019-02-07 19:31:40 +00:00
|
|
|
#
|
|
|
|
# Provides the following imported targets:
|
|
|
|
# Gperftools::tcmalloc
|
|
|
|
# Gperftools::profiler
|
|
|
|
# Gperftools::gperftools
|
|
|
|
#
|
2018-12-14 17:59:36 +00:00
|
|
|
|
2019-06-21 00:49:41 +00:00
|
|
|
if(NOT COMMAND feature_summary)
|
|
|
|
include(FeatureSummary)
|
|
|
|
endif()
|
|
|
|
|
2018-12-14 17:59:36 +00:00
|
|
|
find_library(GPERFTOOLS_TCMALLOC
|
|
|
|
NAMES tcmalloc
|
2019-10-30 20:31:41 +00:00
|
|
|
PATHS /usr/lib
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/lib64
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/local/lib64
|
|
|
|
/opt/local/lib
|
|
|
|
${Gperftools_ROOT_DIR}/lib
|
2018-12-14 17:59:36 +00:00
|
|
|
${GPERFTOOLS_ROOT}/lib
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib
|
|
|
|
${GPERFTOOLS_ROOT}/lib64
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib64
|
2019-09-30 12:58:34 +00:00
|
|
|
|
2018-12-14 17:59:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(GPERFTOOLS_PROFILER
|
|
|
|
NAMES profiler
|
2019-10-30 20:31:41 +00:00
|
|
|
PATHS /usr/lib
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/lib64
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/local/lib64
|
|
|
|
/opt/local/lib
|
|
|
|
${Gperftools_ROOT_DIR}/lib
|
2018-12-14 17:59:36 +00:00
|
|
|
${GPERFTOOLS_ROOT}/lib
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib
|
|
|
|
${GPERFTOOLS_ROOT}/lib64
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib64
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
|
|
|
|
NAMES tcmalloc_and_profiler
|
2019-10-30 20:31:41 +00:00
|
|
|
PATHS /usr/lib
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/lib64
|
|
|
|
${Gperftools_ROOT_DIR}/lib
|
2018-12-14 17:59:36 +00:00
|
|
|
${GPERFTOOLS_ROOT}/lib
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib
|
|
|
|
${GPERFTOOLS_ROOT}/lib64
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/lib64
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/local/lib
|
|
|
|
/usr/local/lib64
|
|
|
|
/opt/local/lib
|
2018-12-14 17:59:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
find_path(GPERFTOOLS_INCLUDE_DIR
|
|
|
|
NAMES gperftools/heap-profiler.h
|
2019-10-30 20:31:41 +00:00
|
|
|
PATHS /usr/include
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/local/include
|
|
|
|
/opt/local/include
|
|
|
|
${Gperftools_ROOT_DIR}/include
|
2018-12-14 17:59:36 +00:00
|
|
|
${GPERFTOOLS_ROOT}/include
|
|
|
|
$ENV{GPERFTOOLS_ROOT}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(
|
|
|
|
GPERFTOOLS
|
|
|
|
DEFAULT_MSG
|
|
|
|
GPERFTOOLS_LIBRARIES
|
|
|
|
GPERFTOOLS_INCLUDE_DIR
|
2019-02-07 19:31:40 +00:00
|
|
|
GPERFTOOLS_TCMALLOC
|
|
|
|
GPERFTOOLS_PROFILER
|
|
|
|
|
2018-12-14 17:59:36 +00:00
|
|
|
)
|
|
|
|
|
2019-02-07 19:31:40 +00:00
|
|
|
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::tcmalloc)
|
|
|
|
add_library(Gperftools::tcmalloc SHARED IMPORTED)
|
|
|
|
set_target_properties(Gperftools::tcmalloc PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
|
|
|
IMPORTED_LOCATION "${GPERFTOOLS_TCMALLOC}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
|
|
|
|
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_TCMALLOC}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::profiler)
|
|
|
|
add_library(Gperftools::profiler SHARED IMPORTED)
|
|
|
|
set_target_properties(Gperftools::profiler PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
|
|
|
IMPORTED_LOCATION "${GPERFTOOLS_PROFILER}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
|
|
|
|
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_PROFILER}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::gperftools)
|
|
|
|
add_library(Gperftools::gperftools SHARED IMPORTED)
|
|
|
|
set_target_properties(Gperftools::gperftools PROPERTIES
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
|
|
|
IMPORTED_LOCATION "${GPERFTOOLS_TCMALLOC_AND_PROFILER}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
|
|
|
|
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_TCMALLOC_AND_PROFILER}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-06-21 00:49:41 +00:00
|
|
|
set_package_properties(GPERFTOOLS PROPERTIES
|
|
|
|
URL "https://github.com/gperftools/gperftools"
|
|
|
|
DESCRIPTION "Collection of performance analysis tools"
|
|
|
|
)
|
|
|
|
|
2018-12-14 17:59:36 +00:00
|
|
|
mark_as_advanced(
|
|
|
|
GPERFTOOLS_TCMALLOC
|
|
|
|
GPERFTOOLS_PROFILER
|
|
|
|
GPERFTOOLS_TCMALLOC_AND_PROFILER
|
|
|
|
GPERFTOOLS_LIBRARIES
|
|
|
|
GPERFTOOLS_INCLUDE_DIR)
|