Skip to content

Commit 537bd07

Browse files
committed
[SwiftCompilerModules] Configured Package.swift use its own directory
Previously, it used ${CMAKE_CURRENT_BINARY_DIR} as the package directory. However, since that directory contains all build artifacts so opening it in Xcode shows those unnecessary files. Intead of using ${CMAKE_CURRENT_BINARY_DIR}, create its own directory in the root build directory.
1 parent 4b56634 commit 537bd07

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
@@ -252,22 +252,23 @@ else()
252252
endif()
253253

254254
# Configure 'SwiftCompilerModules' SwiftPM package. The 'Package.swift' will
255-
# be created at '${build_dir}/SwiftCompilerSources/Package.swift' and can be
256-
# built with 'swift-build'.
255+
# be created at '${build_dir}/SwiftCompilerModulesPackage/Package.swift' and can
256+
# be built with 'swift-build'.
257257
# Note that this SwiftPM package itself is just for development purposes, and
258258
# is not actually used for the compiler building.
259-
set(swiftcompiler_source_dir_name "_Sources")
259+
set(swiftcompiler_modules_package_directory
260+
"${SWIFT_BINARY_DIR}/SwiftCompilerModulesPackage")
260261
configure_file(Package.swift.in
261-
"${CMAKE_CURRENT_BINARY_DIR}/Package.swift" @ONLY)
262+
"${swiftcompiler_modules_package_directory}/Package.swift" @ONLY)
262263
# SwiftPM requires all sources are inside the directory of 'Package.swift'.
263264
# Create symlinks to the actual source directories.
264265
execute_process(COMMAND
265266
"${CMAKE_COMMAND}" -E create_symlink
266267
"${CMAKE_CURRENT_SOURCE_DIR}/Sources"
267-
"${CMAKE_CURRENT_BINARY_DIR}/${swiftcompiler_source_dir_name}")
268+
"${swiftcompiler_modules_package_directory}/Sources")
268269
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
269270
execute_process(COMMAND
270271
"${CMAKE_COMMAND}" -E create_symlink
271272
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser"
272-
"${CMAKE_CURRENT_BINARY_DIR}/_RegexParser_Sources")
273+
"${swiftcompiler_modules_package_directory}/_RegexParser_Sources")
273274
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)