all repos — circe-vpn @ 12ec1e49175f80aa014a42d2a7a020d62ba42af0

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
 91
 92
 93
 94
 95
 96
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