@@ -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,27 +70,47 @@ if (SWIFT_SWIFT_PARSER)
64
70
)
65
71
endif ()
66
72
67
- add_custom_command (
68
- OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
69
- DEPENDS "${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} "
70
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
71
- ${add_origin_rpath}
72
- )
73
-
74
- add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
75
- DEPENDS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
76
- COMMENT "Copying ${sharedlib} "
77
- )
78
-
79
- swift_install_in_component(
80
- PROGRAMS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
81
- DESTINATION "lib${LLVM_LIBDIR_SUFFIX} /swift/host"
82
- COMPONENT compiler
83
- )
73
+ if (CMAKE_SYSTEM_NAME MATCHES Windows)
74
+ add_custom_command (OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
75
+ DEPENDS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} "
76
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR} /bin/${sharedlib} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib} )
77
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
78
+ DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
79
+ COMMENT "copying ${sharedlib} " )
80
+ swift_install_in_component(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /${sharedlib}
81
+ DESTINATION bin
82
+ COMPONENT compiler)
83
+ else ()
84
+ add_custom_command (OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
85
+ DEPENDS "${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} "
86
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_SYNTAX_LIBRARIES_BUILD_DIR} /${sharedlib} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
87
+ ${add_origin_rpath} )
88
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
89
+ DEPENDS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
90
+ COMMENT "Copying ${sharedlib} " )
91
+ swift_install_in_component(PROGRAMS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
92
+ DESTINATION "lib${LLVM_LIBDIR_SUFFIX} /swift/host"
93
+ COMPONENT compiler)
94
+ endif ()
84
95
85
96
add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${sharedlib} )
86
97
endforeach ()
87
98
99
+ if (CMAKE_SYSTEM_NAME Matches Windows)
100
+ foreach (implib ${SWIFT_SYNTAX_IMPORT_LIBRARIES} )
101
+ add_custom_command (OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
102
+ DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
103
+ COMMAND "${CMAKE_COMMAND} " -E copy_if_different ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib} )
104
+ add_custom_target (copy_swiftSyntaxLibrary_${implib}
105
+ DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
106
+ COMMENT "Copying ${implib} " )
107
+ swift_install_in_component(PROGRAMS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /lib/swift/windows/${implib}
108
+ DESTINATION lib
109
+ COMPONENT compiler)
110
+ add_dependencies (swiftSyntaxLibraries copy_swiftSyntaxLibrary_${implib} )
111
+ endforeach ()
112
+ endif ()
113
+
88
114
# Copy all of the Swift modules from earlyswiftsyntax so they can be found
89
115
# in the same relative place within the build directory as in the final
90
116
# toolchain.
0 commit comments