@@ -32,6 +32,8 @@ module fpm_manifest_dependency
32
32
use fpm_manifest_metapackages, only: metapackage_config_t, is_meta_package, new_meta_config, &
33
33
metapackage_request_t, new_meta_request
34
34
use fpm_versioning, only: version_t, new_version
35
+ use fpm_strings, only: string_t
36
+ use fpm_manifest_preprocess
35
37
implicit none
36
38
private
37
39
@@ -55,6 +57,9 @@ module fpm_manifest_dependency
55
57
! > The latest version is used if not specified.
56
58
type (version_t), allocatable :: requested_version
57
59
60
+ ! > Requested macros for the dependency
61
+ type (preprocess_config_t), allocatable :: preprocess(:)
62
+
58
63
! > Git descriptor
59
64
type (git_target_t), allocatable :: git
60
65
@@ -87,12 +92,28 @@ subroutine new_dependency(self, table, root, error)
87
92
88
93
character (len= :), allocatable :: uri, value, requested_version
89
94
95
+ type (toml_table), pointer :: child
96
+
90
97
call check(table, error)
91
98
if (allocated (error)) return
92
99
93
100
call table% get_key(self% name)
94
101
call get_value(table, " namespace" , self% namespace)
95
102
103
+ call get_value(table, " v" , requested_version)
104
+ if (allocated (requested_version)) then
105
+ if (.not. allocated (self% requested_version)) allocate (self% requested_version)
106
+ call new_version(self% requested_version, requested_version, error)
107
+ if (allocated (error)) return
108
+ end if
109
+
110
+ ! > Get optional preprocessor directives
111
+ call get_value(table, " preprocess" , child, requested= .false. )
112
+ if (associated (child)) then
113
+ call new_preprocessors(self% preprocess, child, error)
114
+ if (allocated (error)) return
115
+ endif
116
+
96
117
call get_value(table, " path" , uri)
97
118
if (allocated (uri)) then
98
119
if (get_os_type() == OS_WINDOWS) uri = windows_path(uri)
@@ -128,14 +149,6 @@ subroutine new_dependency(self, table, root, error)
128
149
return
129
150
end if
130
151
131
- call get_value(table, " v" , requested_version)
132
-
133
- if (allocated (requested_version)) then
134
- if (.not. allocated (self% requested_version)) allocate (self% requested_version)
135
- call new_version(self% requested_version, requested_version, error)
136
- if (allocated (error)) return
137
- end if
138
-
139
152
end subroutine new_dependency
140
153
141
154
! > Check local schema for allowed entries
@@ -149,6 +162,7 @@ subroutine check(table, error)
149
162
150
163
character (len= :), allocatable :: name
151
164
type (toml_key), allocatable :: list(:)
165
+ type (toml_table), pointer :: child
152
166
153
167
! > List of valid keys for the dependency table.
154
168
character (* ), dimension (* ), parameter :: valid_keys = [character (24 ) :: &
@@ -158,7 +172,8 @@ subroutine check(table, error)
158
172
" git" , &
159
173
" tag" , &
160
174
" branch" , &
161
- " rev" &
175
+ " rev" , &
176
+ " preprocess" &
162
177
& ]
163
178
164
179
call table% get_key(name)
@@ -202,6 +217,18 @@ subroutine check(table, error)
202
217
return
203
218
end if
204
219
220
+ ! Check preprocess key
221
+ if (table% has_key(' preprocess' )) then
222
+
223
+ call get_value(table, ' preprocess' , child)
224
+
225
+ if (.not. associated (child)) then
226
+ call syntax_error(error, " Dependency '" // name// " ' has invalid 'preprocess' entry" )
227
+ return
228
+ end if
229
+
230
+ end if
231
+
205
232
end subroutine check
206
233
207
234
! > Construct new dependency array from a TOML data structure
0 commit comments