jxl_benchmark.cmake (1329B)
1 # Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 # 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 include(jxl_lists.cmake) 7 8 if(SANITIZER STREQUAL "msan") 9 message(STATUS "NOT building benchmarks under MSAN") 10 return() 11 endif() 12 13 # This is the Google benchmark project (https://github.com/google/benchmark). 14 find_package(benchmark) 15 16 if(benchmark_FOUND) 17 message(STATUS "benchmark found") 18 if(JPEGXL_STATIC AND NOT MINGW) 19 # benchmark::benchmark hardcodes the librt.so which obviously doesn't 20 # compile in static mode. 21 set_target_properties(benchmark::benchmark PROPERTIES 22 INTERFACE_LINK_LIBRARIES "Threads::Threads;-lrt") 23 endif() 24 25 list(APPEND JPEGXL_INTERNAL_TESTS 26 # TODO(eustas): Move this to tools/ 27 ../tools/gauss_blur_gbench.cc 28 ) 29 30 # Compiles all the benchmark files into a single binary. Individual benchmarks 31 # can be run with --benchmark_filter. 32 add_executable(jxl_gbench "${JPEGXL_INTERNAL_GBENCH_SOURCES}" gbench_main.cc) 33 34 target_compile_definitions(jxl_gbench PRIVATE 35 -DTEST_DATA_PATH="${JPEGXL_TEST_DATA_PATH}") 36 target_link_libraries(jxl_gbench 37 jxl_extras-internal 38 jxl-internal 39 jxl_tool 40 benchmark::benchmark 41 ) 42 else() 43 message(STATUS "benchmark NOT found") 44 endif() # benchmark_FOUND