# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project(cvcuda_bench)

set(bench_sources
    BenchMinMaxLoc.cpp
    BenchNMS.cpp
    BenchRemap.cpp
    BenchGaussian.cpp
    BenchLaplacian.cpp
    BenchAverageBlur.cpp
    BenchMedianBlur.cpp
    BenchBilateralFilter.cpp
    BenchSIFT.cpp
    BenchReformat.cpp
    BenchResize.cpp
    BenchFlip.cpp
    BenchRotate.cpp
    BenchPillowResize.cpp
    BenchHQResize.cpp
    BenchCenterCrop.cpp
    BenchWarpPerspective.cpp
    BenchWarpAffine.cpp
    BenchThreshold.cpp
    BenchRandomResizedCrop.cpp
    BenchNormalize.cpp
    BenchMorphology.cpp
    BenchAdaptiveThreshold.cpp
    BenchCvtColor.cpp
    BenchAdvCvtColor.cpp
    BenchBndBox.cpp
    BenchBoxBlur.cpp
    BenchBrightnessContrast.cpp
    BenchChannelReorder.cpp
    BenchColorTwist.cpp
    BenchComposite.cpp
    BenchConv2D.cpp
    BenchConvertTo.cpp
    BenchCopyMakeBorder.cpp
    BenchCropFlipNormalizeReformat.cpp
    BenchResizeCropConvertReformat.cpp
    BenchCustomCrop.cpp
    BenchErase.cpp
    BenchGammaContrast.cpp
    BenchGaussianNoise.cpp
    BenchHistogramEq.cpp
    BenchHistogram.cpp
    BenchInpaint.cpp
    BenchJointBilateralFilter.cpp
    BenchMinAreaRect.cpp
    BenchPadAndStack.cpp
    BenchOSD.cpp
    BenchLabel.cpp
    BenchPairwiseMatcher.cpp
    BenchStack.cpp
    BenchFindHomography.cpp
)

# Metatarget for all benchmarks
add_custom_target(bench_all)

foreach(bench_source IN LISTS bench_sources)
  get_filename_component(bench_file_name "${bench_source}" NAME_WLE)
  string(REPLACE "Bench" "cvcuda_bench_" algo_name ${bench_file_name})
  string(TOLOWER ${algo_name} bench_name)
  add_executable(${bench_name} "${bench_source}")
  target_link_libraries(${bench_name} PRIVATE cvcuda::nvbench::main cvcuda)
  set_target_properties(${bench_name} PROPERTIES COMPILE_FEATURES cuda_std_17)
  add_dependencies(bench_all ${bench_name})
endforeach()
