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', |
| 39 | 'fd/impl.cpp', |
| 40 | 'fd/managed.cpp', |
| 41 | 'fd/mmap.cpp', |
| 42 | 'fd/ops.cpp', |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 43 | ] |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 44 | endif |
| 45 | |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 46 | if has_io_uring |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 47 | stdplus_deps += [ |
| 48 | io_uring_dep, |
| 49 | ] |
| 50 | |
| 51 | stdplus_srcs += [ |
William A. Kennington III | 7613a5e | 2022-07-13 16:25:00 -0700 | [diff] [blame] | 52 | 'io_uring.cpp', |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 53 | ] |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 54 | endif |
| 55 | |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 56 | stdplus_lib = library( |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 57 | 'stdplus', |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 58 | stdplus_srcs, |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 59 | include_directories: stdplus_headers, |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 60 | implicit_include_directories: false, |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 61 | dependencies: stdplus_deps, |
William A. Kennington III | 1937ef6 | 2019-03-28 03:24:57 -0700 | [diff] [blame] | 62 | version: meson.project_version(), |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 63 | install: true) |
| 64 | |
William A. Kennington III | 3acf92b | 2021-04-16 13:33:50 -0700 | [diff] [blame] | 65 | stdplus_dep = declare_dependency( |
William A. Kennington III | e099038 | 2019-10-18 02:10:25 -0700 | [diff] [blame] | 66 | dependencies: stdplus_deps, |
William A. Kennington III | 97e3947 | 2019-04-03 13:22:32 -0700 | [diff] [blame] | 67 | include_directories: stdplus_headers, |
| 68 | link_with: stdplus_lib) |
| 69 | |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 70 | stdplus_reqs = [] |
| 71 | foreach dep : stdplus_deps |
| 72 | if dep.type_name() == 'pkgconfig' |
William A. Kennington III | 285fbcb | 2021-01-24 18:16:20 -0800 | [diff] [blame] | 73 | stdplus_reqs += dep |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 74 | endif |
| 75 | endforeach |
| 76 | |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 77 | import('pkgconfig').generate( |
William A. Kennington III | 285fbcb | 2021-01-24 18:16:20 -0800 | [diff] [blame] | 78 | stdplus_lib, |
William A. Kennington III | 15982f6 | 2019-01-31 14:43:41 -0800 | [diff] [blame] | 79 | description: 'C++ helper utilities', |
| 80 | version: meson.project_version(), |
William A. Kennington III | b01c557 | 2020-06-03 19:40:49 -0700 | [diff] [blame] | 81 | requires: stdplus_reqs) |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 82 | |
| 83 | if has_dl |
| 84 | stdplus_dl_dep = stdplus_dep |
| 85 | |
| 86 | import('pkgconfig').generate( |
| 87 | stdplus_lib, |
| 88 | name: 'stdplus-dl', |
| 89 | description: 'C++ helper utilities', |
| 90 | version: meson.project_version(), |
| 91 | requires: stdplus_reqs) |
| 92 | endif |
| 93 | |
| 94 | if has_fd |
| 95 | stdplus_fd_dep = stdplus_dep |
| 96 | |
| 97 | import('pkgconfig').generate( |
| 98 | stdplus_lib, |
| 99 | name: 'stdplus-fd', |
| 100 | description: 'C++ helper utilities', |
| 101 | version: meson.project_version(), |
| 102 | requires: stdplus_reqs) |
| 103 | endif |
| 104 | |
| 105 | if has_io_uring |
| 106 | stdplus_io_uring_dep = stdplus_dep |
| 107 | |
| 108 | import('pkgconfig').generate( |
| 109 | stdplus_lib, |
| 110 | name: 'stdplus-io_uring', |
| 111 | description: 'C++ helper utilities', |
| 112 | version: meson.project_version(), |
| 113 | requires: stdplus_reqs) |
| 114 | endif |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame^] | 115 | |
| 116 | if has_gtest |
| 117 | stdplus_gtest_deps = [ |
| 118 | fmt_dep, |
| 119 | gtest_dep, |
| 120 | ] |
| 121 | |
| 122 | stdplus_gtest_pre = declare_dependency( |
| 123 | include_directories: stdplus_gtest_headers, |
| 124 | dependencies: stdplus_gtest_deps) |
| 125 | |
| 126 | stdplus_gtest_lib = library( |
| 127 | 'stdplus-gtest', |
| 128 | 'gtest/tmp.cpp', |
| 129 | dependencies: stdplus_gtest_pre, |
| 130 | implicit_include_directories: false, |
| 131 | version: meson.project_version(), |
| 132 | install: true) |
| 133 | |
| 134 | stdplus_gtest_dep = declare_dependency( |
| 135 | dependencies: stdplus_gtest_pre, |
| 136 | link_with: stdplus_gtest_lib) |
| 137 | |
| 138 | stdplus_gtest_reqs = [] |
| 139 | foreach dep : stdplus_gtest_deps |
| 140 | if dep.type_name() == 'pkgconfig' |
| 141 | stdplus_gtest_reqs += dep |
| 142 | endif |
| 143 | endforeach |
| 144 | |
| 145 | import('pkgconfig').generate( |
| 146 | stdplus_gtest_lib, |
| 147 | description: 'C++ helper utilities', |
| 148 | version: meson.project_version(), |
| 149 | requires: stdplus_gtest_reqs) |
| 150 | endif |