blob: e491878d5dd21432f1eec5ee0dee6a366bbfdf57 [file] [log] [blame]
William A. Kennington IIIe0990382019-10-18 02:10:25 -07001fmt_dep = dependency('fmt', required: false)
William A. Kennington IIIe0990382019-10-18 02:10:25 -07002if not fmt_dep.found()
William A. Kennington IIIb5d1c582021-04-16 13:41:39 -07003 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 IIIe0990382019-10-18 02:10:25 -07008 fmt_proj = import('cmake').subproject(
9 'fmt',
William A. Kennington IIIb5d1c582021-04-16 13:41:39 -070010 options: fmt_opts,
William A. Kennington IIIe0990382019-10-18 02:10:25 -070011 required: false)
12 assert(fmt_proj.found(), 'fmtlib is required')
13 fmt_dep = fmt_proj.dependency('fmt')
14endif
15
William A. Kennington IIIe0990382019-10-18 02:10:25 -070016stdplus_deps = [
17 fmt_dep,
William A. Kennington IIIe0990382019-10-18 02:10:25 -070018]
19
William A. Kennington III45754242021-04-28 12:48:31 -070020stdplus_srcs = [
William A. Kennington III7613a5e2022-07-13 16:25:00 -070021 'exception.cpp',
22 'signal.cpp',
William A. Kennington III45754242021-04-28 12:48:31 -070023]
24
William A. Kennington III5a528022021-04-28 12:52:43 -070025if has_dl
26 stdplus_deps += [
27 dl_dep,
28 ]
29
30 stdplus_srcs += [
William A. Kennington III7613a5e2022-07-13 16:25:00 -070031 'dl.cpp',
William A. Kennington III5a528022021-04-28 12:52:43 -070032 ]
William A. Kennington III5a528022021-04-28 12:52:43 -070033endif
34
William A. Kennington III7613a5e2022-07-13 16:25:00 -070035if has_fd
William A. Kennington III45754242021-04-28 12:48:31 -070036 stdplus_srcs += [
William A. Kennington III7613a5e2022-07-13 16:25:00 -070037 'fd/create.cpp',
38 'fd/dupable.cpp',
William A. Kennington III4f5711c2022-08-12 17:01:53 -070039 'fd/fmt.cpp',
William A. Kennington III7613a5e2022-07-13 16:25:00 -070040 'fd/impl.cpp',
William A. Kennington III9a512c92022-08-12 15:15:55 -070041 'fd/line.cpp',
William A. Kennington III7613a5e2022-07-13 16:25:00 -070042 'fd/managed.cpp',
43 'fd/mmap.cpp',
44 'fd/ops.cpp',
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070045 ]
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070046endif
47
William A. Kennington III97e39472019-04-03 13:22:32 -070048stdplus_lib = library(
William A. Kennington III15982f62019-01-31 14:43:41 -080049 'stdplus',
William A. Kennington III45754242021-04-28 12:48:31 -070050 stdplus_srcs,
William A. Kennington III97e39472019-04-03 13:22:32 -070051 include_directories: stdplus_headers,
William A. Kennington III15982f62019-01-31 14:43:41 -080052 implicit_include_directories: false,
William A. Kennington IIIe0990382019-10-18 02:10:25 -070053 dependencies: stdplus_deps,
William A. Kennington III1937ef62019-03-28 03:24:57 -070054 version: meson.project_version(),
William A. Kennington III15982f62019-01-31 14:43:41 -080055 install: true)
56
William A. Kennington III3acf92b2021-04-16 13:33:50 -070057stdplus_dep = declare_dependency(
William A. Kennington IIIe0990382019-10-18 02:10:25 -070058 dependencies: stdplus_deps,
William A. Kennington III97e39472019-04-03 13:22:32 -070059 include_directories: stdplus_headers,
60 link_with: stdplus_lib)
61
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070062stdplus_reqs = []
63foreach dep : stdplus_deps
64 if dep.type_name() == 'pkgconfig'
William A. Kennington III285fbcb2021-01-24 18:16:20 -080065 stdplus_reqs += dep
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070066 endif
67endforeach
68
William A. Kennington III15982f62019-01-31 14:43:41 -080069import('pkgconfig').generate(
William A. Kennington III285fbcb2021-01-24 18:16:20 -080070 stdplus_lib,
William A. Kennington III15982f62019-01-31 14:43:41 -080071 description: 'C++ helper utilities',
72 version: meson.project_version(),
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070073 requires: stdplus_reqs)
William A. Kennington IIId7acddd2022-07-13 16:41:11 -070074
75if 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)
84endif
85
86if 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)
95endif
96
97if has_io_uring
William A. Kennington IIIee53ad32022-07-14 16:14:31 -070098 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 IIId7acddd2022-07-13 16:41:11 -0700126
127 import('pkgconfig').generate(
William A. Kennington IIIee53ad32022-07-14 16:14:31 -0700128 stdplus_io_uring_lib,
William A. Kennington IIId7acddd2022-07-13 16:41:11 -0700129 description: 'C++ helper utilities',
130 version: meson.project_version(),
William A. Kennington IIIee53ad32022-07-14 16:14:31 -0700131 requires: stdplus_io_uring_reqs)
William A. Kennington IIId7acddd2022-07-13 16:41:11 -0700132endif
William A. Kennington III953de362022-07-13 17:32:55 -0700133
134if 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 III2030ea52022-07-19 17:06:39 -0700168
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 III953de362022-07-13 17:32:55 -0700175endif
William A. Kennington III2030ea52022-07-19 17:06:39 -0700176
177run_with_tmp = find_program('run_with_tmp', native: true)