summaryrefslogtreecommitdiff
path: root/meson.build
blob: abb8e5129b3d757c83f85c83b0681ec5b3bdda21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
project('gssdp', 'c', version: '1.6.2', meson_version : '>= 0.54.0')
gnome = import('gnome')
pkg = import('pkgconfig')

cc = meson.get_compiler('c')

conf = configuration_data()
conf.set_quoted('VERSION', meson.project_version())

GSSDP_API_VERSION='1.6'
GSSDP_API_NAME='gssdp-@0@'.format(GSSDP_API_VERSION)

# Check for struct in_pktinfo
pktinfo_test = '''#define _GNU_SOURCE
#ifdef __APPLE__
#define __APPLE_USE_RFC_3542
#endif
#include <netinet/ip.h>
struct in_pktinfo pktinfo;
struct in6_pktinfo pktinfo6;
'''

pktinfo_available = cc.compiles(pktinfo_test,
                                name : 'struct in_pktinfo is available')
conf.set('HAVE_PKTINFO', pktinfo_available)

# Check for if_nametoindex
ifnametoindex_available = cc.has_function(
    'if_nametoindex',
    prefix : '#include <net/if.h>'
)
conf.set('HAVE_IFNAMETOINDEX', ifnametoindex_available)

# Check for SIOCGIFINDEX
siocgifindex_test = '''#include <sys/ioctl.h>
static const int foo = SIOCGIFINDEX;
'''
siocgifindex_available = cc.compiles(siocgifindex_test,
                                     name : 'SIOCGIFINDEX is available')
conf.set('HAVE_SIOCGIFINDEX', siocgifindex_available)

getipnettable2_available = cc.compiles(files('build-aux/getipnettable2-test.c'), args: '-liphlpapi', name: 'GetIpNetTable2 is available')
conf.set('HAVE_GETIPNETTABLE2', getipnettable2_available)

glib_version = '2.70'
conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_@0@'.format(glib_version.underscorify()))
conf.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_@0@'.format(glib_version.underscorify()))



# Generate config.h, so all config has to be set up until here
subdir('internal')

system_deps = []

# Check whether we are compiling against Android libc
bionic_test = '''#include <sys/cdefs.h>
#if !defined(__BIONIC__)
  #error "Not compiling against Android libc"
#endif'''
bionic_available = cc.compiles(bionic_test, name : 'android libc')
if bionic_available
  system_deps += cc.find_library('log', required: true)
endif

# Check whether we are compiling on/against windows
if host_machine.system() == 'windows'
  system_deps += cc.find_library('ws2_32', required: true)
  system_deps += cc.find_library('iphlpapi', required: true)
endif

# Assume "other" unix or linux then
generic_unix = not bionic_available and host_machine.system() != 'windows'

dependencies = [
    dependency('glib-2.0', version : '>= ' + glib_version),
    dependency('gobject-2.0', version : '>= ' + glib_version),
    dependency('gio-2.0', version : '>= ' + glib_version),
    dependency('libsoup-3.0', version : '>= 2.99.0')
]

subdir('libgssdp')
subdir('tests')

if get_option('sniffer')
  gtk = dependency('gtk4', version : '>= 4')
  subdir('tools')
endif

if get_option('vapi') and get_option('introspection')
  subdir('vala')
endif


gidocgen_dep = dependency('gi-docgen', version: '>= 2021.1',
                          fallback: ['gi-docgen', 'dummy_dep'],
                          native: true,
                          required: get_option('gtk_doc') and get_option('introspection')
                      )

subdir('doc')

if get_option('examples')
  subdir('examples')
endif

if not meson.is_subproject()
  meson.add_dist_script('build-aux/dist-docs.py')
endif

summary({'Version': meson.project_version(),
        'Library version': version,
        'Darwin version': darwin_versions},
        section: 'Versioning')