blob: 6ff400d244fe66bcb48534b8b0cf924189353612 [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',
39 'fd/impl.cpp',
40 'fd/managed.cpp',
41 'fd/mmap.cpp',
42 'fd/ops.cpp',
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070043 ]
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070044endif
45
William A. Kennington III7613a5e2022-07-13 16:25:00 -070046if has_io_uring
William A. Kennington III5c20da22021-06-18 16:44:55 -070047 stdplus_deps += [
48 io_uring_dep,
49 ]
50
51 stdplus_srcs += [
William A. Kennington III7613a5e2022-07-13 16:25:00 -070052 'io_uring.cpp',
William A. Kennington III5c20da22021-06-18 16:44:55 -070053 ]
William A. Kennington III5c20da22021-06-18 16:44:55 -070054endif
55
William A. Kennington III97e39472019-04-03 13:22:32 -070056stdplus_lib = library(
William A. Kennington III15982f62019-01-31 14:43:41 -080057 'stdplus',
William A. Kennington III45754242021-04-28 12:48:31 -070058 stdplus_srcs,
William A. Kennington III97e39472019-04-03 13:22:32 -070059 include_directories: stdplus_headers,
William A. Kennington III15982f62019-01-31 14:43:41 -080060 implicit_include_directories: false,
William A. Kennington IIIe0990382019-10-18 02:10:25 -070061 dependencies: stdplus_deps,
William A. Kennington III1937ef62019-03-28 03:24:57 -070062 version: meson.project_version(),
William A. Kennington III15982f62019-01-31 14:43:41 -080063 install: true)
64
William A. Kennington III3acf92b2021-04-16 13:33:50 -070065stdplus_dep = declare_dependency(
William A. Kennington IIIe0990382019-10-18 02:10:25 -070066 dependencies: stdplus_deps,
William A. Kennington III97e39472019-04-03 13:22:32 -070067 include_directories: stdplus_headers,
68 link_with: stdplus_lib)
69
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070070stdplus_reqs = []
71foreach dep : stdplus_deps
72 if dep.type_name() == 'pkgconfig'
William A. Kennington III285fbcb2021-01-24 18:16:20 -080073 stdplus_reqs += dep
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070074 endif
75endforeach
76
William A. Kennington III15982f62019-01-31 14:43:41 -080077import('pkgconfig').generate(
William A. Kennington III285fbcb2021-01-24 18:16:20 -080078 stdplus_lib,
William A. Kennington III15982f62019-01-31 14:43:41 -080079 description: 'C++ helper utilities',
80 version: meson.project_version(),
William A. Kennington IIIb01c5572020-06-03 19:40:49 -070081 requires: stdplus_reqs)
William A. Kennington IIId7acddd2022-07-13 16:41:11 -070082
83if 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)
92endif
93
94if 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)
103endif
104
105if 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)
114endif
William A. Kennington III953de362022-07-13 17:32:55 -0700115
116if 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)
150endif