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. 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 10 function2_opts = import('cmake').subproject_options() 11 function2_opts.add_cmake_defines({'BUILD_TESTING': 'OFF'}) 12 function2_proj = import('cmake').subproject( 13 'function2', 14 options: function2_opts, 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 20endif 21 22sdeventplus_deps = [ 23 dependency('libsystemd', version: '>=240'), 24 dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']), 25 function2_dep, 26] 27 28sdeventplus_headers = include_directories('.') 29 30sdeventplus_lib = library( 31 'sdeventplus', 32 [ 33 'sdeventplus/clock.cpp', 34 'sdeventplus/event.cpp', 35 'sdeventplus/exception.cpp', 36 'sdeventplus/internal/sdevent.cpp', 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', 43 'sdeventplus/utility/timer.cpp', 44 ], 45 include_directories: sdeventplus_headers, 46 implicit_include_directories: false, 47 version: meson.project_version(), 48 dependencies: sdeventplus_deps, 49 install: true) 50 51sdeventplus_dep = declare_dependency( 52 dependencies: sdeventplus_deps, 53 include_directories: sdeventplus_headers, 54 link_with: sdeventplus_lib) 55 56sdeventplus_reqs = [] 57foreach dep : sdeventplus_deps 58 if dep.type_name() == 'pkgconfig' 59 sdeventplus_reqs += dep 60 endif 61endforeach 62 63import('pkgconfig').generate( 64 sdeventplus_lib, 65 description: 'C++ systemd event wrapper', 66 version: meson.project_version(), 67 requires: sdeventplus_reqs) 68 69install_headers( 70 'sdeventplus/clock.hpp', 71 'sdeventplus/event.hpp', 72 'sdeventplus/exception.hpp', 73 'sdeventplus/types.hpp', 74 subdir: 'sdeventplus') 75 76install_headers( 77 'sdeventplus/internal/sdevent.hpp', 78 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') 96