1project('boost', 'cpp',
2         version: '1.80.0',
3         meson_version: '>=0.56.0')
4
5cxx = meson.get_compiler('cpp')
6
7build_dir = join_paths(meson.current_source_dir(), 'build')
8r = run_command('[','!','-d', build_dir, ']', check: false)
9if r.returncode() == 0
10      r = run_command('./bootstrap.sh', '--with-libraries=coroutine', check: true)
11      r = run_command('./b2', 'install','--prefix=build', check: true)
12endif
13
14include_dir = join_paths('build', 'include')
15lib_dir = join_paths(meson.current_source_dir(), 'build', 'lib')
16
17custom_dep = declare_dependency(
18      link_args: ['-L' + lib_dir, '-Wl,-rpath-link,' + lib_dir])
19
20boost_inc = include_directories(include_dir, is_system:true)
21boost_dep = declare_dependency(
22       include_directories: boost_inc,
23       dependencies: [
24            cxx.find_library('boost_context', dirs: lib_dir, static: true),
25            cxx.find_library('boost_coroutine', dirs: lib_dir, static: true),
26            custom_dep
27      ])
28
29meson.override_dependency('boost', boost_dep)
30