project('timdac', 'c', default_options: ['default_library=static']) o_hw = get_option('timdac_hw') o_bsp = get_option('bsp') o_bsp_dep = get_option('bsp_dep') sources = ['src/timdac.c', 'src/timdac_ll.c'] dependencies = [] defs = [] if o_hw == 'ch32v103' ch32v103_proj = subproject('ch32v10x') ch32v103_dep = ch32v103_proj.get_variable('ch32v10x_dep') dependencies += ch32v103_dep sources += ['src/timdac_hw_ch32v103.c'] endif if o_bsp != '' bsp_proj = subproject(o_bsp) bsp_dep = bsp_proj.get_variable(o_bsp_dep) dependencies += bsp_dep endif add_project_arguments(defs, language: ['c', 'cpp']) timdac_lib = library( 'timdac', sources, dependencies: dependencies, include_directories: ['inc'], ) timdac_dep = declare_dependency( compile_args: defs, include_directories: include_directories('inc'), link_with: timdac_lib, )