blob: d83be9ecfa208306228723cd3e841aea9727d6b2 [file] [log] [blame]
include(CMakeParseArguments)
# springbok_modules()
#
# A wrapper for the springbok_bytecode_module and springbok_c_module to apply common iree-compile flags
# Parameters:
# NAME: Name of target.
# SRC: Source file to compile into a bytecode module. Support relative path.
# FLAGS: Flags to pass to the translation tool (list of strings).
# C_IDENTIFIER: Identifier to use for generate c embed code.
# If omitted then no C embed code will be generated.
# RVV_OFF: Indicate RVV is OFF (default: ON)
#
# Examples:
# springbok_modules(
# NAME
# dare_devel
# SRC
# "daredevil_quant.tflite"
# C_IDENTIFIER
# "daredevil_bytecode_module_static"
# FLAGS
# "-iree-input-type=tosa"
# )
#
# springbok_modules(
# NAME
# simple_float_mul
# SRC
# "simple_float_mul.mlir"
# C_IDENTIFIER
# "simple_float_mul"
# FLAGS
# "-iree-input-type=mhlo"
# RVV_OFF
# PUBLIC
# )
#
function(springbok_modules)
cmake_parse_arguments(
_RULE
"PUBLIC;RVV_OFF"
"NAME;SRC;C_IDENTIFIER"
"FLAGS"
${ARGN}
)
if (${_RULE_RVV_OFF})
set(_RVV_OFF_ARG "RVV_OFF")
endif()
springbok_bytecode_module(
NAME
"${_RULE_NAME}_bytecode_module_static"
SRC
"${_RULE_SRC}"
C_IDENTIFIER
"${_RULE_C_IDENTIFIER}_bytecode_module_static"
FLAGS
"${_RULE_FLAGS}"
"${_RVV_OFF_ARG}"
PUBLIC
)
springbok_c_module(
NAME
"${_RULE_NAME}_c_module_static"
SRC
"${_RULE_SRC}"
FLAGS
"${_RULE_FLAGS}"
"${_RVV_OFF_ARG}"
PUBLIC
)
endfunction()