summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl_benchmark.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/jpeg-xl/lib/jxl_benchmark.cmake
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/jpeg-xl/lib/jxl_benchmark.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/third_party/jpeg-xl/lib/jxl_benchmark.cmake b/third_party/jpeg-xl/lib/jxl_benchmark.cmake
new file mode 100644
index 0000000000..10871e3073
--- /dev/null
+++ b/third_party/jpeg-xl/lib/jxl_benchmark.cmake
@@ -0,0 +1,36 @@
+# Copyright (c) the JPEG XL Project Authors. All rights reserved.
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include(jxl_lists.cmake)
+
+# benchmark.h doesn't work in our MINGW set up since it ends up including the
+# wrong stdlib header. We don't run gbench on MINGW targets anyway.
+if(NOT MINGW)
+
+# This is the Google benchmark project (https://github.com/google/benchmark).
+find_package(benchmark QUIET)
+
+if(benchmark_FOUND)
+ if(JPEGXL_STATIC AND NOT MINGW)
+ # benchmark::benchmark hardcodes the librt.so which obviously doesn't
+ # compile in static mode.
+ set_target_properties(benchmark::benchmark PROPERTIES
+ INTERFACE_LINK_LIBRARIES "Threads::Threads;-lrt")
+ endif()
+
+ # Compiles all the benchmark files into a single binary. Individual benchmarks
+ # can be run with --benchmark_filter.
+ add_executable(jxl_gbench "${JPEGXL_INTERNAL_GBENCH_SOURCES}" gbench_main.cc)
+
+ target_compile_definitions(jxl_gbench PRIVATE
+ -DTEST_DATA_PATH="${JPEGXL_TEST_DATA_PATH}")
+ target_link_libraries(jxl_gbench
+ jxl_extras-static
+ jxl-static
+ benchmark::benchmark
+ )
+endif() # benchmark_FOUND
+
+endif() # MINGW