-
Notifications
You must be signed in to change notification settings - Fork 6
/
meson.build
117 lines (102 loc) · 3.08 KB
/
meson.build
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
117
# Project definition
project('rawrtcdc', 'c',
version: '0.1.4',
default_options: ['c_std=c99'],
meson_version: '>=0.46.0')
# Set compiler warning flags
compiler = meson.get_compiler('c')
compiler_args = compiler.get_supported_arguments([
'-Wall',
'-Wmissing-declarations',
'-Wmissing-prototypes',
'-Wstrict-prototypes',
'-Wbad-function-cast',
'-Wsign-compare',
'-Wnested-externs',
'-Wshadow',
'-Waggregate-return',
'-Wcast-align',
'-Wextra',
'-Wold-style-definition',
'-Wdeclaration-after-statement',
'-Wuninitialized',
'-Wshorten-64-to-32',
'-pedantic',
])
add_project_arguments(compiler_args, language: 'c')
# Configuration
configuration = configuration_data()
# Dependency: re
# Note: We need to force using our own fork until re has accepted all our patches
re_dep = dependency('librawrre',
version: '>=0.6.0',
fallback: ['re', 're_dep'],
required: true)
# Dependency: usrsctp
sctp_debug = get_option('debug_level') >= 7
usrsctp_dep = dependency('usrsctp',
version: ['>=0.9.5.0', '<2'],
fallback: ['usrsctp', 'usrsctp_dep'],
default_options: [
'sctp_build_programs=false',
'sctp_debug=@0@'.format(sctp_debug),
'sctp_inet=false',
'sctp_inet6=false',
],
required: true)
# Dependency: rawrtcc
rawrtcc_dep = dependency('rawrtcc',
version: '>=0.1.3',
fallback: ['rawrtcc', 'rawrtcc_dep'],
required: true)
# Dependencies list
dependencies = [
re_dep,
usrsctp_dep,
rawrtcc_dep,
]
# Feature: Hardware CRC32-C (requires SSE 4.2)
# Note: If it compiles, it only enables the check for SSE 4.2 at runtime.
code = '''
#include <stdint.h>
int main(int argc, char* argv[]) {
uint32_t eax, ecx;
eax = 1;
__asm__("cpuid" : "=c"(ecx) : "a"(eax) : "%ebx", "%edx");
return 0;
}
'''
have_cpuid = compiler.compiles(code) and host_machine.cpu() == 'x86_64'
configuration.set10('RAWRTCDC_ENABLE_SSE42_CRC32C', have_cpuid)
# Options
configuration.set10('RAWRTCDC_HAVE_SCTP_REDIRECT_TRANSPORT', get_option('sctp_redirect_transport'))
# Version
version = meson.project_version()
version_array = version.split('.')
configuration.set_quoted('RAWRTCDC_VERSION', version)
configuration.set('RAWRTCDC_VERSION_MAJOR', version_array[0])
configuration.set('RAWRTCDC_VERSION_MINOR', version_array[1])
configuration.set('RAWRTCDC_VERSION_PATCH', version_array[2])
# Set debug level
configuration.set('RAWRTC_DEBUG_LEVEL', get_option('debug_level'))
# Includes
include_dir = include_directories('include')
subdir('include')
# Sources
subdir('src')
# Build library
rawrtcdc = library(meson.project_name(), sources,
dependencies: dependencies,
include_directories: include_dir,
install: true,
version: version)
# Declare dependency
rawrtcdc_dep = declare_dependency(
include_directories: include_dir,
link_with: rawrtcdc)
# Generate pkg-config file
pkg = import('pkgconfig')
pkg.generate(rawrtcdc,
name: meson.project_name(),
description: 'A standalone WebRTC and ORTC data channel implementation.',
url: 'https://github.com/rawrtc/rawrtc-data-channel')