summaryrefslogtreecommitdiff
path: root/meson.build
blob: d23c0b4ffe31f214f19dca81e5df18c42f1ddafc (plain)
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
project('term', 'c',
  version: '0.1.0',
  license: 'MIT',
  license_files: 'LICENSE',
  meson_version: '>=1.1.0',
  default_options: [
    'c_std=c11',
    'buildtype=release',
    'optimization=3',
    'b_lto=true',
    'warning_level=3',
    'b_ndebug=if-release',
  ],
)

cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: false)
if get_option('arch_flag') != ''
  add_project_arguments(get_option('arch_flag'), language: 'c')
endif

# A host sees include/ only. The sources also find the public headers
# without the term/ prefix.
term_inc = include_directories('include')
term_private_inc = include_directories('src', 'include/term')

subdir('src')

term_dep = declare_dependency(
  include_directories: term_inc,
  link_with: term_lib.get_static_lib(),
  dependencies: m_dep,
)
meson.override_dependency('term', term_dep)

# The private headers too. Only the term tests and benchmarks use it.
term_internal_dep = declare_dependency(
  include_directories: [term_inc, term_private_inc],
  link_with: term_lib.get_static_lib(),
  dependencies: m_dep,
)

# The short forms of term.h that the term tests use. A host project can use
# them in its own tests.
term_test_dep = declare_dependency(
  include_directories: include_directories('tests/helpers'),
  dependencies: term_dep,
)
meson.override_dependency('term-test', term_test_dep)

install_headers(
  'include/term/term.h',
  'include/term/term_input.h',
  'include/term/term_types.h',
  subdir: 'term',
)

install_headers(
  'include/term/unicode/grapheme.h',
  'include/term/unicode/unicode.h',
  'include/term/unicode/unicode_data.inc',
  'include/term/unicode/utf8.h',
  'include/term/unicode/width.h',
  subdir: 'term/unicode',
)

pkg = import('pkgconfig')
pkg.generate(
  term_lib.get_shared_lib(),
  name: 'term',
  description: 'Headless terminal emulator core library',
  version: meson.project_version(),
  subdirs: ['.', 'term'],
)

if get_option('tests')
  subdir('tests')
  subdir('benchmarks')
endif