Skip to content

Commit 1c00e1c

Browse files
committed
Copy all of the swift-syntax Swift modules.
Make the build directory for lib/swift/host look like the eventually toolchain directory by copying in all of the Swift module files. This makes it easier to correctly build anything requiring these libraries against either the build or the install directories.
1 parent 5f17377 commit 1c00e1c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/ASTGen/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,24 @@ if (SWIFT_SWIFT_PARSER)
114114
)
115115
endforeach()
116116

117+
# Copy all of the Swift modules from earlyswiftsyntax so they can be found
118+
# in the same relative place within the build directory as in the final
119+
# toolchain.
120+
list(TRANSFORM SWIFT_SYNTAX_MODULES APPEND ".swiftmodule"
121+
OUTPUT_VARIABLE SWIFT_SYNTAX_MODULE_DIRS)
122+
foreach(module_dir ${SWIFT_SYNTAX_MODULE_DIRS})
123+
file(GLOB module_files
124+
"${SWIFT_SYNTAX_LIBRARIES_SOURCE_DIR}/${module_dir}/*.swift*")
125+
add_custom_command(
126+
TARGET swiftASTGen PRE_BUILD
127+
COMMAND ${CMAKE_COMMAND} -E make_directory ${SWIFT_SYNTAX_LIBRARIES_DEST_DIR}/${module_dir}
128+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${module_files} ${SWIFT_SYNTAX_LIBRARIES_DEST_DIR}/${module_dir}/
129+
COMMENT "Copying ${module_dir}"
130+
)
131+
endforeach()
132+
117133
target_include_directories(swiftASTGen PUBLIC
118-
"${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/lib/swift/host")
134+
${SWIFT_SYNTAX_LIBRARIES_DEST_DIR})
119135

120136
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS swiftASTGen)
121137
endif()

0 commit comments

Comments
 (0)