@@ -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
@@ -173,17 +198,43 @@ if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
173
198
COMMENT "Symlinking headers for bootstrapping0" )
174
199
175
200
add_dependencies (${target_name} copy_shim_headers )
201
+
202
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
203
+ set (modulemap_target_name "symlink-modulemap-bootstrapping${bootstrapping} " )
204
+ add_custom_command_target (unused_var
205
+ COMMAND
206
+ "${CMAKE_COMMAND} " "-E" "make_directory" "${outdir} "
207
+ COMMAND
208
+ "${CMAKE_COMMAND} " "-E" ${cmake_symlink_option}
209
+ "${output_dir} /../module.modulemap" "${outdir} /module.modulemap"
210
+
211
+ CUSTOM_TARGET_NAME ${modulemap_target_name}
212
+ OUTPUT "${outdir} /module.modulemap"
213
+ COMMENT "Symlinking shims modulemap for bootstrapping0" )
214
+ add_dependencies (${modulemap_target_name} copy_shim_headers )
215
+ add_dependencies (${target_name} ${modulemap_target_name} )
216
+ endif ()
176
217
endforeach ()
177
218
endif ()
178
219
179
220
swift_install_in_component (FILES ${sources}
180
221
DESTINATION "lib/swift/shims"
181
222
COMPONENT stdlib )
223
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
224
+ swift_install_in_component (FILES "${output_dir} /../module.modulemap"
225
+ DESTINATION "lib/swift"
226
+ COMPONENT stdlib )
227
+ endif ()
182
228
183
229
if (SWIFT_BUILD_STATIC_STDLIB )
184
230
swift_install_in_component (FILES ${sources}
185
231
DESTINATION "lib/swift_static/shims"
186
232
COMPONENT stdlib )
233
+ if (SWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS )
234
+ swift_install_in_component (FILES "${output_dir_static} /../module.modulemap"
235
+ DESTINATION "lib/swift_static"
236
+ COMPONENT stdlib )
237
+ endif ()
187
238
endif ()
188
239
189
240
# Install Clang headers under the Swift library so that an installed Swift's
0 commit comments