@@ -230,18 +230,28 @@ else()
230
230
231
231
add_subdirectory (Sources )
232
232
233
- # This is a hack to get correct dependencies from imported C++ headers:
234
- # step 1: generate a dummy source file, which just includes all headers defined in include/swift/module.modulemap
235
- add_custom_command (
236
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR} /HeaderDependencies.cpp"
237
- COMMAND
238
- "sed"
239
- -n -e "/header/!d" -e "s/.*header/#include/" -e "w ${CMAKE_CURRENT_BINARY_DIR} /HeaderDependencies.cpp"
240
- "${CMAKE_CURRENT_SOURCE_DIR} /../include/swift/module.modulemap"
241
- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /../include/swift/module.modulemap"
242
- COMMENT "Generate HeaderDependencies.cpp"
243
- )
244
-
233
+ # TODO: generate this dynamically through the modulemap; this cannot use `sed`
234
+ # as that is not available on all paltforms (e.g. Windows).
235
+ #
236
+ # step 1: generate a dummy source file, which just includes all headers
237
+ # defined in include/swift/module.modulemap
238
+ file (WRITE "${CMAKE_CURRENT_BINARY_DIR} /HeaderDependencies.cpp"
239
+ "
240
+ #include \" Basic/BridgedSwiftObject.h\"
241
+ #include \" Basic/BasicBridging.h\"
242
+ #include \" Basic/SourceLoc.h\"
243
+
244
+ #include \" AST/ASTBridging.h\"
245
+ #include \" AST/DiagnosticEngine.h\"
246
+ #include \" AST/DiagnosticConsumer.h\"
247
+
248
+ #include \" SIL/SILBridging.h\"
249
+
250
+ #include \" SILOptimizer/OptimizerBridging.h\"
251
+
252
+ #include \" Parse/RegexParserBridging.h\"
253
+ " )
254
+
245
255
# step 2: build a library containing that source file. This library depends on all the included header files.
246
256
# The swift modules can now depend on that target.
247
257
# Note that this library is unused, i.e. not linked to anything.
0 commit comments