@@ -46,6 +46,12 @@ if (SWIFT_SWIFT_PARSER)
46
46
"${CMAKE_SHARED_LIBRARY_SUFFIX} "
47
47
OUTPUT_VARIABLE SWIFT_SYNTAX_SHARED_LIBRARIES )
48
48
49
+ list (TRANSFORM SWIFT_SYNTAX_MODULES PREPEND "${CMAKE_IMPORT_LIBRARY_PREFIX} "
50
+ OUTPUT_VARIABLE SWIFT_SYNTAX_IMPORT_LIBRARIES )
51
+ list (TRANSFORM SWIFT_SYNTAX_IMPORT_LIBRARIES APPEND
52
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX} " OUTPUT_VARIABLE
53
+ SWIFT_SYNTAX_IMPORT_LIBRARIES )
54
+
49
55
# Interface library to collect swiftinterfaces and swiftmodules from
50
56
# SwiftSyntax
51
57
add_library (swiftSyntaxLibraries INTERFACE )
@@ -64,6 +70,7 @@ if (SWIFT_SWIFT_PARSER)
64
70
)
65
71
endif ()
66
72
73
+ if (FALSE )
67
74
add_custom_command (
68
75
OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
69
76
DEPENDS "${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} "
@@ -81,10 +88,47 @@ if (SWIFT_SWIFT_PARSER)
81
88
DESTINATION "lib${LLVM_LIBDIR_SUFFIX} /swift/host"
82
89
COMPONENT compiler
83
90
)
91
+ else ()
92
+
93
+ set (path "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} " )
94
+ cmake_path (NATIVE_PATH path NORMALIZE source )
95
+
96
+ set (path "${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib} " )
97
+ cmake_path (NATIVE_PATH path NORMALIZE destination )
98
+
99
+ add_custom_command (OUTPUT ${destination}
100
+ DEPENDS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} "
101
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${source} ${destination} )
102
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
103
+ DEPENDS ${destination}
104
+ COMMENT "copying ${sharedlib} " )
105
+ swift_install_in_component (PROGRAMS ${destination}
106
+ DESTINATION bin
107
+ COMPONENT compiler )
108
+ endif ()
84
109
85
110
add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${sharedlib} )
86
111
endforeach ()
87
112
113
+ foreach (implib ${SWIFT_SYNTAX_IMPORT_LIBRARIES} )
114
+ set (path "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /lib/swift/host/${implib} " )
115
+ cmake_path (NATIVE_PATH path NORMALIZE source )
116
+
117
+ set (path "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib} " )
118
+ cmake_path (NATIVE_PATH path NORMALIZE destination )
119
+
120
+ add_custom_command (OUTPUT ${destination}
121
+ DEPENDS ${source}
122
+ COMMAND "${CMAKE_COMMAND} " -E copy_if_different ${source} ${destination} )
123
+ add_custom_target (copy_swiftSyntaxLibrary_${implib}
124
+ DEPENDS ${destination}
125
+ COMMENT "Copying ${implib} " )
126
+ swift_install_in_component (PROGRAMS ${destination}
127
+ DESTINATION lib
128
+ COMPONENT compiler )
129
+ add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${implib} )
130
+ endforeach ()
131
+
88
132
# Copy all of the Swift modules from earlyswiftsyntax so they can be found
89
133
# in the same relative place within the build directory as in the final
90
134
# toolchain.
0 commit comments