set(IMC_BENCH_NAME "vAes" CACHE STRING "")
set(IMC_BENCH_INFINITE_LOOP 0 CACHE BOOL "")
set(IMC_PRINT_RECOVERY_MESSAGE 0 CACHE BOOL "")

set(AVAILABLE_BENCHES "vBasicMath" "vStringSearch" "vFFT" "vSha" "vCrc" "vMatMul" "vConv2d" "adc_demo" "vAes")
if(NOT IMC_BENCH_NAME IN_LIST AVAILABLE_BENCHES)
    message( FATAL_ERROR "incorrect benchmark name: ${IMC_BENCH_NAME}")
endif()

add_compile_definitions(imcBENCH_NAME=${IMC_BENCH_NAME})
if(IMC_BENCH_INFINITE_LOOP)
    add_compile_definitions(imcBENCH_INFINITE_LOOP=1)
endif()
if(IMC_PRINT_RECOVERY_MESSAGE)
    add_compile_definitions(imcPRINT_RECOVERY_MESSAGE=1)
endif()

if(IMC_BENCH_NAME MATCHES "vConv2d")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/conv2d/conv2d.c
    )
    set(IMC_LINK_OBJS
    )
endif()

if(IMC_BENCH_NAME MATCHES "adc_demo")
    set(BENCHMARK_SRC_FILES
        Core/Src/benchmarks/adc_demo/adc_demo.c
    )
    set(IMC_APP_FILES
    )
    set(IMC_LINK_OBJS
    )
endif()

if(IMC_BENCH_NAME MATCHES "vBasicMath")
    set(BENCHMARK_SRC_FILES
        Core/Src/benchmarks/basicmath/cubic.c
        Core/Src/benchmarks/basicmath/isqrt.c
        Core/Src/benchmarks/basicmath/rad2deg.c
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/basicmath/basicmath.c
    )
    set(IMC_LINK_OBJS
    )
    include_directories(
        Core/Inc/benchmarks/basicmath
    )
endif()

if(IMC_BENCH_NAME MATCHES "vCrc")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/crc/crc_32.c
    )
    set(IMC_LINK_OBJS
        ${CMAKE_SOURCE_DIR}/Core/Src/benchmarks/crc/crc_input.o
    )
    include_directories(
        Core/Inc/benchmarks/crc
    )
endif()

if(IMC_BENCH_NAME MATCHES "vFFT")
    set(BENCHMARK_SRC_FILES
        Core/Src/benchmarks/fft/fftmisc.c
        Core/Src/benchmarks/fft/fourierf.c
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/fft/fft.c
    )
    set(IMC_LINK_OBJS
    )
    include_directories(
        Core/Inc/benchmarks/fft
    )
endif()

if(IMC_BENCH_NAME MATCHES "vSha")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/sha/sha.c
    )
    set(IMC_LINK_OBJS
        ${CMAKE_SOURCE_DIR}/Core/Src/benchmarks/sha/sha_input.o
    )
    include_directories(
        Core/Inc/benchmarks/sha
    )
endif()

if(IMC_BENCH_NAME MATCHES "vMatMul")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/matmul/matmul.c
    )
    set(IMC_LINK_OBJS
    )
endif()

if(IMC_BENCH_NAME MATCHES "vStringSearch")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/stringsearch/stringsearch_local.c
    )
    set(IMC_LINK_OBJS
    )
endif()

if(IMC_BENCH_NAME MATCHES "vAes")
    set(BENCHMARK_SRC_FILES
    )
    set(IMC_APP_FILES
        Core/Src/benchmarks/aes/aes.c
    )
    set(IMC_LINK_OBJS
    )
    include_directories(
        Core/Inc/benchmarks/aes
    )
endif()

foreach(BENCH_SRC ${BENCHMARK_SRC_FILES})
    list(APPEND SRC_FILES ${BENCH_SRC})
endforeach()