-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add static library configuration for _InternalSwiftSyntaxParser #36151
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 |
---|---|---|
|
@@ -10,14 +10,24 @@ set(LLVM_EXPORTED_SYMBOL_FILE | |
add_swift_host_library(libSwiftSyntaxParser SHARED | ||
c-include-check.c | ||
libSwiftSyntaxParser.cpp) | ||
|
||
add_swift_host_library(libSwiftSyntaxParserStatic STATIC | ||
libSwiftSyntaxParser.cpp) | ||
|
||
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang) | ||
add_dependencies(libSwiftSyntaxParser clang) | ||
add_dependencies(libSwiftSyntaxParserStatic clang) | ||
endif() | ||
target_link_libraries(libSwiftSyntaxParser PRIVATE | ||
swiftParse) | ||
target_link_libraries(libSwiftSyntaxParserStatic PRIVATE | ||
swiftParse) | ||
set_target_properties(libSwiftSyntaxParser | ||
PROPERTIES | ||
OUTPUT_NAME ${SYNTAX_PARSER_LIB_NAME}) | ||
set_target_properties(libSwiftSyntaxParserStatic | ||
PROPERTIES | ||
OUTPUT_NAME ${SYNTAX_PARSER_LIB_NAME}) | ||
|
||
add_llvm_symbol_exports(libSwiftSyntaxParser ${LLVM_EXPORTED_SYMBOL_FILE}) | ||
|
||
|
@@ -45,16 +55,25 @@ endif() | |
|
||
set_property(TARGET libSwiftSyntaxParser APPEND_STRING PROPERTY | ||
COMPILE_FLAGS " -fblocks") | ||
set_property(TARGET libSwiftSyntaxParserStatic APPEND_STRING PROPERTY | ||
COMPILE_FLAGS " -fblocks") | ||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
target_link_libraries(libSwiftSyntaxParser PRIVATE | ||
BlocksRuntime) | ||
target_link_libraries(libSwiftSyntaxParserStatic PRIVATE | ||
BlocksRuntime) | ||
endif() | ||
|
||
add_dependencies(parser-lib libSwiftSyntaxParser) | ||
add_dependencies(parser-lib libSwiftSyntaxParserStatic) | ||
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. I'm not sure what adding this as a dependency here is for |
||
swift_install_in_component(TARGETS libSwiftSyntaxParser | ||
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" COMPONENT parser-lib | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" COMPONENT parser-lib | ||
RUNTIME DESTINATION "bin" COMPONENT parser-lib) | ||
swift_install_in_component(TARGETS libSwiftSyntaxParserStatic | ||
ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" COMPONENT parser-lib | ||
LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" COMPONENT parser-lib | ||
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. I'm hoping this translates to being included in produced toolchains so it could be shipped with releases, but I'm not sure if I should build one of those to see, or if it needs to also be added below |
||
RUNTIME DESTINATION "bin" COMPONENT parser-lib) | ||
swift_install_in_component(DIRECTORY "${SWIFT_MAIN_INCLUDE_DIR}/swift-c/SyntaxParser/" | ||
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SYNTAX_PARSER_LIB_NAME}" | ||
COMPONENT parser-lib) |
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 don't feel great about all this duplication, but also since only ~half of the things here applied to this, I went with it over creating a function. I'm not a cmake expert so I'd appreciate input!