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