1
1
# sigc++
2
2
3
3
# Input: sigcxx_build_dep, sigcxx_pcname, sigcxx_libversion, sigcxx_api_version,
4
- # install_includedir, project_source_root, sigc_res
4
+ # install_includedir, project_source_root, sigc_res, python3,
5
+ # handle_built_files
5
6
# Output: source_h_files, built_h_files, sigcxx_own_dep, built_files_root,
6
7
# built_h_file_targets
7
8
@@ -33,54 +34,28 @@ functors_h_files = [
33
34
' functors' / ' slot_base.h' ,
34
35
]
35
36
36
- # .m4 files to build .h and .cc files from.
37
- adaptors_lambda_cc_m4_files = [
38
- ' lambda.cc' ,
39
- ]
37
+ # .m4 files to build .h files from.
40
38
sigc_h_m4_files = [
41
39
' limit_reference.h' ,
42
40
' signal.h' ,
43
41
]
44
- adaptors_h_m4_files = [
45
- ' adaptor_trait.h' ,
46
- ' bind.h' ,
47
- ' bind_return.h' ,
48
- ' compose.h' ,
49
- ' deduce_result_type.h' ,
50
- ' exception_catch.h' ,
51
- ' hide.h' ,
52
- ' retype.h' ,
53
- ' retype_return.h' ,
54
- ' track_obj.h' ,
55
- ]
56
- adaptors_lambda_h_m4_files = [
57
- ' base.h' ,
58
- ' select.h' ,
59
- ]
60
- functors_h_m4_files = [
61
- ' functor_trait.h' ,
62
- ' mem_fun.h' ,
63
- ' ptr_fun.h' ,
64
- ' slot.h' ,
65
- ]
42
+
43
+ m4_template = files (' macros' / ' template.macros.m4' )
44
+ m4_include_dir = meson .current_source_dir() / ' macros'
66
45
67
46
source_h_files = sigc_h_files + adaptors_h_files + functors_h_files
68
47
69
48
built_h_files = sigc_h_m4_files
70
- foreach file : adaptors_h_m4_files
71
- built_h_files += ' adaptors' / file
72
- endforeach
73
- foreach file : adaptors_lambda_h_m4_files
74
- built_h_files += ' adaptors' / ' lambda' / file
75
- endforeach
76
- foreach file : functors_h_m4_files
77
- built_h_files += ' functors' / file
78
- endforeach
79
-
80
49
built_cc_files = []
81
- foreach file : adaptors_lambda_cc_m4_files
82
- built_cc_files += ' adaptors' / ' lambda' / file
83
- endforeach
50
+
51
+ # Force meson+ninja to generate source files before anything is compiled.
52
+ # Compilation must depend on these targets.
53
+ built_cc_file_targets = []
54
+ built_h_file_targets = []
55
+
56
+ subdir (' adaptors' )
57
+ subdir (' adaptors/lambda' )
58
+ subdir (' functors' )
84
59
85
60
install_headers (' sigc++.h' , subdir : sigcxx_pcname / ' sigc++' )
86
61
install_headers (sigc_h_files, subdir : sigcxx_pcname / ' sigc++' )
@@ -107,58 +82,26 @@ endif
107
82
108
83
if maintainer_mode
109
84
110
- # Maintainer mode. Generate .h and .cc files from .m4 files in macros/ directories.
85
+ # Maintainer mode. Generate .h and .cc files from .m4 files in macros/ directory.
86
+ # .h and .cc files are also generated in subdirectories.
111
87
112
88
# docs/reference/meson.build needs this.
113
89
built_files_root = project_build_root
114
90
115
- m4_and_built_files = []
116
- foreach file : adaptors_lambda_cc_m4_files + adaptors_lambda_h_m4_files
117
- m4_and_built_files += [[' adaptors' / ' lambda' / ' macros' / file + ' .m4' ,
118
- ' adaptors' / ' lambda' / file]]
119
- endforeach
120
91
foreach file : sigc_h_m4_files
121
- m4_and_built_files += [[' macros' / file + ' .m4' , file]]
122
- endforeach
123
- foreach file : adaptors_h_m4_files
124
- m4_and_built_files += [[' adaptors' / ' macros' / file + ' .m4' , ' adaptors' / file]]
125
- endforeach
126
- foreach file : functors_h_m4_files
127
- m4_and_built_files += [[' functors' / ' macros' / file + ' .m4' , ' functors' / file]]
128
- endforeach
129
-
130
- # Force meson+ninja to generate source files before anything is compiled.
131
- # Compilation must depend on these targets.
132
- built_cc_file_targets = []
133
- built_h_file_targets = []
134
-
135
- foreach m4_and_built_file : m4_and_built_files
136
- input_file = m4_and_built_file[0 ]
137
- output_file = m4_and_built_file[1 ]
138
- if output_file.endswith(' .cc' )
139
- stamp_file = output_file.underscorify() + ' .cc'
140
- else
141
- stamp_file = output_file.underscorify() + ' .stamp'
142
- endif
143
- built_file_target = custom_target (output_file.underscorify(),
144
- input : input_file,
145
- output : stamp_file,
92
+ built_h_file_targets += custom_target (file,
93
+ input : ' macros' / file + ' .m4' ,
94
+ output : file,
146
95
command : [
147
96
python3, handle_built_files, ' build_from_m4' ,
148
- meson .current_source_dir() / ' macros ' ,
97
+ m4_include_dir ,
149
98
' @INPUT@' ,
150
- meson .current_build_dir() / output_file,
151
99
' @OUTPUT@' ,
152
100
],
153
- depend_files : ' macros ' / ' template.macros.m4 ' ,
101
+ depend_files : m4_template ,
154
102
build_by_default : maintainer_mode,
155
103
install : false ,
156
104
)
157
- if output_file.endswith(' .cc' )
158
- built_cc_file_targets += built_file_target
159
- else
160
- built_h_file_targets += built_file_target
161
- endif
162
105
endforeach
163
106
164
107
extra_include_dirs = [' ..' ]
@@ -181,8 +124,7 @@ else # not maintainer_mode
181
124
# Not maintainer mode. Compile built source code files in
182
125
# project_source_root/untracked/sigc++.
183
126
184
- # docs/reference/meson.build needs these.
185
- built_h_file_targets = []
127
+ # docs/reference/meson.build needs this.
186
128
built_files_root = project_source_root / ' untracked'
187
129
188
130
# Two cases:
0 commit comments