-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeson.build.1
133 lines (110 loc) · 3.68 KB
/
meson.build.1
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
if get_option('with_test')
test_exe = executable(meson.project_name() + '-test',
sources,
include_directories: directories,
d_unittest: true,
d_module_versions: test_versions,
link_args: '-main',
dependencies: required_deps,
)
test(meson.project_name() + '-test', test_exe)
foreach dir : test_subdirs
subdir(dir)
endforeach
endif
if get_option('with_doc')
tags = run_command('python3', 'docgen/stable_and_latest_tags.py').stdout().split()
stable_tag = tags[0]
latest_tag = tags[1]
docs_config = latest_tag + '.ddoc'
latest_file = custom_target('latest_target',
build_by_default: true,
input : [],
output : docs_config,
capture: true,
command: ['echo',
'\nLATEST=' + latest_tag +
'\nLATEST_STABLE=' + stable_tag +
'\nPROJECT=' + meson.project_name() +
'\nCOMPANY=' + get_option('company') +
'\nMETA_DESCRIPTION=' + description
])
d_compiler = meson.get_compiler('d').get_id()
if d_compiler == 'gcc'
d_compiler = 'gdmd'
elif d_compiler == 'llvm'
d_compiler = 'ldmd2'
else
d_compiler = 'dmd'
endif
root = meson.source_root()
menu = custom_target('menu_target',
build_by_default: true,
input : files('docgen/gen_modlist.d'),
output : 'mir.ddoc',
capture: true,
command: [d_compiler, '-run', '@INPUT0@', join_paths(root, 'source')])
includes = ['-I' + join_paths(root, 'source')]
foreach sub_name : subprojects
includes += '-I' + join_paths(root, 'subprojects', sub_name, 'source')
endforeach
extra_args = [d_compiler, '-w', '-c', '-o-', '-preview=dip1008',
docs_config,
join_paths(root, 'docgen/macros.ddoc'),
join_paths(root, 'docgen/html.ddoc'),
join_paths(root, 'docgen/dlang.org.ddoc'),
join_paths(root, 'docgen/std.ddoc'),
join_paths(root, 'docgen/custom.ddoc'),
'mir.ddoc',
includes,
'-Dfweb/@OUTPUT@', '@INPUT@']
i = 0
foreach source : sources_list
test_name = 'documented_unittests_' + source.underscorify()
test_source_name = test_name + '.d'
test_source = custom_target(test_name,
output: test_source_name,
input: sources[i],
capture: true,
command: [
'dtools_tests_extractor',
# '--betterC',
'-i',
'@INPUT@',
]
)
test_exe = executable(test_name + '_exe',
test_source,
include_directories: directories,
d_unittest: true,
d_module_versions: test_versions,
link_args: '-main',
dependencies: this_dep,
)
test(source + ' documented unittest', test_exe)
i += 1
endforeach
htmls = []
foreach f : sources_list
s = []
foreach e : f.split('/')
if e != 'package'
s += e
endif
endforeach
htmls += '_'.join(s) + '.html'
endforeach
htmls = ['index.html'] + htmls
sources = ['index.d'] + sources
i = 0
foreach source : sources
custom_target('doc_target_' + i.to_string(),
build_by_default: true,
input : source,
output : htmls[i],
depends: [menu, latest_file],
command: extra_args,
)
i += 1
endforeach
endif