mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Imported target for GPerftools
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| # Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors) | # Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors) | ||||||
| # | # | ||||||
| # This file is part of GNSS-SDR. | # This file is part of GNSS-SDR. | ||||||
| # | # | ||||||
| @@ -33,6 +33,12 @@ | |||||||
| # GPERFTOOLS_FOUND System has Gperftools libs/headers | # GPERFTOOLS_FOUND System has Gperftools libs/headers | ||||||
| # GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler) | # GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler) | ||||||
| # GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers | # GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers | ||||||
|  | # | ||||||
|  | # Provides the following imported targets: | ||||||
|  | # Gperftools::tcmalloc | ||||||
|  | # Gperftools::profiler | ||||||
|  | # Gperftools::gperftools | ||||||
|  | # | ||||||
|  |  | ||||||
| find_library(GPERFTOOLS_TCMALLOC | find_library(GPERFTOOLS_TCMALLOC | ||||||
|   NAMES tcmalloc |   NAMES tcmalloc | ||||||
| @@ -41,6 +47,8 @@ find_library(GPERFTOOLS_TCMALLOC | |||||||
|         $ENV{GPERFTOOLS_ROOT}/lib |         $ENV{GPERFTOOLS_ROOT}/lib | ||||||
|         ${GPERFTOOLS_ROOT}/lib64 |         ${GPERFTOOLS_ROOT}/lib64 | ||||||
|         $ENV{GPERFTOOLS_ROOT}/lib64 |         $ENV{GPERFTOOLS_ROOT}/lib64 | ||||||
|  |         /usr/lib | ||||||
|  |         /usr/lib64 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| find_library(GPERFTOOLS_PROFILER | find_library(GPERFTOOLS_PROFILER | ||||||
| @@ -50,6 +58,8 @@ find_library(GPERFTOOLS_PROFILER | |||||||
|         $ENV{GPERFTOOLS_ROOT}/lib |         $ENV{GPERFTOOLS_ROOT}/lib | ||||||
|         ${GPERFTOOLS_ROOT}/lib64 |         ${GPERFTOOLS_ROOT}/lib64 | ||||||
|         $ENV{GPERFTOOLS_ROOT}/lib64 |         $ENV{GPERFTOOLS_ROOT}/lib64 | ||||||
|  |         /usr/lib | ||||||
|  |         /usr/lib64 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER | find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER | ||||||
| @@ -59,6 +69,8 @@ find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER | |||||||
|         $ENV{GPERFTOOLS_ROOT}/lib |         $ENV{GPERFTOOLS_ROOT}/lib | ||||||
|         ${GPERFTOOLS_ROOT}/lib64 |         ${GPERFTOOLS_ROOT}/lib64 | ||||||
|         $ENV{GPERFTOOLS_ROOT}/lib64 |         $ENV{GPERFTOOLS_ROOT}/lib64 | ||||||
|  |         /usr/lib | ||||||
|  |         /usr/lib64 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| find_path(GPERFTOOLS_INCLUDE_DIR | find_path(GPERFTOOLS_INCLUDE_DIR | ||||||
| @@ -66,6 +78,7 @@ find_path(GPERFTOOLS_INCLUDE_DIR | |||||||
|   HINTS ${Gperftools_ROOT_DIR}/include |   HINTS ${Gperftools_ROOT_DIR}/include | ||||||
|         ${GPERFTOOLS_ROOT}/include |         ${GPERFTOOLS_ROOT}/include | ||||||
|         $ENV{GPERFTOOLS_ROOT}/include |         $ENV{GPERFTOOLS_ROOT}/include | ||||||
|  |         /usr/include | ||||||
| ) | ) | ||||||
|  |  | ||||||
| set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER}) | set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER}) | ||||||
| @@ -76,10 +89,42 @@ find_package_handle_standard_args( | |||||||
|   DEFAULT_MSG |   DEFAULT_MSG | ||||||
|   GPERFTOOLS_LIBRARIES |   GPERFTOOLS_LIBRARIES | ||||||
|   GPERFTOOLS_INCLUDE_DIR |   GPERFTOOLS_INCLUDE_DIR | ||||||
|  |   GPERFTOOLS_TCMALLOC | ||||||
|  |   GPERFTOOLS_PROFILER | ||||||
|  |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | 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() | ||||||
|  |  | ||||||
| mark_as_advanced( | mark_as_advanced( | ||||||
|   Gperftools_ROOT_DIR |  | ||||||
|   GPERFTOOLS_TCMALLOC |   GPERFTOOLS_TCMALLOC | ||||||
|   GPERFTOOLS_PROFILER |   GPERFTOOLS_PROFILER | ||||||
|   GPERFTOOLS_TCMALLOC_AND_PROFILER |   GPERFTOOLS_TCMALLOC_AND_PROFILER | ||||||
|   | |||||||
| @@ -30,13 +30,13 @@ target_link_libraries(gnss-sdr | |||||||
|         gnss_sdr_flags |         gnss_sdr_flags | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}") | ||||||
|  |  | ||||||
| # Disable internal logging | # Disable internal logging | ||||||
| if(NOT ENABLE_LOG) | if(NOT ENABLE_LOG) | ||||||
|     target_compile_definitions(gnss-sdr PRIVATE -DGOOGLE_STRIP_LOG=1) |     target_compile_definitions(gnss-sdr PRIVATE -DGOOGLE_STRIP_LOG=1) | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}") |  | ||||||
|  |  | ||||||
| if(ENABLE_CUDA) | if(ENABLE_CUDA) | ||||||
|     target_link_libraries(gnss-sdr |     target_link_libraries(gnss-sdr | ||||||
|         PUBLIC |         PUBLIC | ||||||
| @@ -53,12 +53,8 @@ if(ENABLE_GPERFTOOLS) | |||||||
|     if(GPERFTOOLS_FOUND) |     if(GPERFTOOLS_FOUND) | ||||||
|         target_link_libraries(gnss-sdr |         target_link_libraries(gnss-sdr | ||||||
|             PUBLIC |             PUBLIC | ||||||
|                 ${GPERFTOOLS_PROFILER} |                 Gperftools::profiler | ||||||
|                 ${GPERFTOOLS_TCMALLOC} |                 Gperftools::tcmalloc | ||||||
|         ) |  | ||||||
|         target_include_directories(gnss-sdr |  | ||||||
|             PRIVATE |  | ||||||
|                 ${GPERFTOOLS_INCLUDE_DIR} |  | ||||||
|         ) |         ) | ||||||
|     endif() |     endif() | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -151,23 +151,8 @@ endif() | |||||||
|  |  | ||||||
|  |  | ||||||
| ################################################################################ | ################################################################################ | ||||||
| # Optional libraries | # Definitions | ||||||
| ################################################################################ | ################################################################################ | ||||||
| set(GNSS_SDR_TEST_OPTIONAL_LIBS "") |  | ||||||
| set(GNSS_SDR_TEST_OPTIONAL_HEADERS "") |  | ||||||
|  |  | ||||||
| if(ENABLE_CUDA) |  | ||||||
|     set(GNSS_SDR_TEST_OPTIONAL_HEADERS ${GNSS_SDR_TEST_OPTIONAL_HEADERS} ${CUDA_INCLUDE_DIRS}) |  | ||||||
|     set(GNSS_SDR_TEST_OPTIONAL_LIBS ${GNSS_SDR_TEST_OPTIONAL_LIBS} ${CUDA_LIBRARIES}) |  | ||||||
| endif() |  | ||||||
|  |  | ||||||
| if(ENABLE_GPERFTOOLS) |  | ||||||
|     if(GPERFTOOLS_FOUND) |  | ||||||
|         set(GNSS_SDR_TEST_OPTIONAL_LIBS "${GNSS_SDR_TEST_OPTIONAL_LIBS};${GPERFTOOLS_LIBRARIES}") |  | ||||||
|         set(GNSS_SDR_TEST_OPTIONAL_HEADERS "${GNSS_SDR_TEST_OPTIONAL_HEADERS};${GPERFTOOLS_INCLUDE_DIR}") |  | ||||||
|     endif() |  | ||||||
| endif() |  | ||||||
|  |  | ||||||
|  |  | ||||||
| if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13.4") | if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13.4") | ||||||
|     add_definitions(-DGR_GREATER_38=1) |     add_definitions(-DGR_GREATER_38=1) | ||||||
| @@ -348,7 +333,6 @@ endif() | |||||||
|  |  | ||||||
| set(LIST_INCLUDE_DIRS | set(LIST_INCLUDE_DIRS | ||||||
|     ${CMAKE_SOURCE_DIR}/src/tests/common-files |     ${CMAKE_SOURCE_DIR}/src/tests/common-files | ||||||
|     ${GNSS_SDR_TEST_OPTIONAL_HEADERS} |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| include_directories(${LIST_INCLUDE_DIRS}) | include_directories(${LIST_INCLUDE_DIRS}) | ||||||
| @@ -395,7 +379,6 @@ if(ENABLE_UNIT_TESTING) | |||||||
|             pvt_adapters |             pvt_adapters | ||||||
|             signal_processing_testing_lib |             signal_processing_testing_lib | ||||||
|             system_testing_lib |             system_testing_lib | ||||||
|             ${GNSS_SDR_TEST_OPTIONAL_LIBS} |  | ||||||
|     ) |     ) | ||||||
|     if(ENABLE_UNIT_TESTING_EXTRA) |     if(ENABLE_UNIT_TESTING_EXTRA) | ||||||
|         target_link_libraries(run_tests PUBLIC Gpstk::gpstk) |         target_link_libraries(run_tests PUBLIC Gpstk::gpstk) | ||||||
| @@ -410,6 +393,24 @@ if(ENABLE_UNIT_TESTING) | |||||||
|             COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:run_tests> |             COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:run_tests> | ||||||
|             ${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:run_tests>) |             ${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:run_tests>) | ||||||
|     endif() |     endif() | ||||||
|  |     if(ENABLE_GPERFTOOLS) | ||||||
|  |         if(GPERFTOOLS_FOUND) | ||||||
|  |             target_link_libraries(run_tests | ||||||
|  |                 PUBLIC | ||||||
|  |                     Gperftools::gperftools | ||||||
|  |             ) | ||||||
|  |         endif() | ||||||
|  |     endif() | ||||||
|  |     if(ENABLE_CUDA) | ||||||
|  |         target_link_libraries(run_tests | ||||||
|  |             PUBLIC | ||||||
|  |                 ${CUDA_LIBRARIES} | ||||||
|  |         ) | ||||||
|  |         target_include_directories(run_tests | ||||||
|  |             PUBLIC | ||||||
|  |                 ${CUDA_INCLUDE_DIRS} | ||||||
|  |         ) | ||||||
|  |     endif() | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(ENABLE_FPGA) | if(ENABLE_FPGA) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez