blob: c599374861f84a554fd23706dda3a1f50c83dd04 [file] [log] [blame]
William A. Kennington III220b5da2019-03-29 15:30:59 -07001# Function2 might not have a pkg-config. It is header only so just make
2# sure we can access the needed symbols from the header.
3function2_dep = dependency('function2', required: false)
4has_function2 = meson.get_compiler('cpp').has_header_symbol(
5 'function2/function2.hpp',
6 'fu2::unique_function',
7 dependencies: function2_dep,
8 required: false)
9if not has_function2
William A. Kennington III61869e02021-04-15 12:29:56 -070010 function2_opts = import('cmake').subproject_options()
11 function2_opts.add_cmake_defines({'BUILD_TESTING': 'OFF'})
William A. Kennington III220b5da2019-03-29 15:30:59 -070012 function2_proj = import('cmake').subproject(
13 'function2',
William A. Kennington III61869e02021-04-15 12:29:56 -070014 options: function2_opts,
William A. Kennington III220b5da2019-03-29 15:30:59 -070015 required: false)
16 assert(function2_proj.found(), 'function2 is required')
17 if function2_proj.found()
18 function2_dep = function2_proj.dependency('function2')
19 endif
20endif
21
William A. Kennington III8ec59e62019-04-03 13:38:17 -070022sdeventplus_deps = [
William A. Kennington IIIa5b752a2019-03-22 19:26:27 -070023 dependency('libsystemd', version: '>=240'),
Patrick Williams02316402022-03-21 11:35:28 -050024 dependency('stdplus'),
William A. Kennington III220b5da2019-03-29 15:30:59 -070025 function2_dep,
William A. Kennington III8ec59e62019-04-03 13:38:17 -070026]
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080027
William A. Kennington III8ec59e62019-04-03 13:38:17 -070028sdeventplus_headers = include_directories('.')
29
30sdeventplus_lib = library(
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080031 'sdeventplus',
32 [
33 'sdeventplus/clock.cpp',
34 'sdeventplus/event.cpp',
35 'sdeventplus/exception.cpp',
36 'sdeventplus/internal/sdevent.cpp',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080037 'sdeventplus/source/base.cpp',
38 'sdeventplus/source/child.cpp',
39 'sdeventplus/source/event.cpp',
40 'sdeventplus/source/io.cpp',
41 'sdeventplus/source/signal.cpp',
42 'sdeventplus/source/time.cpp',
William A. Kennington III5457dae2019-04-03 03:06:57 -070043 'sdeventplus/utility/timer.cpp',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080044 ],
William A. Kennington III8ec59e62019-04-03 13:38:17 -070045 include_directories: sdeventplus_headers,
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080046 implicit_include_directories: false,
William A. Kennington III2d8f8cc2019-03-28 03:27:50 -070047 version: meson.project_version(),
William A. Kennington III8ec59e62019-04-03 13:38:17 -070048 dependencies: sdeventplus_deps,
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080049 install: true)
50
Patrick Williamsfc18eb02021-04-15 14:55:58 -050051sdeventplus_dep = declare_dependency(
William A. Kennington III8ec59e62019-04-03 13:38:17 -070052 dependencies: sdeventplus_deps,
53 include_directories: sdeventplus_headers,
54 link_with: sdeventplus_lib)
55
William A. Kennington III05784722020-06-03 00:48:02 -070056sdeventplus_reqs = []
57foreach dep : sdeventplus_deps
58 if dep.type_name() == 'pkgconfig'
William A. Kennington IIIfc1722f2021-04-15 11:58:13 -070059 sdeventplus_reqs += dep
William A. Kennington III05784722020-06-03 00:48:02 -070060 endif
61endforeach
62
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080063import('pkgconfig').generate(
William A. Kennington IIIda476cc2021-04-15 12:08:20 -070064 sdeventplus_lib,
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080065 description: 'C++ systemd event wrapper',
66 version: meson.project_version(),
William A. Kennington III05784722020-06-03 00:48:02 -070067 requires: sdeventplus_reqs)
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080068
69install_headers(
70 'sdeventplus/clock.hpp',
71 'sdeventplus/event.hpp',
72 'sdeventplus/exception.hpp',
William A. Kennington III546fa932020-06-03 14:24:24 -070073 'sdeventplus/types.hpp',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080074 subdir: 'sdeventplus')
75
76install_headers(
77 'sdeventplus/internal/sdevent.hpp',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080078 subdir: 'sdeventplus/internal')
79
80install_headers(
81 'sdeventplus/source/base.hpp',
82 'sdeventplus/source/child.hpp',
83 'sdeventplus/source/event.hpp',
84 'sdeventplus/source/io.hpp',
85 'sdeventplus/source/signal.hpp',
86 'sdeventplus/source/time.hpp',
87 subdir: 'sdeventplus/source')
88
89install_headers(
90 'sdeventplus/test/sdevent.hpp',
91 subdir: 'sdeventplus/test')
92
93install_headers(
94 'sdeventplus/utility/timer.hpp',
95 subdir: 'sdeventplus/utility')