William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 1 | fmt_dep = dependency('fmt', required: false) |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 2 | if not fmt_dep.found() |
William A. Kennington III | b5d1c58 | 2021-04-16 13:41:39 -0700 | [diff] [blame] | 3 | fmt_opts = import('cmake').subproject_options() |
| 4 | fmt_opts.add_cmake_defines({ |
| 5 | 'CMAKE_POSITION_INDEPENDENT_CODE': 'ON', |
| 6 | 'MASTER_PROJECT': 'OFF', |
| 7 | }) |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 8 | fmt_proj = import('cmake').subproject( |
| 9 | 'fmt', |
William A. Kennington III | b5d1c58 | 2021-04-16 13:41:39 -0700 | [diff] [blame] | 10 | options: fmt_opts, |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 11 | required: false) |
| 12 | assert(fmt_proj.found(), 'fmtlib is required') |
| 13 | fmt_dep = fmt_proj.dependency('fmt') |
| 14 | endif |
| 15 | |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 16 | stdplus_deps = [ |
| 17 | fmt_dep, |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 18 | ] |
| 19 | |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 20 | stdplus_srcs = [ |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 21 | 'exception.cpp', |
| 22 | 'signal.cpp', |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 23 | ] |
| 24 | |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 25 | if has_dl |
| 26 | stdplus_deps += [ |
| 27 | dl_dep, |
| 28 | ] |
| 29 | |
| 30 | stdplus_srcs += [ |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 31 | 'dl.cpp', |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 32 | ] |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 33 | endif |
| 34 | |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 35 | if has_fd |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 36 | stdplus_srcs += [ |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 37 | 'fd/create.cpp', |
| 38 | 'fd/dupable.cpp', |
William A. Kennington III | 4f5711c | 2022-08-12 17:01:53 -0700 | [diff] [blame] | 39 | 'fd/fmt.cpp', |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 40 | 'fd/impl.cpp', |
William A. Kennington III | 9a512c9 | 2022-08-12 15:15:55 -0700 | [diff] [blame] | 41 | 'fd/line.cpp', |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 42 | 'fd/managed.cpp', |
| 43 | 'fd/mmap.cpp', |
| 44 | 'fd/ops.cpp', |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 45 | ] |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 46 | endif |
| 47 | |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 48 | stdplus_lib = library( |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 49 | 'stdplus', |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 50 | stdplus_srcs, |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 51 | include_directories: stdplus_headers, |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 52 | implicit_include_directories: false, |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 53 | dependencies: stdplus_deps, |
William A. Kennington III | 1937ef6 | 2019-03-28 03:24:57 -0700 | [diff] [blame] | 54 | version: meson.project_version(), |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 55 | install: true) |
| 56 | |
William A. Kennington III | 3acf92b | 2021-04-16 13:33:50 -0700 | [diff] [blame] | 57 | stdplus_dep = declare_dependency( |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 58 | dependencies: stdplus_deps, |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 59 | include_directories: stdplus_headers, |
| 60 | link_with: stdplus_lib) |
| 61 | |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 62 | stdplus_reqs = [] |
| 63 | foreach dep : stdplus_deps |
| 64 | if dep.type_name() == 'pkgconfig' |
William A. Kennington III | 285fbcb | 2021-01-24 18:16:20 -0800 | [diff] [blame] | 65 | stdplus_reqs += dep |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 66 | endif |
| 67 | endforeach |
| 68 | |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 69 | import('pkgconfig').generate( |
William A. Kennington III | 285fbcb | 2021-01-24 18:16:20 -0800 | [diff] [blame] | 70 | stdplus_lib, |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 71 | description: 'C++ helper utilities', |
| 72 | version: meson.project_version(), |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 73 | requires: stdplus_reqs) |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 74 | |
| 75 | if has_dl |
| 76 | stdplus_dl_dep = stdplus_dep |
| 77 | |
| 78 | import('pkgconfig').generate( |
| 79 | stdplus_lib, |
| 80 | name: 'stdplus-dl', |
| 81 | description: 'C++ helper utilities', |
| 82 | version: meson.project_version(), |
| 83 | requires: stdplus_reqs) |
| 84 | endif |
| 85 | |
| 86 | if has_fd |
| 87 | stdplus_fd_dep = stdplus_dep |
| 88 | |
| 89 | import('pkgconfig').generate( |
| 90 | stdplus_lib, |
| 91 | name: 'stdplus-fd', |
| 92 | description: 'C++ helper utilities', |
| 93 | version: meson.project_version(), |
| 94 | requires: stdplus_reqs) |
| 95 | endif |
| 96 | |
| 97 | if has_io_uring |
William A. Kennington III | ee53ad3 | 2022-07-14 16:14:31 -0700 | [diff] [blame] | 98 | stdplus_io_uring_deps = [ |
| 99 | stdplus_dep, |
| 100 | stdplus_fd_dep, |
| 101 | io_uring_dep, |
| 102 | ] |
| 103 | |
| 104 | stdplus_io_uring_pre = declare_dependency( |
| 105 | include_directories: stdplus_io_uring_headers, |
| 106 | dependencies: stdplus_io_uring_deps) |
| 107 | |
| 108 | stdplus_io_uring_lib = library( |
| 109 | 'stdplus-io_uring', |
| 110 | 'io_uring.cpp', |
| 111 | dependencies: stdplus_io_uring_pre, |
| 112 | implicit_include_directories: false, |
| 113 | version: meson.project_version(), |
| 114 | install: true) |
| 115 | |
| 116 | stdplus_io_uring_dep = declare_dependency( |
| 117 | dependencies: stdplus_io_uring_pre, |
| 118 | link_with: stdplus_io_uring_lib) |
| 119 | |
| 120 | stdplus_io_uring_reqs = [] |
| 121 | foreach dep : stdplus_io_uring_deps |
| 122 | if dep.type_name() == 'pkgconfig' |
| 123 | stdplus_io_uring_reqs += dep |
| 124 | endif |
| 125 | endforeach |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 126 | |
| 127 | import('pkgconfig').generate( |
William A. Kennington III | ee53ad3 | 2022-07-14 16:14:31 -0700 | [diff] [blame] | 128 | stdplus_io_uring_lib, |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 129 | description: 'C++ helper utilities', |
| 130 | version: meson.project_version(), |
William A. Kennington III | ee53ad3 | 2022-07-14 16:14:31 -0700 | [diff] [blame] | 131 | requires: stdplus_io_uring_reqs) |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 132 | endif |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 133 | |
| 134 | if has_gtest |
| 135 | stdplus_gtest_deps = [ |
| 136 | fmt_dep, |
| 137 | gtest_dep, |
| 138 | ] |
| 139 | |
| 140 | stdplus_gtest_pre = declare_dependency( |
| 141 | include_directories: stdplus_gtest_headers, |
| 142 | dependencies: stdplus_gtest_deps) |
| 143 | |
| 144 | stdplus_gtest_lib = library( |
| 145 | 'stdplus-gtest', |
| 146 | 'gtest/tmp.cpp', |
| 147 | dependencies: stdplus_gtest_pre, |
| 148 | implicit_include_directories: false, |
| 149 | version: meson.project_version(), |
| 150 | install: true) |
| 151 | |
| 152 | stdplus_gtest_dep = declare_dependency( |
| 153 | dependencies: stdplus_gtest_pre, |
| 154 | link_with: stdplus_gtest_lib) |
| 155 | |
| 156 | stdplus_gtest_reqs = [] |
| 157 | foreach dep : stdplus_gtest_deps |
| 158 | if dep.type_name() == 'pkgconfig' |
| 159 | stdplus_gtest_reqs += dep |
| 160 | endif |
| 161 | endforeach |
| 162 | |
| 163 | import('pkgconfig').generate( |
| 164 | stdplus_gtest_lib, |
| 165 | description: 'C++ helper utilities', |
| 166 | version: meson.project_version(), |
| 167 | requires: stdplus_gtest_reqs) |
William A. Kennington III | 2030ea5 | 2022-07-19 17:06:39 -0700 | [diff] [blame] | 168 | |
| 169 | install_data( |
| 170 | 'run_with_tmp', |
| 171 | install_mode: 'rwxr-xr-x', |
| 172 | install_dir: get_option('bindir')) |
| 173 | |
| 174 | meson.override_find_program('run_with_tmp', files('run_with_tmp')) |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 175 | endif |
William A. Kennington III | 2030ea5 | 2022-07-19 17:06:39 -0700 | [diff] [blame] | 176 | |
| 177 | run_with_tmp = find_program('run_with_tmp', native: true) |