blob: 11080b07e0eb9e03f805eebe7eae3050852c71b0 [file] [log] [blame]
William A. Kennington III97e39472019-04-03 13:22:32 -07001stdplus_headers = include_directories('.')
2
William A. Kennington IIIe0990382019-10-18 02:10:25 -07003fmt_dep = dependency('fmt', required: false)
4fmt_ext = fmt_dep
5if not fmt_dep.found()
6 fmt_proj = import('cmake').subproject(
7 'fmt',
8 cmake_options: [
9 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
10 '-DMASTER_PROJECT=OFF'
11 ],
12 required: false)
13 assert(fmt_proj.found(), 'fmtlib is required')
14 fmt_dep = fmt_proj.dependency('fmt')
15endif
16
17# span-lite might not have a pkg-config. It is header only so just make
18# sure we can access the needed symbols from the header.
19span_dep = dependency('', required: false)
20span_ext = span_dep
21has_span = meson.get_compiler('cpp').has_header_symbol(
22 'span',
23 'std::dynamic_extent',
24 dependencies: span_dep,
25 required: false)
26if not has_span
27 span_dep = dependency('span-lite', required: false)
28 span_ext = span_dep
29 has_span = meson.get_compiler('cpp').has_header_symbol(
30 'nonstd/span.hpp',
31 'nonstd::dynamic_extent',
32 dependencies: span_dep,
33 required: false)
34 if not has_span
35 span_lite_proj = import('cmake').subproject(
36 'span-lite',
37 cmake_options: [
38 ],
39 required: false)
40 if span_lite_proj.found()
41 span_dep = span_lite_proj.dependency('span-lite')
42 has_span = true
43 endif
44 endif
45endif
46
47stdplus_deps = [
48 fmt_dep,
49 span_dep,
50]
51
William A. Kennington III97e39472019-04-03 13:22:32 -070052stdplus_lib = library(
William A. Kennington III15982f62019-01-31 14:43:41 -080053 'stdplus',
54 [
55 'stdplus/signal.cpp',
56 ],
William A. Kennington III97e39472019-04-03 13:22:32 -070057 include_directories: stdplus_headers,
William A. Kennington III15982f62019-01-31 14:43:41 -080058 implicit_include_directories: false,
William A. Kennington IIIe0990382019-10-18 02:10:25 -070059 dependencies: stdplus_deps,
William A. Kennington III1937ef62019-03-28 03:24:57 -070060 version: meson.project_version(),
William A. Kennington III15982f62019-01-31 14:43:41 -080061 install: true)
62
William A. Kennington III97e39472019-04-03 13:22:32 -070063stdplus = declare_dependency(
William A. Kennington IIIe0990382019-10-18 02:10:25 -070064 dependencies: stdplus_deps,
William A. Kennington III97e39472019-04-03 13:22:32 -070065 include_directories: stdplus_headers,
66 link_with: stdplus_lib)
67
William A. Kennington III15982f62019-01-31 14:43:41 -080068import('pkgconfig').generate(
69 name: 'stdplus',
70 description: 'C++ helper utilities',
71 version: meson.project_version(),
William A. Kennington IIIe0990382019-10-18 02:10:25 -070072 libraries: stdplus,
73 requires: [fmt_ext, span_ext])
William A. Kennington III15982f62019-01-31 14:43:41 -080074
75install_headers(
William A. Kennington IIIe0990382019-10-18 02:10:25 -070076 'stdplus/raw.hpp',
William A. Kennington III15982f62019-01-31 14:43:41 -080077 'stdplus/signal.hpp',
78 subdir: 'stdplus')
William A. Kennington III7a5e2322018-11-02 17:28:35 -070079
80install_headers(
William A. Kennington IIIe847ef82018-11-02 17:29:15 -070081 'stdplus/handle/copyable.hpp',
William A. Kennington III7a5e2322018-11-02 17:28:35 -070082 'stdplus/handle/managed.hpp',
83 subdir: 'stdplus/handle')
William A. Kennington IIIbff0b0f2018-11-16 19:56:10 -080084
85install_headers(
86 'stdplus/util/cexec.hpp',
William A. Kennington III4ef36e72019-06-27 12:48:59 -070087 'stdplus/util/string.hpp',
William A. Kennington IIIbff0b0f2018-11-16 19:56:10 -080088 subdir: 'stdplus/util')