From 0b854bc70261cccf285f5222212be0b907daa420 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Tue, 23 Jun 2015 15:18:25 -0400 Subject: [PATCH] Build with TCMalloc if available --- programs/cli_wallet/CMakeLists.txt | 13 +++++++------ programs/field_reflector/CMakeLists.txt | 5 ----- programs/js_operation_serializer/CMakeLists.txt | 5 ----- programs/witness_node/CMakeLists.txt | 11 ++++++----- tests/CMakeLists.txt | 16 +++++++++++----- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/programs/cli_wallet/CMakeLists.txt b/programs/cli_wallet/CMakeLists.txt index 0aaa8676..8eed412e 100644 --- a/programs/cli_wallet/CMakeLists.txt +++ b/programs/cli_wallet/CMakeLists.txt @@ -2,15 +2,16 @@ add_executable( cli_wallet main.cpp ) if( UNIX AND NOT APPLE ) set(rt_library rt ) endif() -#find_package( Gperftools QUIET ) -#if( GPERFTOOLS_FOUND ) -# message( STATUS "Found gperftools; compiling client with TCMalloc") -# list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -#endif() + +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling cli_wallet with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() target_link_libraries( cli_wallet PRIVATE graphene_app graphene_net graphene_chain graphene_utilities graphene_wallet fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) if(MSVC) set_source_files_properties( main.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) -endif(MSVC) \ No newline at end of file +endif(MSVC) diff --git a/programs/field_reflector/CMakeLists.txt b/programs/field_reflector/CMakeLists.txt index 129ae28d..00d78620 100644 --- a/programs/field_reflector/CMakeLists.txt +++ b/programs/field_reflector/CMakeLists.txt @@ -2,11 +2,6 @@ add_executable( field_reflector main.cpp ) if( UNIX AND NOT APPLE ) set(rt_library rt ) endif() -#find_package( Gperftools QUIET ) -#if( GPERFTOOLS_FOUND ) -# message( STATUS "Found gperftools; compiling client with TCMalloc") -# list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -#endif() target_link_libraries( field_reflector PRIVATE graphene_app graphene_net graphene_chain graphene_utilities graphene_wallet fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/programs/js_operation_serializer/CMakeLists.txt b/programs/js_operation_serializer/CMakeLists.txt index c814b53f..4815cb1d 100644 --- a/programs/js_operation_serializer/CMakeLists.txt +++ b/programs/js_operation_serializer/CMakeLists.txt @@ -2,11 +2,6 @@ add_executable( js_operation_serializer main.cpp ) if( UNIX AND NOT APPLE ) set(rt_library rt ) endif() -#find_package( Gperftools QUIET ) -#if( GPERFTOOLS_FOUND ) -# message( STATUS "Found gperftools; compiling client with TCMalloc") -# list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -#endif() target_link_libraries( js_operation_serializer PRIVATE graphene_app graphene_net graphene_chain graphene_utilities graphene_wallet fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/programs/witness_node/CMakeLists.txt b/programs/witness_node/CMakeLists.txt index 0c75e94a..386b1657 100644 --- a/programs/witness_node/CMakeLists.txt +++ b/programs/witness_node/CMakeLists.txt @@ -2,11 +2,12 @@ add_executable( witness_node main.cpp ) if( UNIX AND NOT APPLE ) set(rt_library rt ) endif() -#find_package( Gperftools QUIET ) -#if( GPERFTOOLS_FOUND ) -# message( STATUS "Found gperftools; compiling client with TCMalloc") -# list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -#endif() + +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling witness_node with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() target_link_libraries( witness_node PRIVATE graphene_app graphene_account_history graphene_witness graphene_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 468425e4..c922da15 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,21 +1,27 @@ file(GLOB COMMON_SOURCES "common/*.cpp") +find_package( Gperftools QUIET ) +if( GPERFTOOLS_FOUND ) + message( STATUS "Found gperftools; compiling tests with TCMalloc") + list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) +endif() + file(GLOB UNIT_TESTS "tests/*.cpp") add_executable( chain_test ${UNIT_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( chain_test graphene_chain graphene_app graphene_account_history fc ) +target_link_libraries( chain_test graphene_chain graphene_app graphene_account_history fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB PERFORMANCE_TESTS "performance/*.cpp") add_executable( performance_test ${PERFORMANCE_TESTS} ${COMMON_SOURCES} ) -target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history fc ) +target_link_libraries( performance_test graphene_chain graphene_app graphene_account_history fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB BENCH_MARKS "benchmarks/*.cpp") add_executable( chain_bench ${BENCH_MARKS} ${COMMON_SOURCES} ) -target_link_libraries( chain_bench graphene_chain graphene_account_history graphene_time fc ) +target_link_libraries( chain_bench graphene_chain graphene_account_history graphene_time fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB APP_SOURCES "app/*.cpp") add_executable( app_test ${APP_SOURCES} ) -target_link_libraries( app_test graphene_account_history graphene_app graphene_net graphene_chain graphene_time fc ) +target_link_libraries( app_test graphene_account_history graphene_app graphene_net graphene_chain graphene_time fc ${PLATFORM_SPECIFIC_LIBS} ) file(GLOB INTENSE_SOURCES "intense/*.cpp") add_executable( intense_test ${INTENSE_SOURCES} ${COMMON_SOURCES} ) -target_link_libraries( intense_test graphene_chain graphene_app graphene_account_history fc ) +target_link_libraries( intense_test graphene_chain graphene_app graphene_account_history fc ${PLATFORM_SPECIFIC_LIBS} )