@@ -49,6 +49,12 @@ if (SWIFT_SWIFT_PARSER)
49
49
"${CMAKE_SHARED_LIBRARY_SUFFIX} "
50
50
OUTPUT_VARIABLE SWIFT_SYNTAX_SHARED_LIBRARIES )
51
51
52
+ list (TRANSFORM SWIFT_SYNTAX_MODULES PREPEND "${CMAKE_IMPORT_LIBRARY_PREFIX} "
53
+ OUTPUT_VARIABLE SWIFT_SYNTAX_IMPORT_LIBRARIES )
54
+ list (TRANSFORM SWIFT_SYNTAX_IMPORT_LIBRARIES APPEND
55
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX} " OUTPUT_VARIABLE
56
+ SWIFT_SYNTAX_IMPORT_LIBRARIES )
57
+
52
58
# Interface library to collect swiftinterfaces and swiftmodules from
53
59
# SwiftSyntax
54
60
add_library (swiftSyntaxLibraries INTERFACE )
@@ -67,27 +73,47 @@ if (SWIFT_SWIFT_PARSER)
67
73
)
68
74
endif ()
69
75
70
- add_custom_command (
71
- OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
72
- DEPENDS "${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} "
73
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
74
- ${add_origin_rpath}
75
- )
76
-
77
- add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
78
- DEPENDS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
79
- COMMENT "Copying ${sharedlib} "
80
- )
81
-
82
- swift_install_in_component (
83
- PROGRAMS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
84
- DESTINATION "lib${LLVM_LIBDIR_SUFFIX} /swift/host"
85
- COMPONENT compiler
86
- )
76
+ if (CMAKE_SYSTEM_NAME MATCHES Windows )
77
+ add_custom_command (OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
78
+ DEPENDS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} "
79
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib} )
80
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
81
+ DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
82
+ COMMENT "copying ${sharedlib} " )
83
+ swift_install_in_component (PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
84
+ DESTINATION bin
85
+ COMPONENT compiler )
86
+ else ()
87
+ add_custom_command (OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
88
+ DEPENDS "${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} "
89
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
90
+ ${add_origin_rpath} )
91
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
92
+ DEPENDS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
93
+ COMMENT "Copying ${sharedlib} " )
94
+ swift_install_in_component (PROGRAMS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
95
+ DESTINATION "lib${LLVM_LIBDIR_SUFFIX} /swift/host"
96
+ COMPONENT compiler )
97
+ endif ()
87
98
88
99
add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${sharedlib} )
89
100
endforeach ()
90
101
102
+ if (CMAKE_SYSTEM_NAME MATCHES Windows )
103
+ foreach (implib ${SWIFT_SYNTAX_IMPORT_LIBRARIES} )
104
+ add_custom_command (OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
105
+ DEPENDS ${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /lib/swift/host/${implib}
106
+ COMMAND "${CMAKE_COMMAND} " -E copy_if_different ${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /lib/swift/host/${implib} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib} )
107
+ add_custom_target (copy_swiftSyntaxLibrary_${implib}
108
+ DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
109
+ COMMENT "Copying ${implib} " )
110
+ swift_install_in_component (PROGRAMS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
111
+ DESTINATION lib
112
+ COMPONENT compiler )
113
+ add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${implib} )
114
+ endforeach ()
115
+ endif ()
116
+
91
117
# Copy all of the Swift modules from earlyswiftsyntax so they can be found
92
118
# in the same relative place within the build directory as in the final
93
119
# toolchain.
0 commit comments