all repos — circe-vpn @ 7105ecea863e8330ab95c89a34f2e96e71c90f41

Circe VPN

meson.build (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
project('Circe', 'c', version: '0.1.0')

## 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/cbor.c',
    'common/memory.c',
]

common_incdir = include_directories('common/')

common_target = static_library(
    'circe-common',
    common_sources,
    c_args: common_build_args,
    include_directories: common_incdir,
)

common_dep = declare_dependency(include_directories: common_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',
]

core_incdir = include_directories('core/')

core_target = static_library(
    'circe-core',
    core_sources,
    c_args: core_build_args,
    include_directories: core_incdir,
    dependencies: [common_dep, tct_dependency, mlkem_dependency, mldsa_dependency],
)

core_dep = declare_dependency(include_directories: core_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 host_machine.system() == build_machine.system() and host_machine.cpu() == build_machine.cpu()
    # Technically every target is 'cross-compiling', but Meson fails to properly detect usually if we can still run the test binaries.
    message('Also building tests!')
    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