Skip to content

Commit dad5ae2

Browse files
authored
Merge pull request #58667 from rintaro/swiftcompiler-package-directory
[SwiftCompilerModules] Configured Package.swift use its own directory
2 parents b42c202 + 537bd07 commit dad5ae2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,22 +269,23 @@ else()
269269
endif()
270270

271271
# Configure 'SwiftCompilerModules' SwiftPM package. The 'Package.swift' will
272-
# be created at '${build_dir}/SwiftCompilerSources/Package.swift' and can be
273-
# built with 'swift-build'.
272+
# be created at '${build_dir}/SwiftCompilerModulesPackage/Package.swift' and can
273+
# be built with 'swift-build'.
274274
# Note that this SwiftPM package itself is just for development purposes, and
275275
# is not actually used for the compiler building.
276-
set(swiftcompiler_source_dir_name "_Sources")
276+
set(swiftcompiler_modules_package_directory
277+
"${SWIFT_BINARY_DIR}/SwiftCompilerModulesPackage")
277278
configure_file(Package.swift.in
278-
"${CMAKE_CURRENT_BINARY_DIR}/Package.swift" @ONLY)
279+
"${swiftcompiler_modules_package_directory}/Package.swift" @ONLY)
279280
# SwiftPM requires all sources are inside the directory of 'Package.swift'.
280281
# Create symlinks to the actual source directories.
281282
execute_process(COMMAND
282283
"${CMAKE_COMMAND}" -E create_symlink
283284
"${CMAKE_CURRENT_SOURCE_DIR}/Sources"
284-
"${CMAKE_CURRENT_BINARY_DIR}/${swiftcompiler_source_dir_name}")
285+
"${swiftcompiler_modules_package_directory}/Sources")
285286
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
286287
execute_process(COMMAND
287288
"${CMAKE_COMMAND}" -E create_symlink
288289
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser"
289-
"${CMAKE_CURRENT_BINARY_DIR}/_RegexParser_Sources")
290+
"${swiftcompiler_modules_package_directory}/_RegexParser_Sources")
290291
endif()

SwiftCompilerSources/Package.swift.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private extension Target {
3939
.target(
4040
name: name,
4141
dependencies: dependencies,
42-
path: path ?? "@swiftcompiler_source_dir_name@/\(name)",
42+
path: path ?? "Sources/\(name)",
4343
exclude: ["CMakeLists.txt"],
4444
sources: sources,
4545
swiftSettings: defaultSwiftSettings + swiftSettings)

0 commit comments

Comments
 (0)