jxl_benchmark.cmake (1134B)
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 # This is the Google benchmark project (https://github.com/google/benchmark). 9 find_package(benchmark QUIET) 10 11 if(benchmark_FOUND) 12 if(JPEGXL_STATIC AND NOT MINGW) 13 # benchmark::benchmark hardcodes the librt.so which obviously doesn't 14 # compile in static mode. 15 set_target_properties(benchmark::benchmark PROPERTIES 16 INTERFACE_LINK_LIBRARIES "Threads::Threads;-lrt") 17 endif() 18 19 list(APPEND JPEGXL_INTERNAL_TESTS 20 # TODO(eustas): Move this to tools/ 21 ../tools/gauss_blur_gbench.cc 22 ) 23 24 # Compiles all the benchmark files into a single binary. Individual benchmarks 25 # can be run with --benchmark_filter. 26 add_executable(jxl_gbench "${JPEGXL_INTERNAL_GBENCH_SOURCES}" gbench_main.cc) 27 28 target_compile_definitions(jxl_gbench PRIVATE 29 -DTEST_DATA_PATH="${JPEGXL_TEST_DATA_PATH}") 30 target_link_libraries(jxl_gbench 31 jxl_extras-internal 32 jxl-internal 33 benchmark::benchmark 34 ) 35 endif() # benchmark_FOUND