Add profiling support.

This commit is contained in:
Victor Zverovich 2013-12-21 09:36:15 -08:00
parent fbed12ac58
commit bab5e98889
2 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,8 @@ endif ()
project(FORMAT) project(FORMAT)
set(PROFILE FALSE CACHE BOOL "Enable profiling using gperftools.")
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG) check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG)
@ -64,8 +66,12 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/format-benchmark/tinyformat_test.cpp)
add_executable(tinyformat_speed_test format-benchmark/tinyformat_test.cpp) add_executable(tinyformat_speed_test format-benchmark/tinyformat_test.cpp)
target_link_libraries(tinyformat_speed_test format) target_link_libraries(tinyformat_speed_test format)
if (PROFILE)
target_link_libraries(tinyformat_speed_test profiler)
set(PROFILE_DEFS ";FMT_PROFILE")
endif ()
set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_DEFINITIONS set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_DEFINITIONS
"SPEED_TEST;HAVE_FORMAT;_SCL_SECURE_NO_WARNINGS") "SPEED_TEST;HAVE_FORMAT;_SCL_SECURE_NO_WARNINGS;${PROFILE_DEFS}")
if (HAVE_STD_CPP11_FLAG) if (HAVE_STD_CPP11_FLAG)
set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_FLAGS "-std=c++11") set_target_properties(tinyformat_speed_test PROPERTIES COMPILE_FLAGS "-std=c++11")
endif () endif ()

@ -1 +1 @@
Subproject commit bb634893e8b868d4113eeef9b5483e1ad13e1033 Subproject commit 1dcd095094a47b51845c2c435ae80b4df87f7896