Skip to content

Commit

Permalink
Removed ENABLE_BENCHMARK dependency on ENABLE_TESTS (LLNL#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfadden8 authored and davidbeckingsale committed Mar 23, 2018
1 parent ef3847c commit dd12d36
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
4 changes: 3 additions & 1 deletion cmake/BLTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,9 @@ macro(blt_add_benchmark)
CONFIGURATIONS Benchmark
)

add_dependencies(run_benchmarks ${arg_NAME})
if(ENABLE_TESTS)
add_dependencies(run_benchmarks ${arg_NAME})
endif()
endif()

endmacro(blt_add_benchmark)
Expand Down
62 changes: 33 additions & 29 deletions thirdparty_builtin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
#
###############################################################################

set(_blt_tpl_targets) # tracks names of enabled tpl targets

if(ENABLE_TESTS)
include(CTest)

set(_blt_tpl_targets) # tracks names of enabled tpl targets

if(WIN32 AND BUILD_SHARED_LIBS)
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
list(APPEND gtest_defines "-DGTEST_LINKED_AS_SHARED_LIBRARY=1")
Expand Down Expand Up @@ -145,39 +145,43 @@ if(ENABLE_TESTS)
endif()
endif()

if(ENABLE_BENCHMARKS)
if(WIN32 AND BUILD_SHARED_LIBS)
message(FATAL_ERROR "Benchmarks cannot be built when BUILD_SHARED_LIBS=On")
endif()
endif()

## google benchmark support
add_subdirectory(gbenchmark-master-2017-05-19
${BLT_BUILD_DIR}/thirdparty_builtin/gbenchmark-master-2017-05-19)
if(ENABLE_BENCHMARKS)
if(WIN32 AND BUILD_SHARED_LIBS)
message(FATAL_ERROR "Benchmarks cannot be built when BUILD_SHARED_LIBS=On")
endif()

if (UNIX AND NOT APPLE)
find_library(RT_LIBRARIES rt)
endif()
## google benchmark support
add_subdirectory(gbenchmark-master-2017-05-19
${BLT_BUILD_DIR}/thirdparty_builtin/gbenchmark-master-2017-05-19)

blt_register_library(NAME gbenchmark
INCLUDES ${benchmark_SOURCE_DIR}/include ${benchmark_SOURCE_DIR}
LIBRARIES benchmark ${RT_LIBRARIES}
TREAT_INCLUDES_AS_SYSTEM ON
)
if (UNIX AND NOT APPLE)
find_library(RT_LIBRARIES rt)
endif()

list(APPEND _blt_tpl_targets benchmark)
blt_register_library(NAME gbenchmark
INCLUDES ${benchmark_SOURCE_DIR}/include ${benchmark_SOURCE_DIR}
LIBRARIES benchmark ${RT_LIBRARIES}
TREAT_INCLUDES_AS_SYSTEM ON
)

# This sets up a target to run the benchmarks
add_custom_target(run_benchmarks
COMMAND ctest -C Benchmark -VV -R benchmark
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endif()
list(APPEND _blt_tpl_targets benchmark)

# Set the folder property of the blt thirdparty libraries
if(ENABLE_FOLDERS)
foreach(tpl ${_blt_tpl_targets})
blt_set_target_folder(TARGET ${tpl} FOLDER blt/thirdparty)
endforeach()
if(ENABLE_TESTS)
# This sets up a target to run the benchmarks
add_custom_target(run_benchmarks
COMMAND ctest -C Benchmark -VV -R benchmark
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endif()
endif()

# Set the folder property of the blt thirdparty libraries
if(ENABLE_FOLDERS)
foreach(tpl ${_blt_tpl_targets})
blt_set_target_folder(TARGET ${tpl} FOLDER blt/thirdparty)
endforeach()
endif()


0 comments on commit dd12d36

Please sign in to comment.