William A. Kennington III | 220b5da | 2019-03-29 15:30:59 -0700 | [diff] [blame] | 1 | # 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. |
| 3 | function2_dep = dependency('function2', required: false) |
| 4 | has_function2 = meson.get_compiler('cpp').has_header_symbol( |
| 5 | 'function2/function2.hpp', |
| 6 | 'fu2::unique_function', |
| 7 | dependencies: function2_dep, |
| 8 | required: false) |
| 9 | if not has_function2 |
| 10 | function2_proj = import('cmake').subproject( |
| 11 | 'function2', |
| 12 | cmake_options: [ |
William A. Kennington III | fc1722f | 2021-04-15 11:58:13 -0700 | [diff] [blame] | 13 | '-DBUILD_TESTING=OFF', |
William A. Kennington III | 220b5da | 2019-03-29 15:30:59 -0700 | [diff] [blame] | 14 | ], |
| 15 | required: false) |
| 16 | assert(function2_proj.found(), 'function2 is required') |
| 17 | if function2_proj.found() |
| 18 | function2_dep = function2_proj.dependency('function2') |
| 19 | endif |
| 20 | endif |
| 21 | |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 22 | sdeventplus_deps = [ |
William A. Kennington III | a5b752a | 2019-03-22 19:26:27 -0700 | [diff] [blame] | 23 | dependency('libsystemd', version: '>=240'), |
William A. Kennington III | fa27734 | 2020-02-20 15:16:22 -0800 | [diff] [blame] | 24 | dependency('stdplus', fallback: ['stdplus', 'stdplus']), |
William A. Kennington III | 220b5da | 2019-03-29 15:30:59 -0700 | [diff] [blame] | 25 | function2_dep, |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 26 | ] |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 27 | |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 28 | sdeventplus_headers = include_directories('.') |
| 29 | |
| 30 | sdeventplus_lib = library( |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 31 | 'sdeventplus', |
| 32 | [ |
| 33 | 'sdeventplus/clock.cpp', |
| 34 | 'sdeventplus/event.cpp', |
| 35 | 'sdeventplus/exception.cpp', |
| 36 | 'sdeventplus/internal/sdevent.cpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 37 | '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 III | 5457dae | 2019-04-03 03:06:57 -0700 | [diff] [blame] | 43 | 'sdeventplus/utility/timer.cpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 44 | ], |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 45 | include_directories: sdeventplus_headers, |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 46 | implicit_include_directories: false, |
William A. Kennington III | 2d8f8cc | 2019-03-28 03:27:50 -0700 | [diff] [blame] | 47 | version: meson.project_version(), |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 48 | dependencies: sdeventplus_deps, |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 49 | install: true) |
| 50 | |
Patrick Williams | fc18eb0 | 2021-04-15 14:55:58 -0500 | [diff] [blame] | 51 | sdeventplus_dep = declare_dependency( |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 52 | dependencies: sdeventplus_deps, |
| 53 | include_directories: sdeventplus_headers, |
| 54 | link_with: sdeventplus_lib) |
| 55 | |
William A. Kennington III | 0578472 | 2020-06-03 00:48:02 -0700 | [diff] [blame] | 56 | sdeventplus_reqs = [] |
| 57 | foreach dep : sdeventplus_deps |
| 58 | if dep.type_name() == 'pkgconfig' |
William A. Kennington III | fc1722f | 2021-04-15 11:58:13 -0700 | [diff] [blame] | 59 | sdeventplus_reqs += dep |
William A. Kennington III | 0578472 | 2020-06-03 00:48:02 -0700 | [diff] [blame] | 60 | endif |
| 61 | endforeach |
| 62 | |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 63 | import('pkgconfig').generate( |
| 64 | name: 'sdeventplus', |
| 65 | description: 'C++ systemd event wrapper', |
| 66 | version: meson.project_version(), |
Patrick Williams | fc18eb0 | 2021-04-15 14:55:58 -0500 | [diff] [blame] | 67 | libraries: sdeventplus_dep, |
William A. Kennington III | 0578472 | 2020-06-03 00:48:02 -0700 | [diff] [blame] | 68 | requires: sdeventplus_reqs) |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 69 | |
| 70 | install_headers( |
| 71 | 'sdeventplus/clock.hpp', |
| 72 | 'sdeventplus/event.hpp', |
| 73 | 'sdeventplus/exception.hpp', |
William A. Kennington III | 546fa93 | 2020-06-03 14:24:24 -0700 | [diff] [blame] | 74 | 'sdeventplus/types.hpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 75 | subdir: 'sdeventplus') |
| 76 | |
| 77 | install_headers( |
| 78 | 'sdeventplus/internal/sdevent.hpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 79 | subdir: 'sdeventplus/internal') |
| 80 | |
| 81 | install_headers( |
| 82 | 'sdeventplus/source/base.hpp', |
| 83 | 'sdeventplus/source/child.hpp', |
| 84 | 'sdeventplus/source/event.hpp', |
| 85 | 'sdeventplus/source/io.hpp', |
| 86 | 'sdeventplus/source/signal.hpp', |
| 87 | 'sdeventplus/source/time.hpp', |
| 88 | subdir: 'sdeventplus/source') |
| 89 | |
| 90 | install_headers( |
| 91 | 'sdeventplus/test/sdevent.hpp', |
| 92 | subdir: 'sdeventplus/test') |
| 93 | |
| 94 | install_headers( |
| 95 | 'sdeventplus/utility/timer.hpp', |
| 96 | subdir: 'sdeventplus/utility') |