blob: 57077eebe8438a9f4d603d0e1c245c3586b0429d [file] [log] [blame]
# Copyright 2023 Google LLC
#
# 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.
# Build libraries and unit tests for RISP4ML blocks.
# Use different source files for RVV and non-RVV versions
set(BLC_SRC "blc.c")
set(DEMOSAIC_SRC "demosaic.c")
set(DG_SRC "dg.c")
set(DOWNSCALE_SRC "downscale.c")
set(GAMMA_SRC "gamma.c")
set(WBG_SRC "wbg.c")
set(DOWNSCALE_TEST_SRC "downscale_test.cc")
set(GAMMA_TEST_SRC "gamma_test.cc")
if (${BUILD_WITH_RVV})
set(BLC_SRC "blc_rvv.c")
set(DEMOSAIC_SRC "demosaic_rvv.c")
set(DG_SRC "dg_rvv.c")
set(DOWNSCALE_SRC "downscale_rvv.c")
set(GAMMA_SRC "gamma_rvv.c")
set(WBG_SRC "wbg_rvv.c")
set(DOWNSCALE_TEST_SRC "downscale_rvv_test.cc")
set(GAMMA_TEST_SRC "gamma_rvv_test.cc")
add_definitions(-DISP_WITH_RVV)
endif()
iree_cc_library(
NAME
blc
HDRS
"blc.h"
SRCS
${BLC_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
iree_cc_library(
NAME
demosaic
HDRS
"demosaic.h"
SRCS
${DEMOSAIC_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
iree_cc_library(
NAME
dg
HDRS
"dg.h"
SRCS
${DG_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
iree_cc_library(
NAME
downscale
HDRS
"downscale.h"
SRCS
${DOWNSCALE_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
iree_cc_library(
NAME
gamma
HDRS
"gamma.h"
SRCS
${GAMMA_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
iree_cc_library(
NAME
wbg
HDRS
"wbg.h"
SRCS
${WBG_SRC}
DEPS
risp4ml::common::image
risp4ml::common::utils
)
sparrow_test(
NAME
blc_test
SRCS
"blc_test.cc"
DEPS
::blc
risp4ml::common::test_utils
pw_unit_test
pw_unit_test.main
pw_assert_basic
TESTFILES
"blc_test.run"
)
sparrow_test(
NAME
dg_test
SRCS
"dg_test.cc"
DEPS
::dg
risp4ml::common::test_utils
pw_unit_test
pw_unit_test.main
pw_assert_basic
TESTFILES
"dg_test.run"
)
sparrow_test(
NAME
wbg_test
SRCS
"wbg_test.cc"
DEPS
::wbg
pw_unit_test
pw_unit_test.main
pw_assert_basic
TESTFILES
"wbg_test.run"
"wbg_bin_test.run"
)
if (${BUILD_WITH_KELVIN})
# Kelvin-only systemc tests
add_custom_command(
TARGET
risp4ml_isp_stages_wbg_test
POST_BUILD
COMMAND
${CMAKE_OBJCOPY} -g -O binary
wbg_test
wbg_test.bin
BYPRODUCTS
wbg_test.bin
COMMENT
"Objcopy the binary file"
)
# Do not compile the following tests for Kelvin
return()
endif()
sparrow_test(
NAME
downscale_test
SRCS
${DOWNSCALE_TEST_SRC}
DEPS
::downscale
pw_unit_test
pw_unit_test.main
pw_assert_basic
TESTFILES
"downscale_test.run"
)
sparrow_test(
NAME
gamma_test
SRCS
${GAMMA_TEST_SRC}
DEPS
::gamma
pw_unit_test
pw_unit_test.main
pw_assert_basic
TESTFILES
"gamma_test.run"
)