-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
85 lines (70 loc) · 2.17 KB
/
meson.build
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
project(
'asioloop',
'cpp',
default_options: [
'c_std=c11',
'cpp_std=c++20',
'buildtype=release',
'debug=false',
],
meson_version: '>= 1.5.0',
version: 'dev',
)
if get_option('b_coverage')
if meson.get_compiler('cpp').get_id() == 'clang'
add_project_arguments('-fprofile-instr-generate', language: 'cpp')
add_project_arguments('-fcoverage-mapping', language: 'cpp')
add_project_arguments('-fprofile-arcs', language: 'cpp')
add_global_link_arguments('-fprofile-instr-generate', language: 'c')
endif
endif
py = import('python').find_installation(pure: false)
py.install_sources(
'src/asioloop/__init__.py',
subdir: 'asioloop',
)
compiler = meson.get_compiler('cpp')
cxx_id = compiler.get_id()
nanobind_dep = dependency('nanobind', static: true)
boost_dep = [dependency('boost', version: '>=1.78', static: true)]
fmt = subproject('fmt')
os = build_machine.system()
if os == 'linux'
boost_dep += [dependency('liburing', static: true)]
add_project_arguments('-DBOOST_ASIO_HAS_IO_URING', language: 'cpp')
add_project_arguments('-DBOOST_ASIO_DISABLE_EPOLL', language: 'cpp')
endif
if os == 'windows'
add_project_arguments('-DOS_WIN32=1', language: 'cpp')
elif os == 'linux' or os == 'darwin'
add_project_arguments('-DOS_POSIX=1', language: 'cpp')
endif
# add_project_arguments('-DPY_ASIO_LOOP_CPP_DEBUG', language: 'cpp')
add_project_arguments('-DBOOST_ASIO_NO_DEPRECATED', language: 'cpp')
# add_project_arguments('-DBOOST_ASIO_HAS_CO_AWAIT', language: 'cpp')
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'cpp')
out = py.extension_module(
'__asioloop',
'src/asioloop/asioloop.cxx',
'src/asioloop/eventloop.cxx',
install: true,
subdir: 'asioloop',
dependencies: [
nanobind_dep,
fmt.get_variable('fmt_header_only_dep'),
boost_dep,
py.dependency(),
],
)
custom_target(
'copy extension back to file tree',
input: out,
output: 'copy',
depends: out,
command: [
'cp',
out.full_path(),
join_paths(meson.project_source_root(), 'src/asioloop/'),
],
build_by_default: false,
)