@@ -63,6 +63,31 @@ foreach(input ${sources})
63
63
list (APPEND outputs "${output_dir_static} /${input} " )
64
64
endif ()
65
65
endforeach ()
66
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
67
+ # Copy the module map into the parent directory. Using "parent.modulemap"
68
+ # instead of putting "module.modulemap" into the parent module to avoid
69
+ # module redefinition conflicts with the toolchain.
70
+ add_custom_command (
71
+ OUTPUT "${output_dir} /../module.modulemap"
72
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /parent.modulemap"
73
+ COMMAND
74
+ "${CMAKE_COMMAND} " "-E" "copy_if_different"
75
+ "${CMAKE_CURRENT_SOURCE_DIR} /parent.modulemap"
76
+ "${output_dir} /../module.modulemap"
77
+ COMMENT "Copying parent.modulemap to ${output_dir} " )
78
+ list (APPEND outputs "${output_dir} /../module.modulemap" )
79
+ if (SWIFT_BUILD_STATIC_STDLIB )
80
+ add_custom_command (
81
+ OUTPUT "${output_dir_static} /../module.modulemap"
82
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /parent.modulemap"
83
+ COMMAND
84
+ "${CMAKE_COMMAND} " "-E" "copy_if_different"
85
+ "${CMAKE_CURRENT_SOURCE_DIR} /parent.modulemap"
86
+ "${output_dir_static} /../module.modulemap"
87
+ COMMENT "Copying parent.modulemap to ${output_dir_static} " )
88
+ list (APPEND outputs "${output_dir_static} /../module.modulemap" )
89
+ endif ()
90
+ endif ()
66
91
# Put the output dir itself last so that it isn't considered the primary output.
67
92
list (APPEND outputs "${output_dir} " )
68
93
@@ -179,17 +204,43 @@ if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
179
204
COMMENT "Symlinking headers for bootstrapping0" )
180
205
181
206
add_dependencies (${target_name} copy_shim_headers )
207
+
208
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
209
+ set (modulemap_target_name "symlink-modulemap-bootstrapping${bootstrapping} " )
210
+ add_custom_command_target (unused_var
211
+ COMMAND
212
+ "${CMAKE_COMMAND} " "-E" "make_directory" "${outdir} "
213
+ COMMAND
214
+ "${CMAKE_COMMAND} " "-E" ${cmake_symlink_option}
215
+ "${output_dir} /../module.modulemap" "${outdir} /module.modulemap"
216
+
217
+ CUSTOM_TARGET_NAME ${modulemap_target_name}
218
+ OUTPUT "${outdir} /module.modulemap"
219
+ COMMENT "Symlinking shims modulemap for bootstrapping0" )
220
+ add_dependencies (${modulemap_target_name} copy_shim_headers )
221
+ add_dependencies (${target_name} ${modulemap_target_name} )
222
+ endif ()
182
223
endforeach ()
183
224
endif ()
184
225
185
226
swift_install_in_component (FILES ${sources}
186
227
DESTINATION "lib/swift/shims"
187
228
COMPONENT stdlib )
229
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
230
+ swift_install_in_component (FILES "${output_dir} /../module.modulemap"
231
+ DESTINATION "lib/swift"
232
+ COMPONENT stdlib )
233
+ endif ()
188
234
189
235
if (SWIFT_BUILD_STATIC_STDLIB )
190
236
swift_install_in_component (FILES ${sources}
191
237
DESTINATION "lib/swift_static/shims"
192
238
COMPONENT stdlib )
239
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
240
+ swift_install_in_component (FILES "${output_dir_static} /../module.modulemap"
241
+ DESTINATION "lib/swift_static"
242
+ COMPONENT stdlib )
243
+ endif ()
193
244
endif ()
194
245
195
246
# Install Clang headers under the Swift library so that an installed Swift's
0 commit comments