Skip to content

Commit b76d60d

Browse files
committed
[CMake] Copy swift resource dir only when building standalone
When building with a unified setup (lldb and swift are a part of the same build) lldb should be able to use the swift libdir from the swift build. apple-llvm-split-commit: ba5e37a5a6d9775e43b819ec7abb5bfeb56f18ad apple-llvm-split-dir: lldb/
1 parent 6eedc48 commit b76d60d

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

lldb/source/API/CMakeLists.txt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,17 @@ add_custom_command_target(
201201
ALL
202202
DEPENDS ${clang_headers_target})
203203

204-
add_custom_command_target(
205-
copy-swift-resource-dir
206-
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${SWIFT_RESOURCE_PATH}" "${lib_dir}/lldb/swift/"
207-
OUTPUT "${lib_dir}/lldb/swift/"
208-
VERBATIM
209-
ALL
210-
DEPENDS ${SWIFT_RESOURCE_PATH})
204+
# Only copy the swift resource directory if you are building lldb standalone.
205+
# Otherwise, just rely on the swift libdir available from the swift build.
206+
if(LLDB_BUILT_STANDALONE)
207+
add_custom_command_target(
208+
copy-swift-resource-dir
209+
COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${SWIFT_RESOURCE_PATH}" "${lib_dir}/lldb/swift/"
210+
OUTPUT "${lib_dir}/lldb/swift/"
211+
VERBATIM
212+
ALL
213+
DEPENDS ${SWIFT_RESOURCE_PATH})
214+
endif()
211215

212216
add_dependencies(liblldb ${copy-clang-resource-dir} ${copy-swift-resource-dir})
213217

@@ -218,7 +222,9 @@ install(
218222
DIRECTORY "${lib_dir}/lldb/clang"
219223
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/lldb/)
220224

221-
install(
222-
DIRECTORY "${lib_dir}/lldb/swift"
223-
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/lldb/)
225+
if(LLDB_BUILT_STANDALONE)
226+
install(
227+
DIRECTORY "${lib_dir}/lldb/swift"
228+
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/lldb/)
229+
endif()
224230

0 commit comments

Comments
 (0)