-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CMake] Replace early swift-syntax with FetchContent #66043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ endfunction() | |
# source1 ... | ||
# Sources to add into this library. | ||
function(add_pure_swift_host_library name) | ||
if (NOT SWIFT_SWIFT_PARSER) | ||
if (NOT SWIFT_BUILD_SWIFT_SYNTAX) | ||
message(STATUS "Not building ${name} because swift-syntax is not available") | ||
return() | ||
endif() | ||
|
@@ -178,13 +178,15 @@ function(add_pure_swift_host_library name) | |
|
||
# Make sure we can use the host libraries. | ||
target_include_directories(${name} PUBLIC | ||
${SWIFT_HOST_LIBRARIES_DEST_DIR}) | ||
"${SWIFT_HOST_LIBRARIES_DEST_DIR}") | ||
target_link_directories(${name} PUBLIC | ||
"${SWIFT_HOST_LIBRARIES_DEST_DIR}") | ||
Comment on lines
+182
to
+183
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is some difference between |
||
|
||
if(APSHL_EMIT_MODULE) | ||
# Determine where Swift modules will be built and installed. | ||
|
||
set(module_triple ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_MODULE}) | ||
set(module_dir ${SWIFT_HOST_LIBRARIES_DEST_DIR}) | ||
set(module_triple "${SWIFT_HOST_MODULE_TRIPLE}") | ||
set(module_dir "${SWIFT_HOST_LIBRARIES_DEST_DIR}") | ||
set(module_base "${module_dir}/${name}.swiftmodule") | ||
set(module_file "${module_base}/${module_triple}.swiftmodule") | ||
set(module_interface_file "${module_base}/${module_triple}.swiftinterface") | ||
|
@@ -216,14 +218,20 @@ function(add_pure_swift_host_library name) | |
>) | ||
endif() | ||
|
||
if(LLVM_USE_LINKER) | ||
target_link_options(${name} PRIVATE | ||
"-use-ld=${LLVM_USE_LINKER}" | ||
) | ||
endif() | ||
|
||
# Export this target. | ||
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${name}) | ||
endfunction() | ||
|
||
# Add a new "pure" Swift host tool. | ||
# | ||
# "Pure" Swift host tools can only contain Swift code, and will be built | ||
# with the host compiler. | ||
# with the host compiler. | ||
# | ||
# Usage: | ||
# add_pure_swift_host_tool(name | ||
|
@@ -244,7 +252,7 @@ endfunction() | |
# source1 ... | ||
# Sources to add into this tool. | ||
function(add_pure_swift_host_tool name) | ||
if (NOT SWIFT_SWIFT_PARSER) | ||
if (NOT SWIFT_BUILD_SWIFT_SYNTAX) | ||
message(STATUS "Not building ${name} because swift-syntax is not available") | ||
return() | ||
endif() | ||
|
@@ -302,7 +310,15 @@ function(add_pure_swift_host_tool name) | |
|
||
# Make sure we can use the host libraries. | ||
target_include_directories(${name} PUBLIC | ||
${SWIFT_HOST_LIBRARIES_DEST_DIR}) | ||
"${SWIFT_HOST_LIBRARIES_DEST_DIR}") | ||
target_link_directories(${name} PUBLIC | ||
"${SWIFT_HOST_LIBRARIES_DEST_DIR}") | ||
|
||
if(LLVM_USE_LINKER) | ||
target_link_options(${name} PRIVATE | ||
"-use-ld=${LLVM_USE_LINKER}" | ||
) | ||
endif() | ||
|
||
# Workaround to touch the library and its objects so that we don't | ||
# continually rebuild (again, see corresponding change in swift-syntax). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this version of SwiftSyntax be used for building SourceKit-LSP? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the SwiftSyntax used for LSP and the stress tester would be the one built from the just-built compiler rather than this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should match whatever was used to build the compiler installed in the toolchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose what I should have said was "right now we...". @etcwilde brought up cross-compiling and that's a good point. So... maybe 🤔?