-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
770 lines (740 loc) · 23 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
project('webcface', 'c', 'cpp',
version: '2.5.2',
license: 'MIT',
meson_version: '>=1.3.0',
default_options: [
'warning_level=3', # everythingは現在たぶん通らない
'werror=true',
# 'c_std=c99', # 指定するとlibjpegのビルドが通らない
'cpp_std=gnu++17,c++17', # spdlogがgnu++必要、webcfaceは17以上必須
'default_library=shared',
# options for subproject in subproject
'libjpeg-turbo:default_library=static',
'libjpeg-turbo:jpeg-turbo=disabled',
'libjpeg-turbo:tests=disabled',
'libjpeg-turbo:warning_level=0',
'libjpeg-turbo:werror=false',
'zlib:default_library=static',
'zlib:tests=disabled',
'zlib:warning_level=0',
'zlib:werror=false',
'spng:default_library=static',
'spng:warning_level=0',
'spng:werror=false',
'spng:build_examples=false',
'libwebp:default_library=static',
'libwebp:cwebp=disabled',
'libwebp:dwebp=disabled',
'libwebp:webpinfo=disabled',
'libwebp:webpmux=disabled',
'libwebp:warning_level=0',
'libwebp:werror=false',
'glib:default_library=static',
'glib:warning_level=0',
'glib:werror=false',
'glib:xattr=false',
'glib:selinux=disabled',
'glib:libmount=disabled',
'glib:man-pages=disabled',
'glib:dtrace=disabled',
'glib:systemtap=disabled',
'glib:sysprof=disabled',
'glib:tests=false',
'glib:nls=disabled',
'glib:glib_debug=disabled',
'glib:glib_assert=false',
'glib:glib_checks=false',
'glib:libelf=disabled',
'glib:introspection=disabled',
'expat:default_library=static',
'expat:warning_level=0',
'expat:werror=false',
'pcre2:default_library=static',
'pcre2:warning_level=0',
'pcre2:werror=false',
'proxy-libintl:default_library=static',
'proxy-libintl:warning_level=0',
'proxy-libintl:werror=false',
'libffi:default_library=static',
'libffi:warning_level=0',
'libffi:werror=false',
],
)
fs = import('fs')
cmake = import('cmake')
cxx = meson.get_compiler('cpp')
py = find_program('python3')
webcface_abi_major = '21' # ABIの破壊的変更で1増やす
webcface_abi_minor = '0' # ABIの追加で1増やす
webcface_webui_version = '1.11.0'
webcface_description = 'Web-based Communication Framework'
webcface_contact = '[email protected]'
webcface_url = 'https://github.com/na-trium-144/webcface'
webcface_version_str = meson.project_version()
if get_option('version_suffix') == 'git'
git = find_program('git', required: false)
if git.found()
git_describe = run_command(git, 'describe', '--tags', check: false)
if git_describe.returncode() == 0
webcface_version_str = git_describe.stdout().strip('v').strip()
else
warning('Failed to get version from git describe:\n' + git_describe.stderr())
endif
endif
elif get_option('version_suffix') != ''
webcface_version_str = meson.project_version() + '-' + get_option('version_suffix')
endif
summary('Version', webcface_version_str)
summary('ABI Version', webcface_abi_major + '.' + webcface_abi_minor)
assert(
get_option('default_library') == 'shared' or get_option('default_library') == 'static',
'building both shared and static webcface libraries is currently not supported',
)
summary('Library', get_option('default_library'))
conf_data = configuration_data({
'WEBCFACE_VERSION_MAJOR': meson.project_version().split('.')[0],
'WEBCFACE_VERSION_MINOR': meson.project_version().split('.')[1],
'WEBCFACE_VERSION_REVISION': meson.project_version().split('.')[2],
'WEBCFACE_VERSION': '"' + webcface_version_str + '"',
'WEBCFACE_ABI_MAJOR': webcface_abi_major,
'WEBCFACE_PTR_SIZE': cxx.sizeof('void*'),
})
conf_data.set10('WEBCFACE_SHARED', get_option('default_library') == 'shared')
webcface_system_visibility = false
webcface_system_dllexport = false
webcface_system_exclude_libs = false
webcface_system_hidden_l = false
webcface_system_wchar_windows = false
webcface_system_win32socket = false
webcface_system_path_windows = false
webcface_system_add_debug = false
webcface_system_version_rc = false
relative_rpath = ''
if host_machine.system() == 'linux'
summary('System', 'linux')
webcface_system_visibility = true
webcface_system_exclude_libs = true
relative_rpath = '$ORIGIN' / '..' / get_option('libdir')
elif host_machine.system() == 'darwin'
summary('System', 'darwin')
webcface_system_visibility = true
webcface_system_hidden_l = true
relative_rpath = '@loader_path' / '..' / get_option('libdir')
elif host_machine.system() == 'windows'
webcface_system_dllexport = true
webcface_system_wchar_windows = true
webcface_system_win32socket = true
webcface_system_path_windows = true
webcface_system_version_rc = true
if cxx.get_argument_syntax() == 'msvc'
summary('System', 'windows msvc ' + host_machine.cpu_family())
webcface_system_add_debug = true
else
summary('System', 'windows mingw')
endif
elif host_machine.system() == 'cygwin'
summary('System', 'cygwin')
if get_option('buildtype') == 'debug'
add_project_arguments('-Wa,-mbig-obj', language: ['cpp'])
endif
webcface_system_dllexport = true
webcface_system_wchar_windows = true
webcface_system_version_rc = true
else
warning('unsupported system: ' + host_machine.system())
endif
webcface_lib_name_release = 'webcface'
webcface_lib_name_debug = 'webcface' + (webcface_system_add_debug ? 'd' : '')
summary('Build type', get_option('buildtype'))
if webcface_system_add_debug
debug_crt = get_option('b_vscrt') == 'mtd' or get_option('b_vscrt') == 'mdd' or \
(get_option('b_vscrt').endswith('from_buildtype') and get_option('buildtype') == 'debug')
if debug_crt
webcface_lib_name = webcface_lib_name_debug
else
webcface_lib_name = webcface_lib_name_release
endif
summary('Debug CRT', debug_crt, bool_yn: true)
else
webcface_lib_name = webcface_lib_name_release
endif
if cxx.get_id() == 'gcc' and cxx.get_argument_syntax() != 'msvc'
warning_options = declare_dependency(
compile_args: cxx.get_supported_arguments(
'-Wno-inline',
'-Wno-attributes',
'-Wno-error=psabi', # refer to PR#9
# crow
'-Wno-error=type-limits',
# inside fmt (fmtlib/fmt#3354)
'-Wno-error=array-bounds',
'-Wno-error=stringop-overflow',
# (fmtlib/fmt#3415)
'-Wno-error=dangling-reference',
# inside opencv
'-Wno-error=deprecated-enum-enum-conversion',
# inside msgpack
'-Wno-error=maybe-uninitialized',
)
)
elif cxx.get_id() == 'clang' and cxx.get_argument_syntax() != 'msvc'
warning_options = declare_dependency(compile_args: [
'-Wno-inline',
'--system-header-prefix=msgpack.hpp',
'--system-header-prefix=spdlog/',
'--system-header-prefix=curl/',
'--system-header-prefix=crow.h',
'--system-header-prefix=vips/',
'--system-header-prefix=opencv2/',
'--system-header-prefix=utf8.h',
'--system-header-prefix=CLI/',
])
elif cxx.get_argument_syntax() == 'msvc'
warning_options = declare_dependency(compile_args: [
'/wd4251',
'/wd4275',
'/wd4661',
'/wd4706', # external:anglebracketしているのにvipsのヘッダーから出る
'/external:anglebrackets',
'/external:W0',
'/utf-8',
'/D_CRT_SECURE_NO_WARNINGS',
])
else
warning('Unsupported compiler id \'' + cxx.get_id() + '\', ' + \
'compiler argument syntax \'' + cxx.get_argument_syntax() + '\'',
)
warning_options = []
endif
conf_data.set10('WEBCFACE_SYSTEM_VISIBILITY', webcface_system_visibility)
conf_data.set10('WEBCFACE_SYSTEM_DLLEXPORT', webcface_system_dllexport)
conf_data.set10('WEBCFACE_SYSTEM_WCHAR_WINDOWS', webcface_system_wchar_windows)
conf_data.set10('WEBCFACE_SYSTEM_WIN32SOCKET', webcface_system_win32socket)
conf_data.set10('WEBCFACE_SYSTEM_PATH_WINDOWS', webcface_system_path_windows)
conf_data.set10('WEBCFACE_SYSTEM_ADD_DEBUG', webcface_system_add_debug)
filesystem_dep = disabler()
webcface_exp_filesystem = false
filesystem_check_src = '''
#if defined(CXX17_FILESYSTEM)
#include <filesystem>
namespace std_fs = std::filesystem;
#elif defined(CXX11_EXP_FILESYSTEM)
#include <experimental/filesystem>
namespace std_fs = std::experimental::filesystem;
#endif
int main(void) {
return std_fs::exists(std_fs::path("/")), 0;
}
'''
if not meson.can_run_host_binaries()
cxx17_filesystem_compiles = cxx.compiles(filesystem_check_src,
args: ['-DCXX17_FILESYSTEM'],
name: 'cxx17_filesystem',
)
if cxx17_filesystem_compiles
filesystem_dep = declare_dependency()
summary('filesystem', 'C++17')
summary('libstdc++fs', 'skipped while cross compiling')
endif
else
cxx17_filesystem_ret = cxx.run(filesystem_check_src,
args: ['-DCXX17_FILESYSTEM'],
name: 'cxx17_filesystem',
)
if cxx17_filesystem_ret.compiled() and cxx17_filesystem_ret.returncode() == 0
filesystem_dep = declare_dependency()
summary('filesystem', 'C++17')
summary('libstdc++fs', false, bool_yn: true)
else
libfs = cxx.find_library('stdc++fs', required: false)
if libfs.found()
cxx17_filesystem_libfs_ret = cxx.run(filesystem_check_src,
args: ['-DCXX17_FILESYSTEM'],
name: 'cxx17_filesystem_libfs',
dependencies: [libfs],
)
if cxx17_filesystem_libfs_ret.compiled() and cxx17_filesystem_libfs_ret.returncode() == 0
filesystem_dep = libfs
summary('filesystem', 'C++17')
summary('libstdc++fs', true, bool_yn: true)
endif
endif
endif
endif
if is_disabler(filesystem_dep)
if not meson.can_run_host_binaries()
cxx11_exp_filesystem_compiles = cxx.compiles(filesystem_check_src,
args: ['-DCXX11_EXP_FILESYSTEM'],
name: 'cxx11_exp_filesystem',
)
if cxx11_exp_filesystem_compiles
filesystem_dep = declare_dependency()
webcface_exp_filesystem = true
summary('filesystem', 'experimental')
summary('libstdc++fs', 'skipped while cross compiling')
endif
else
cxx11_exp_filesystem_ret = cxx.run(filesystem_check_src,
args: ['-DCXX11_EXP_FILESYSTEM'],
name: 'cxx11_exp_filesystem',
)
if cxx11_exp_filesystem_ret.compiled() and cxx11_exp_filesystem_ret.returncode() == 0
filesystem_dep = declare_dependency()
webcface_exp_filesystem = true
summary('filesystem', 'experimental')
summary('libstdc++fs', false, bool_yn: true)
else
libfs = cxx.find_library('stdc++fs', required: false)
if libfs.found()
cxx11_exp_filesystem_libfs_ret = cxx.run(filesystem_check_src,
args: ['-DCXX11_EXP_FILESYSTEM'],
name: 'cxx11_exp_filesystem_libfs',
dependencies: [libfs],
)
if cxx11_exp_filesystem_libfs_ret.compiled() and cxx11_exp_filesystem_libfs_ret.returncode() == 0
filesystem_dep = libfs
webcface_exp_filesystem = true
summary('filesystem', 'experimental')
summary('libstdc++fs', true, bool_yn: true)
endif
endif
endif
endif
endif
if is_disabler(filesystem_dep)
error('Neither std::filesystem or std::experimental::filesystem available')
endif
conf_data.set10('WEBCFACE_EXP_FILESYSTEM', webcface_exp_filesystem)
m_dep = cxx.find_library('m', required: false)
summary('libm', m_dep.found(), bool_yn: true)
if webcface_system_path_windows
win32folders_dep = cxx.find_library('uuid')
else
win32folders_dep = []
endif
if webcface_system_win32socket
win32socket_deps = [
cxx.find_library('iphlpapi'),
cxx.find_library('ws2_32'),
cxx.find_library('wsock32'), # asioの依存ライブラリなのでasioに追加されているべきでは?
]
else
win32socket_deps = []
endif
configure_file(
input: 'scripts' / 'config.h.in',
output: 'webcface-config.h',
configuration: conf_data,
install: true,
install_dir: get_option('includedir') / 'webcface' / 'common',
)
webcface_config_inc = include_directories('.')
webcface_config_dep = declare_dependency(
include_directories: [webcface_config_inc],
compile_args: [
'-DWEBCFACE_MESON',
],
)
version_rc_in = meson.project_source_root() / 'scripts' / 'version.rc.in'
if get_option('download_webui').allowed()
download_webui = run_command(py,
meson.project_source_root() / 'scripts' / 'fetch_webui.py',
webcface_webui_version,
meson.current_build_dir(),
check: get_option('download_webui').enabled(),
)
if download_webui.returncode() == 0
message(download_webui.stdout())
summary('WebUI',
[true, webcface_webui_version, 'Downloaded to ' + (meson.current_build_dir() / 'dist')],
bool_yn: true,
list_sep: ' ',
)
install_subdir(meson.current_build_dir() / 'dist',
install_dir: get_option('datadir') / 'webcface',
)
else
warning(download_webui.stderr())
summary('WebUI',
[false, webcface_webui_version, 'Failed to download'],
bool_yn: true,
list_sep: ' ',
)
endif
else
summary('WebUI', false, bool_yn: true)
endif
build_server = get_option('server').enabled() \
or (get_option('server').allowed() \
and not meson.is_subproject() \
and host_machine.system() != 'cygwin' \
)
build_examples = get_option('examples').enabled() \
or (get_option('examples').allowed() and not meson.is_subproject())
build_cv_examples = get_option('cv_examples').enabled() \
or (get_option('cv_examples').allowed() and not meson.is_subproject())
build_tests = get_option('tests').enabled() \
or (get_option('tests').allowed() and not meson.is_subproject())
msgpack_cxx_dep = dependency('msgpack-cxx',
default_options: [
'boost=disabled',
'tests=disabled',
'std_variant=false', # msvcでなんかエラーになる
],
)
spdlog_dep = dependency('spdlog',
default_options: [
'tests=disabled',
'compile_library=true',
'default_library=static',
'external_fmt=disabled',
'std_format=disabled',
],
)
utf8cpp_dep = dependency('utf8cpp')
# curlはvisibilityがhiddenになっている
curl_dep = dependency('libcurl',
default_options: [
'warning_level=0',
'werror=false',
'websockets=enabled',
'default_library=static',
'tool=disabled',
'tests=disabled',
'unittests=disabled',
'bindlocal=disabled',
'brotli=disabled',
'doh=disabled',
'form-api=disabled',
'getoptions=disabled',
'gsasl=disabled',
'http2=disabled',
'ipv6=disabled',
'libcurl-option=disabled',
'libz=disabled',
'netrc=disabled',
'parsedate=disabled',
'progress-meter=disabled',
'psl=disabled',
'sspi=disabled',
'zstd=disabled',
'gss-api=disabled',
'idn=disabled',
'ntlm=disabled',
'ssh=disabled',
'ssl=disabled',
'tls-srp=disabled',
'openssl=disabled',
'schannel=disabled',
'secure-transport=disabled',
'dict=disabled',
'file=disabled',
'ftp=disabled',
'gopher=disabled',
'imap=disabled',
'ldap=disabled',
'ldaps=disabled',
'mqtt=disabled',
'pop3=disabled',
'rtmp=disabled',
'rtsp=disabled',
'smb=disabled',
'smtp=disabled',
'telnet=disabled',
'tftp=disabled',
],
)
if curl_dep.type_name() != 'internal'
curl_has_ws_support = cxx.run('''
#include <curl/curl.h>
#include <cassert>
#include <cstddef>
int main() {
CURL *curl = curl_easy_init();
std::size_t s;
assert(curl_ws_send(curl, nullptr, 0, &s, 0, 0) != CURLE_NOT_BUILT_IN);
}
''',
dependencies: [curl_dep],
name: 'curl_has_ws_support',
)
if not curl_has_ws_support.compiled() or curl_has_ws_support.returncode() != 0
error('The installed curl has no websocket support, so WebCFace cannot use it.\n' + \
'Set "--force-fallback-for=libcurl".',
)
endif
endif
if build_server
cli11_dep = dependency('cli11', 'CLI11')
crow_dep = dependency('Crow')
if crow_dep.type_name() != 'internal'
crow_has_unix_socket_support = cxx.compiles('''
#include <crow.h>
int main(){
crow::SimpleApp app;
CROW_ROUTE(app, "/")([](){
return "Hello world";
});
app.unix_path("/tmp/test.sock").multithreaded().run();
}
''',
dependencies: [crow_dep],
name: 'crow_has_unix_socket_support',
)
if not crow_has_unix_socket_support
error('The installed Crow has no unix socket support, so WebCFace cannot use it.\n' + \
'Set "--force-fallback-for=Crow".',
)
endif
endif
libvips_cpp_dep = dependency('vips-cpp',
default_options: [
'default_library=static',
'warning_level=0',
'werror=false',
'jpeg=enabled',
'spng=enabled',
'webp=enabled',
'zlib=enabled',
# disabled options:
'man=false',
'po=false',
'tools=false',
'test=false',
'fuzz=false',
'deprecated=false',
'examples=false',
'modules=disabled',
'introspection=disabled',
'vapi=false',
'cfitsio=disabled',
'cgif=disabled',
'exif=disabled',
'fftw=disabled',
'fontconfig=disabled',
'archive=disabled',
'heif=disabled',
'heif-module=disabled',
'imagequant=disabled',
'jpeg-xl=disabled',
'jpeg-xl-module=disabled',
'lcms=disabled',
'magick=disabled',
'magick-package=',
'magick-module=disabled',
'matio=disabled',
'nifti=disabled',
'openexr=disabled',
'openjpeg=disabled',
'openslide=disabled',
'openslide-module=disabled',
'highway=disabled',
'orc=disabled',
'pangocairo=disabled',
'pdfium=disabled',
'png=disabled',
'poppler=disabled',
'poppler-module=disabled',
'quantizr=disabled',
'rsvg=disabled',
'tiff=disabled',
'nsgif=false',
'ppm=false',
'analyze=false',
'radiance=false',
],
)
else
libvips_cpp_dep = disabler()
endif
if build_examples and build_cv_examples
opencv_core_dep = dependency('OpenCV',
method: 'cmake',
modules: ['opencv_core'],
required: false,
disabler: true,
)
opencv_imgproc_dep = dependency('OpenCV',
method: 'cmake',
modules: ['opencv_imgproc'],
required: false,
disabler: true,
)
opencv_highgui_dep = dependency('OpenCV',
method: 'cmake',
modules: ['opencv_highgui'],
required: false,
disabler: true,
)
else
opencv_core_dep = disabler()
opencv_imgproc_dep = disabler()
opencv_highgui_dep = disabler()
endif
if build_tests
gtest_dep = dependency('gtest', main: true,
fallback: ['gtest', 'gtest_main_dep'],
)
endif
summary('Build server',
[build_server, get_option('server').auto() ? '(auto)' : ''],
bool_yn: true,
list_sep: ' ',
)
summary('Build examples',
[build_examples, get_option('examples').auto() ? '(auto)' : ''],
bool_yn: true,
list_sep: ' ',
)
summary('Build examples with OpenCV',
[
build_examples and \
build_cv_examples and \
not is_disabler(opencv_core_dep) and \
not is_disabler(opencv_imgproc_dep) and \
not is_disabler(opencv_highgui_dep),
get_option('cv_examples').auto() ? '(auto)' : '',
],
bool_yn: true,
list_sep: ' ',
)
summary('Build tests',
[build_tests, get_option('tests').auto() ? '(auto)' : ''],
bool_yn: true,
list_sep: ' ',
)
subdir('common')
subdir('client')
sources = []
if webcface_system_version_rc
sources += import('windows').compile_resources(
configure_file(
input: version_rc_in,
output: 'webcface_version.rc',
configuration: configuration_data({
'company_name': webcface_contact,
'file_description': 'WebCFace Client Library',
'filetype_app': 0,
}),
),
include_directories: [webcface_config_inc],
)
endif
webcface_lib = library(webcface_lib_name,
# link_wholeではなくobjectsにすることで、
# それぞれのlibに追加したcpp_argsとかが含まれないようにする
objects: [
webcface_common_lib.extract_all_objects(recursive: false),
webcface_client_lib.extract_all_objects(recursive: false),
],
sources: sources,
dependencies: [
filesystem_dep,
m_dep,
win32folders_dep,
msgpack_cxx_dep,
utf8cpp_dep,
spdlog_dep,
curl_dep,
],
version: meson.project_version(),
soversion: webcface_abi_major,
darwin_versions: [
webcface_abi_major + '.' + webcface_abi_minor,
meson.project_version(),
],
install: true,
)
webcface_dep = declare_dependency(
link_with: [webcface_lib],
include_directories: [
webcface_common_inc,
webcface_client_inc,
],
dependencies: [
webcface_config_dep,
filesystem_dep,
win32folders_dep,
],
)
import('pkgconfig').generate(
name: 'WebCFace',
description: webcface_description,
url: webcface_url,
filebase: 'webcface',
libraries: [webcface_lib],
version: webcface_version_str,
# インストール後に webcface.pc へのシンボリックリンクリンクを別の場所に貼った場合、
# もとのprefix (/opt/webcface など) も参照するようにする。
# (cmakeの場合はwebcface-config.cmake内にシンボリックリンクを展開するコード書いた)
extra_cflags: '-I' + (get_option('prefix') / get_option('includedir')),
)
meson.override_dependency('webcface', webcface_dep)
if get_option('default_library') == 'shared'
# sharedライブラリの場合のみ、webcface.pc から Requires.private の行を削除
meson.add_install_script(py,
meson.project_source_root() / 'scripts' / 'remove_private_requires.py',
)
endif
if build_server
subdir('server-store')
subdir('server')
endif
if build_examples
subdir('examples')
endif
if build_tests
subdir('tests')
endif
headers = run_command(py,
meson.project_source_root() / 'scripts' / 'list_headers.py',
check: true,
).stdout().strip().split('\n')
foreach h: headers
h_root = h.split(';')[0]
h_dir = h.split(';')[1]
h_name = h.split(';')[2]
install_headers(h_root / h_dir / h_name,
subdir: h_dir,
)
endforeach
if host_machine.system() == 'linux'
conf_data = configuration_data({
'prefix': get_option('prefix'),
'bindir': get_option('bindir'),
})
configure_file(
input: 'scripts' / 'webcface-server.service.in',
output: 'webcface-server.service',
configuration: conf_data,
install: true,
install_dir: 'lib' / 'systemd' / 'system', # lib/x86_64-linux-gnu/ ではない
)
endif
install_data(['README.md', 'LICENSE'],
install_dir: get_option('datadir') / 'doc' / 'webcface',
)
if get_option('default_library') == 'shared'
cmake.write_basic_package_version_file(
name: 'webcface',
version: meson.project_version(),
compatibility: 'SameMajorVersion',
arch_independent: false,
install_dir: get_option('libdir') / 'cmake' / 'webcface' + meson.project_version().split('.')[0],
)
conf_data = configuration_data({
'prefix': get_option('prefix'),
'libdir': get_option('libdir'),
'includedir': get_option('includedir'),
'webcface_lib_debug': webcface_lib_name_debug,
'webcface_lib_release': webcface_lib_name_release,
'webcface_abi_major': webcface_abi_major,
'webcface_version_str': webcface_version_str,
})
cmake.configure_package_config_file(
name: 'webcface',
input: 'scripts' / 'webcface-config.cmake.in',
configuration: conf_data,
install_dir: get_option('libdir') / 'cmake' / 'webcface' + meson.project_version().split('.')[0],
)
endif