blob: eee7e949f7b0f6b129c856a8080cb7a0c246704c [file] [log] [blame]
include(CMakeParseArguments)
# springbok_modules()
#
# A wrapper for the springbok_bytecode_module and springbok_c_module to apply common iree-translate 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.
#
# Examples:
# springbok_modules(
# NAME
# dare_devel
# SRC
# "daredevil_quant.tflite"
# C_IDENTIFIER
# "daredevil_bytecode_module_dylib"
# 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"
# PUBLIC
# )
#
function(springbok_modules)
cmake_parse_arguments(
_RULE
"PUBLIC"
"NAME;SRC;C_IDENTIFIER"
"FLAGS"
${ARGN}
)
springbok_bytecode_module(
NAME
"${_RULE_NAME}_bytecode_module_dylib"
SRC
"${_RULE_SRC}"
C_IDENTIFIER
"${_RULE_C_IDENTIFIER}_bytecode_module_dylib"
FLAGS
"${_RULE_FLAGS}"
PUBLIC
)
springbok_c_module(
NAME
"${_RULE_NAME}_c_module_static"
SRC
"${_RULE_SRC}"
FLAGS
"${_RULE_FLAGS}"
PUBLIC
)
endfunction()