Skip to content

build: optimize the build of LLVMSupport #31889

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

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ endif()
# built and cause link failures for mismatches. Without linking that library,
# we get link failures regardless, so instead, this just disables the checks.
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1>)
include_directories(BEFORE ${CMAKE_PROJECT_SOURCE_DIR}/include)

set(SWIFT_STDLIB_LIBRARY_BUILD_TYPES)
if(SWIFT_BUILD_DYNAMIC_STDLIB)
Expand Down
13 changes: 9 additions & 4 deletions stdlib/public/LLVMSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ set(LLVM_USE_PERF NO)
configure_file(${PROJECT_SOURCE_DIR}/include/llvm/Config/llvm-config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/llvm/Config/llvm-config.h)

add_library(swiftLLVMSupport INTERFACE)
target_include_directories(swiftLLVMSupport INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_PROJECT_SOURCE_DIR}/include)
add_swift_target_library(swiftLLVMSupport OBJECT_LIBRARY
ErrorHandling.cpp
Hashing.cpp
MemAlloc.cpp
SmallPtrSet.cpp
SmallVector.cpp
StringRef.cpp
INSTALL_IN_COMPONENT
never_install)
9 changes: 2 additions & 7 deletions stdlib/public/Reflection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ set(swiftReflection_SOURCES
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/ManglingUtils.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Punycode.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Remangler.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp")
"${SWIFT_SOURCE_DIR}/lib/Demangling/Remangler.cpp")

# When we're building with assertions, include the demangle node dumper to aid
# in debugging.
Expand All @@ -28,5 +22,6 @@ add_swift_target_library(swiftReflection STATIC
${swiftReflection_SOURCES}
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CXX_FLAGS} -DswiftCore_EXPORTS
LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS}
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT dev)
7 changes: 1 addition & 6 deletions stdlib/public/SwiftRemoteMirror/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ if(SWIFT_BUILD_DYNAMIC_STDLIB)
add_swift_target_library(swiftRemoteMirror
SHARED DONT_EMBED_BITCODE NOSWIFTRT
SwiftRemoteMirror.cpp
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp"
LINK_LIBRARIES
swiftReflection
C_COMPILE_FLAGS
${SWIFT_RUNTIME_CXX_FLAGS} -DswiftRemoteMirror_EXPORTS
LINK_FLAGS
${SWIFT_RUNTIME_LINK_FLAGS}
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT
swift-remote-mirror)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ add_swift_target_library(swiftCore
PRIVATE_LINK_LIBRARIES
${swift_core_private_link_libraries}
INCORPORATE_OBJECT_LIBRARIES
swiftRuntime swiftStdlibStubs
swiftRuntime swiftLLVMSupport swiftStdlibStubs
FRAMEWORK_DEPENDS
${swift_core_framework_depends}
INSTALL_IN_COMPONENT
Expand Down
7 changes: 1 addition & 6 deletions stdlib/public/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ set(swift_runtime_sources
RefCount.cpp
RuntimeInvocationsTracking.cpp
SwiftDtoa.cpp
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/OldDemangler.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/Demangler.cpp"
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
Expand Down Expand Up @@ -180,6 +174,7 @@ add_swift_target_library(swiftRuntime OBJECT_LIBRARY
${swift_runtime_library_compile_flags}
${_RUNTIME_NONATOMIC_FLAGS}
LINK_FLAGS ${swift_runtime_linker_flags}
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
INSTALL_IN_COMPONENT never_install)

Expand Down
1 change: 1 addition & 0 deletions unittests/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
# from the swiftCore dylib, so we need to link to both the runtime archive
# and the stdlib.
$<TARGET_OBJECTS:swiftRuntime${SWIFT_PRIMARY_VARIANT_SUFFIX}>
$<TARGET_OBJECTS:swiftLLVMSupport${SWIFT_PRIMARY_VARIANT_SUFFIX}>
)

# The local stdlib implementation provides definitions of the swiftCore
Expand Down
1 change: 1 addition & 0 deletions unittests/runtime/LongTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
# from the swiftCore dylib, so we need to link to both the runtime archive
# and the stdlib.
$<TARGET_OBJECTS:swiftRuntime${SWIFT_PRIMARY_VARIANT_SUFFIX}>
$<TARGET_OBJECTS:swiftLLVMSupport${SWIFT_PRIMARY_VARIANT_SUFFIX}>
)

# The local stdlib implementation provides definitions of the swiftCore
Expand Down