William A. Kennington III | 9b171d9 | 2021-04-16 13:29:44 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'stdplus', |
| 3 | 'cpp', |
| 4 | version: '0.1', |
William A. Kennington III | b5d1c58 | 2021-04-16 13:41:39 -0700 | [diff] [blame] | 5 | meson_version: '>=0.57.0', |
William A. Kennington III | 9b171d9 | 2021-04-16 13:29:44 -0700 | [diff] [blame] | 6 | default_options: [ |
| 7 | 'warning_level=3', |
William A. Kennington III | fd0f551 | 2021-04-16 13:43:26 -0700 | [diff] [blame] | 8 | 'cpp_std=c++20', |
William A. Kennington III | 9b171d9 | 2021-04-16 13:29:44 -0700 | [diff] [blame] | 9 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'), |
| 10 | 'examples=' + (meson.is_subproject() ? 'false' : 'true'), |
| 11 | ]) |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 12 | |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 13 | has_dl = false |
| 14 | if not get_option('dl').disabled() |
| 15 | dl_dep = meson.get_compiler('cpp').find_library('dl', required: false) |
| 16 | has_dl = meson.get_compiler('cpp').links(''' |
| 17 | #include <dlfcn.h> |
| 18 | int main() { dlopen("", 0); } |
| 19 | ''', dependencies: dl_dep) |
| 20 | endif |
| 21 | if get_option('dl').enabled() and not has_dl |
| 22 | error('libdl support required') |
| 23 | endif |
| 24 | |
| 25 | has_fd = false |
| 26 | if not get_option('fd').disabled() |
| 27 | has_fd = true |
| 28 | endif |
| 29 | |
| 30 | has_io_uring = false |
| 31 | if not get_option('io_uring').disabled() and has_fd |
| 32 | io_uring_dep = dependency('liburing', required: get_option('io_uring')) |
| 33 | if io_uring_dep.found() |
| 34 | has_io_uring = true |
| 35 | endif |
| 36 | endif |
| 37 | if get_option('io_uring').enabled() and not has_io_uring |
| 38 | error('io_uring support is required') |
| 39 | endif |
| 40 | |
| 41 | subdir('include') |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 42 | if has_dl |
| 43 | subdir('include-dl') |
| 44 | endif |
| 45 | if has_fd |
| 46 | subdir('include-fd') |
| 47 | endif |
| 48 | if has_io_uring |
| 49 | subdir('include-uring') |
| 50 | endif |
| 51 | |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 52 | subdir('src') |
| 53 | |
| 54 | build_tests = get_option('tests') |
| 55 | build_examples = get_option('examples') |
| 56 | |
| 57 | if build_examples |
| 58 | subdir('example') |
| 59 | endif |
| 60 | if not build_tests.disabled() |
| 61 | subdir('test') |
| 62 | endif |