-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
132 lines (119 loc) · 5.64 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
# (C) 2021 by Domenico Panella <pandom79@gmail.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3.
# See http://www.gnu.org/licenses/gpl-3.0.html for full license text.
project('ulib', 'c', version: '4.1.9', default_options: ['warning_level=3', 'prefix=/usr'] )
add_global_arguments(['-Wno-incompatible-pointer-types'], language: 'c')
prj_name = 'ulib'
ver = '4.1.9'
so_ver = '4'
# Get paths
prefix = get_option('prefix')
datadir = get_option('datadir')
build_root = meson.global_build_root()
# Get test option
no_test = get_option('NO_TEST')
# Get doxygen options
doxy_latex = get_option('DOXY_LATEX')
conf_doxy_latex = 'YES'
doxy_html = get_option('DOXY_HTML')
conf_doxy_html = 'YES'
# Set paths
doc_path = get_option('DOC_PATH')
if doc_path == ''
doc_path = prefix/datadir/'doc'/prj_name+'-'+ver
endif
# Dependencies
math_dep = meson.get_compiler('c').find_library('m', required : true)
if doxy_html == true or doxy_latex == true
find_program('doxygen', required: true)
if (doxy_latex == false)
conf_doxy_latex = 'NO'
endif
if (doxy_html == false)
conf_doxy_html = 'NO'
endif
# Configuration
conf_doxy = configuration_data()
conf_doxy.set('BUILD_ROOT', build_root)
conf_doxy.set('LATEX', conf_doxy_latex)
conf_doxy.set('HTML', conf_doxy_html)
configure_file(input: 'Doxyfile.in', output: 'Doxyfile', configuration: conf_doxy)
message('Building the documentation ... ')
run_command('doxygen', build_root/'Doxyfile', check: true)
endif
# Library
ulib = library(prj_name,
'ustring/ustring.c',
'uarray/uarray.c',
'udatetime/udatetime.c',
'uhashtable/uhashtable.c',
'uhashtable/uhashtable.h',
'uparser/uparser.c',
'uparser/uparser.h',
version: ver,
soversion: so_ver,
install: true,
dependencies: math_dep
)
# Generate pc file
pkg = import('pkgconfig')
pkg.generate(ulib,
description: 'This library provides some functions to handle strings and array in C language.',
subdirs: prj_name
)
# Install Header
install_headers('ulib.h', subdir: prj_name)
# Install documentation
install_data('LICENSE', install_dir: doc_path)
install_data('README.md', install_dir: doc_path)
# Install doxy documentation
if (doxy_html == true)
install_subdir(build_root/'html', install_dir: doc_path)
endif
if (doxy_latex == true)
install_subdir(build_root/'latex', install_dir: doc_path)
endif
# Test
if (no_test == false)
test_string_new = executable('test_string_new', 'test/string_new.c', link_with: ulib)
test_string_append = executable('test_string_append', 'test/string_append.c', link_with: ulib)
test_string_prepend = executable('test_string_prepend', 'test/string_prepend.c', link_with: ulib)
test_string_equals = executable('test_string_equals', 'test/string_equals.c', link_with: ulib)
test_string_split = executable('test_string_split', 'test/string_split.c', link_with: ulib)
test_string_copy = executable('test_string_copy', 'test/string_copy.c', link_with: ulib)
test_string_file_size = executable('test_string_file_size', 'test/string_file_size.c', link_with: ulib)
test_string_sub = executable('test_string_sub', 'test/string_sub.c', link_with: ulib)
test_string_endsWith = executable('test_string_endsWith', 'test/string_endsWith.c', link_with: ulib)
test_string_indexOf = executable('test_string_indexOf', 'test/string_indexOf.c', link_with: ulib)
test_string_last_indexOf = executable('test_string_last_indexOf', 'test/string_last_indexOf.c', link_with: ulib)
test_string_insert = executable('test_string_insert', 'test/string_insert.c', link_with: ulib)
test_string_replace = executable('test_string_replace', 'test/string_replace.c', link_with: ulib)
test_array_str_copy = executable('test_array_str_copy', 'test/array_str_copy.c', link_with: ulib)
test_array_str_contains = executable('test_array_str_contains', 'test/array_str_contains.c', link_with: ulib)
test_array_release = executable('test_array_release', 'test/array_release.c', link_with: ulib)
test_ht_release = executable('test_ht_release', 'test/ht_release.c', link_with: ulib)
test_ht_release_no_alloc = executable('test_ht_release_no_alloc', 'test/ht_release_no_alloc.c', link_with: ulib)
test_ht_get_iterator = executable('test_ht_get_iterator', 'test/ht_get_iterator.c', link_with: ulib)
test_parse_file = executable('test_parse_file', 'test/parse_file.c', link_with: ulib)
test('test_string_new', test_string_new)
test('test_string_append', test_string_append)
test('test_string_prepend', test_string_prepend)
test('test_string_equals', test_string_equals)
test('test_string_split', test_string_split)
test('test_string_copy', test_string_copy)
test('test_string_file_size', test_string_file_size)
test('test_string_sub', test_string_sub)
test('test_string_endsWith', test_string_endsWith)
test('test_string_indexOf', test_string_indexOf)
test('test_string_last_indexOf', test_string_last_indexOf)
test('test_string_insert', test_string_insert)
test('test_string_replace', test_string_replace)
test('test_array_str_copy', test_array_str_copy)
test('test_array_str_contains', test_array_str_contains)
test('test_array_release', test_array_release)
test('test_ht_release', test_ht_release)
test('test_ht_release_no_alloc ', test_ht_release_no_alloc)
test('test_ht_get_iterator', test_ht_get_iterator)
test('test_parse_file', test_parse_file)
endif