project('Circe', 'c', version: '0.1.0') base_incdir = include_directories('./') ## PBA-GENERATED FILES pba_generated = custom_target( 'pba-parsing', output: ['proto_circe.h', 'proto_circe.c'], input: ['core/protocol.pba'], command: [ 'dune', 'exec', '--root=@SOURCE_ROOT@/contrib/pba', '--', 'pba', '-o', '@OUTDIR@', '@INPUT@', ], ) ## TINYCRYPT tct_subproj = subproject('TinyCrypT') tct_dependency = tct_subproj.get_variable('TinyCrypT_dep') ## LIBCIRCE-COMMON common_build_args = ['-O3', '-ffreestanding', '-nostdlib', '-lgcc', '-fno-stack-protector'] common_sources = [ 'common/memory.c', ] common_target = static_library( 'circe-common', common_sources, c_args: common_build_args, include_directories: base_incdir, ) common_dep = declare_dependency(include_directories: base_incdir, link_with: common_target) set_variable(meson.project_name() + '_common_dep', common_dep) ## PQC subdir('contrib') mlkem_dependency = get_variable(meson.project_name() + '_mlkem_dep') mldsa_dependency = get_variable(meson.project_name() + '_mldsa_dep') ## LIBCIRCE-CORE core_build_args = [ '-O3', '-ffreestanding', '-nostdlib', '-lgcc', '-fno-stack-protector', ] core_sources = [ 'core/core.c', pba_generated, ] core_target = static_library( 'circe-core', core_sources, c_args: core_build_args, include_directories: base_incdir, dependencies: [common_dep, tct_dependency, mlkem_dependency, mldsa_dependency], ) core_dep = declare_dependency(include_directories: base_incdir, link_with: core_target) set_variable(meson.project_name() + '_core_dep', core_dep) ## UNITY TESTS unity_proj = subproject('Unity') unity_dep = unity_proj.get_variable('unity_dep') runner_gen = unity_proj.get_variable('gen_test_runner') if not meson.is_subproject() and meson.can_run_host_binaries() example_test = meson.project_source_root() / 'test/test_example.c' example_test_runner = runner_gen.process(example_test) test( 'example_tests', executable( 'example_tests', [example_test_runner, example_test], include_directories: [], link_with: [], dependencies: unity_dep, install: false, ), ) endif