@@ -243,22 +243,40 @@ the target’s C language sources. This is specified in the llbuild manifest
243
243
(` debug.yaml ` in the packag's ` .build ` directory).
244
244
245
245
##### Additional Swift build flags
246
- The following flags are used when compiling the ** Swift** part of the target:
246
+ The following flags are additionally used when compiling the Swift sub- target:
247
247
1 . ` -import-underlying-module ` This flag triggers a partial build of the
248
248
underlying C language sources when building the Swift module. This critical
249
249
flag enables the Swift sources to use C language types defined in the Clang
250
250
part of the target.
251
251
1 . ` -I /path/to/modulemap_dir ` The above ` -import-underlying-module ` flag
252
- will look for a module map in the given header search path. This may be
253
- either the public headers directory or the build directory, depending on
254
- whether a custom module map is provided.
255
- 1 . ` -I $(target’s path) ` Adding the target's [ path] allows for importing
256
- headers using paths relative to the root of the target. Because passing
257
- ` -import-underlying-module ` triggers a partial build of the C language
252
+ will look for a module map in the given header search path. The module
253
+ map used here cannot modularize the generated interop header as will be
254
+ created from building the Swift sub-target and therefore does not exist
255
+ yet. If a custom module map is provided, the public headers directory
256
+ will be used as that is where the custom module map is enforced to be
257
+ located. It's also enforced that this module map does not expose an
258
+ interop header. If a custom module map is _ not_ provided, the package
259
+ manager will pass the target's build directory as that is where a module
260
+ map will be synthesized. This module map will be _ un-extended_ , in that
261
+ it does not modularize the generated interop header.
262
+ 1 . _ If a custom module is NOT provided,_ the package manager will synthesize
263
+ two module maps. One is _ extended_ in that it modualrizes the generated
264
+ interop header. The other is _ un-extended_ in that it does not modularize
265
+ the generated interop header. A VFS Overlay file is created to swap the
266
+ extended one (named ` module.modulemap ` ) for the unextended one
267
+ (` unextended-module.modulemap ` ) for the build.
268
+ 1 . ` -Xcc -I -Xcc $(TARGET_SRC_PATH) ` Adding the target's [ path] allows for
269
+ importing headers using paths relative to the root of the target. Because
270
+ passing ` -import-underlying-module ` triggers a partial build of the Clang
258
271
sources, this is needed for resolving possible header imports.
272
+ 1 . ` -Xcc -I -Xcc $(TARGET_PUBLIC_HDRS) ` Adding the target's public header's
273
+ path allows for importing headers using paths relative to the public
274
+ header's directory. Because passing ` -import-underlying-module ` triggers
275
+ a partial build of the Clang sources, this is needed for resolving
276
+ possible header imports.
259
277
260
278
##### Additional Clang build flags
261
- The following flags are used when compiling the ** Clang** part of the target:
279
+ The following flags are additionally used when compiling the Clang sub- target:
262
280
1 . ` -I $(target’s path) ` Adding the target's [ path] allows for importing
263
281
headers using paths relative to the root of the target.
264
282
1 . ` -I /path/to/generated_swift_header/ ` The generated Swift header may be
0 commit comments