~brenns10/sc-lwt

ref: b252bc2e9267422236cfc49b366a3bf919452341 sc-lwt/meson.build -rw-r--r-- 1.4 KiB
b252bc2eStephen Brennan fix required 1 year, 23 days ago
                                                                                
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
project(
  'sc-lwt', 'c',
  version: '0.5.0',
)
cc = meson.get_compiler('c')

sources = [
  'scheduler.c',
  'timers.c',
]

inc = include_directories('include')

libsc_collections_dep = dependency(
  'sc-collections',
  fallback : ['sc-collections', 'libsc_collections_dep'],
  version: '>=0.7.0',
)
pthread_dep = cc.find_library('pthread', required : true)
ucontext_dep = cc.find_library('ucontext', required : false)

dependencies = [
  libsc_collections_dep,
  pthread_dep,
  ucontext_dep,
]

libsc_lwt = library(
  'sc-lwt',
  sources,
  include_directories : inc,
  install : true,
  dependencies : dependencies,
)

libsc_lwt_dep = declare_dependency(
  include_directories : inc,
  link_with : libsc_lwt,
)

pkg = import('pkgconfig')
pkg.generate(
  libraries: libsc_lwt,
  subdirs: 'include',
  version: meson.project_version(),
  name: 'libsc-lwt',
  filebase: 'sc-lwt',
  description: 'Lightweight threads from sc-libs',
)

simple_yielding_test = executable(
  'simple_yielding',
  ['examples/simple_yielding.c'],
  dependencies : dependencies + [libsc_lwt_dep],
)
test('simple yielding', simple_yielding_test)

poll_sleep_test = executable(
  'poll_sleep',
  ['examples/poll_sleep.c'],
  dependencies : dependencies + [libsc_lwt_dep],
)
test('poll sleep test', poll_sleep_test)

if get_option('doc')
	subdir('doc/sphinx')
else
	message('Documentation will not be built. Use -Ddoc to build it.')
endif