Skip to content

Commit 772207a

Browse files
authored
Merge pull request #31889 from compnerd/llvm-support-opt
build: optimize the build of LLVMSupport
2 parents ca3aa67 + 1e74c20 commit 772207a

File tree

8 files changed

+17
-24
lines changed

8 files changed

+17
-24
lines changed

stdlib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ endif()
6262
# built and cause link failures for mismatches. Without linking that library,
6363
# we get link failures regardless, so instead, this just disables the checks.
6464
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1>)
65+
include_directories(BEFORE ${CMAKE_PROJECT_SOURCE_DIR}/include)
6566

6667
set(SWIFT_STDLIB_LIBRARY_BUILD_TYPES)
6768
if(SWIFT_BUILD_DYNAMIC_STDLIB)

stdlib/public/LLVMSupport/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ set(LLVM_USE_PERF NO)
1818
configure_file(${PROJECT_SOURCE_DIR}/include/llvm/Config/llvm-config.h.cmake
1919
${CMAKE_CURRENT_BINARY_DIR}/llvm/Config/llvm-config.h)
2020

21-
add_library(swiftLLVMSupport INTERFACE)
22-
target_include_directories(swiftLLVMSupport INTERFACE
23-
${CMAKE_CURRENT_BINARY_DIR}
24-
${CMAKE_PROJECT_SOURCE_DIR}/include)
21+
add_swift_target_library(swiftLLVMSupport OBJECT_LIBRARY
22+
ErrorHandling.cpp
23+
Hashing.cpp
24+
MemAlloc.cpp
25+
SmallPtrSet.cpp
26+
SmallVector.cpp
27+
StringRef.cpp
28+
INSTALL_IN_COMPONENT
29+
never_install)

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ set(swiftReflection_SOURCES
99
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
1010
"${SWIFT_SOURCE_DIR}/lib/Demangling/ManglingUtils.cpp"
1111
"${SWIFT_SOURCE_DIR}/lib/Demangling/Punycode.cpp"
12-
"${SWIFT_SOURCE_DIR}/lib/Demangling/Remangler.cpp"
13-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
14-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
15-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
16-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
17-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
18-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp")
12+
"${SWIFT_SOURCE_DIR}/lib/Demangling/Remangler.cpp")
1913

2014
# When we're building with assertions, include the demangle node dumper to aid
2115
# in debugging.
@@ -28,5 +22,6 @@ add_swift_target_library(swiftReflection STATIC
2822
${swiftReflection_SOURCES}
2923
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CXX_FLAGS} -DswiftCore_EXPORTS
3024
LINK_FLAGS ${SWIFT_RUNTIME_LINK_FLAGS}
25+
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
3126
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
3227
INSTALL_IN_COMPONENT dev)

stdlib/public/SwiftRemoteMirror/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@ if(SWIFT_BUILD_DYNAMIC_STDLIB)
44
add_swift_target_library(swiftRemoteMirror
55
SHARED DONT_EMBED_BITCODE NOSWIFTRT
66
SwiftRemoteMirror.cpp
7-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
8-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
9-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
10-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
11-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
12-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp"
137
LINK_LIBRARIES
148
swiftReflection
159
C_COMPILE_FLAGS
1610
${SWIFT_RUNTIME_CXX_FLAGS} -DswiftRemoteMirror_EXPORTS
1711
LINK_FLAGS
1812
${SWIFT_RUNTIME_LINK_FLAGS}
13+
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
1914
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
2015
INSTALL_IN_COMPONENT
2116
swift-remote-mirror)

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ add_swift_target_library(swiftCore
319319
PRIVATE_LINK_LIBRARIES
320320
${swift_core_private_link_libraries}
321321
INCORPORATE_OBJECT_LIBRARIES
322-
swiftRuntime swiftStdlibStubs
322+
swiftRuntime swiftLLVMSupport swiftStdlibStubs
323323
FRAMEWORK_DEPENDS
324324
${swift_core_framework_depends}
325325
INSTALL_IN_COMPONENT

stdlib/public/runtime/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ set(swift_runtime_sources
6363
RefCount.cpp
6464
RuntimeInvocationsTracking.cpp
6565
SwiftDtoa.cpp
66-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/ErrorHandling.cpp"
67-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/Hashing.cpp"
68-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/MemAlloc.cpp"
69-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallPtrSet.cpp"
70-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/SmallVector.cpp"
71-
"${SWIFT_SOURCE_DIR}/stdlib/public/LLVMSupport/StringRef.cpp"
7266
"${SWIFT_SOURCE_DIR}/lib/Demangling/OldDemangler.cpp"
7367
"${SWIFT_SOURCE_DIR}/lib/Demangling/Demangler.cpp"
7468
"${SWIFT_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
@@ -180,6 +174,7 @@ add_swift_target_library(swiftRuntime OBJECT_LIBRARY
180174
${swift_runtime_library_compile_flags}
181175
${_RUNTIME_NONATOMIC_FLAGS}
182176
LINK_FLAGS ${swift_runtime_linker_flags}
177+
INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport
183178
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
184179
INSTALL_IN_COMPONENT never_install)
185180

unittests/runtime/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
7474
# from the swiftCore dylib, so we need to link to both the runtime archive
7575
# and the stdlib.
7676
$<TARGET_OBJECTS:swiftRuntime${SWIFT_PRIMARY_VARIANT_SUFFIX}>
77+
$<TARGET_OBJECTS:swiftLLVMSupport${SWIFT_PRIMARY_VARIANT_SUFFIX}>
7778
)
7879

7980
# The local stdlib implementation provides definitions of the swiftCore

unittests/runtime/LongTests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
3737
# from the swiftCore dylib, so we need to link to both the runtime archive
3838
# and the stdlib.
3939
$<TARGET_OBJECTS:swiftRuntime${SWIFT_PRIMARY_VARIANT_SUFFIX}>
40+
$<TARGET_OBJECTS:swiftLLVMSupport${SWIFT_PRIMARY_VARIANT_SUFFIX}>
4041
)
4142

4243
# The local stdlib implementation provides definitions of the swiftCore

0 commit comments

Comments
 (0)