forked from vibe-d/vibe.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
146 lines (119 loc) · 3.99 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
project('Vibe.d', 'd',
meson_version: '>=0.40',
subproject_dir: 'lib/subprojects',
license: 'MIT',
version: '0.9.0'
)
project_soversion = '0'
project_version_suffix = '~alpha3'
project_version = meson.project_version()
project_version_full = project_version + project_version_suffix
source_root = meson.source_root()
build_root = meson.build_root()
pkgc = import('pkgconfig')
#
# Dependencies
#
zlib_dep = dependency('zlib')
crypto_dep = dependency('libcrypto')
ssl_dep = dependency('libssl')
libevent_dep = dependency('libevent')
#
# Compiler flags
#
flag_new_openssl_ldc = []
flag_new_openssl_dmd = []
if ssl_dep.version().version_compare('>=1.1')
flag_new_openssl_ldc = '-d-version=VibeUseOpenSSL11'
flag_new_openssl_dmd = '-version=VibeUseOpenSSL11'
endif
if meson.get_compiler('d').get_id() == 'llvm'
add_global_arguments(['-d-version=VibeLibeventDriver',
'-d-version=Have_openssl',
'-d-version=Have_diet_ng',
'-d-version=Have_stdx_allocator',
flag_new_openssl_ldc], language : 'd')
endif
if meson.get_compiler('d').get_id() == 'dmd'
add_global_arguments(['-version=VibeLibeventDriver',
'-version=Have_openssl',
'-version=Have_diet_ng',
'-version=Have_stdx_allocator',
flag_new_openssl_dmd], language : 'd')
endif
if meson.get_compiler('d').get_id() == 'gnu'
error('Vibe.d can not be compiled with GDC at time (2016). Sorry.')
endif
#
# D dependencies
#
# we need to search for this dependency after setting global compiler flags, because
# it may pull in a subproject after which setting global flags is not allowed anymore
diet_dep = dependency('diet', fallback: ['diet', 'diet_dep'])
allocator_dep = dependency('stdx-allocator', fallback: ['stdx-allocator', 'allocator_dep'])
# directory where the external dependencies are included from.
# Meson will search for this dir in both build_root and source_root
subproject_dir = 'lib/subprojects'
# Try to find system OpenSSL bindings, if not found, download
# a Git copy.
openssl_src_dir = ''
if run_command('[', '-d', '/usr/include/d/common/deimos/openssl/', ']').returncode() == 0
openssl_src_dir = '/usr/include/d/common'
else
openssl_src_dir = subproject_dir + '/openssl'
if run_command('[', '-d', openssl_src_dir, ']').returncode() != 0
message('Fetching OpenSSL D bindings from Github...')
git_get_requests = run_command(['git', 'clone', 'https://github.com/s-ludwig/openssl.git', openssl_src_dir])
if git_get_requests.returncode() != 0
error('Unable to fetch OpenSSL bindings.\n' + git_get_requests.stderr())
endif
endif
message('Using non-system OpenSSL D bindings.')
endif
openssl_inc = include_directories(openssl_src_dir)
# Try to find system LibEvent bindings, if not found, download
# a Git copy.
libevent_src_dir = ''
if run_command('[', '-d', '/usr/include/d/common/deimos/event2/', ']').returncode() == 0
libevent_src_dir = '/usr/include/d/common'
else
libevent_src_dir = subproject_dir + '/libevent'
if run_command('[', '-d', libevent_src_dir, ']').returncode() != 0
message('Fetching LibEvent bindings from Github...')
git_get_requests = run_command(['git', 'clone', 'https://github.com/s-ludwig/libevent.git', libevent_src_dir])
if git_get_requests.returncode() != 0
error('Unable to fetch LibEvent bindings.\n' + git_get_requests.stderr())
endif
endif
message('Using non-system LibEvent D bindings.')
endif
libevent_inc = include_directories(libevent_src_dir)
#
# Modules
#
# Utils
subdir('utils/')
# Data
subdir('data/')
# Core
subdir('core/')
# Crypto
subdir('crypto/')
# Stream
subdir('stream/')
# TextFilter
subdir('textfilter/')
# INet
subdir('inet/')
# TLS
subdir('tls/')
# HTTP
subdir('http/')
# Mail
subdir('mail/')
# MongoDB
subdir('mongodb/')
# Redis
subdir('redis/')
# Web
subdir('web/')