Skip to content

Commit 0ed9f18

Browse files
committed
[cxx-interop] Copy bridging header to same directory as other headers
The `bridging` header for C++ interop was calculating an include directory using `CMAKE_BINARY_DIR` and `CMAKE_CFG_INTDIR` while the rest of the headers consistently use `CMAKE_CURRENT_BINARY_DIR` and no `CMAKE_CFG_INTDIR`. In some configurations of CMake (for example when using Swift as an external project of LLVM and building an unified toolchain), this means that the `brigding` header will end up in a different directory than the rest of the headers, which complicates testing. The changes in this commit reuses `SWIFT_INCLUDE_DIR` to keep consistency with the rest of the headers. Any build started by `build-script` should not notice the difference.
1 parent 78273b2 commit 0ed9f18

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/ClangImporter/CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,14 @@ set_swift_llvm_is_available(swiftClangImporter)
4747
if(SWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER)
4848
# Mark - copy "bridging" (support header) into the local include directory and
4949
# install it into the compiler toolchain.
50-
set(SWIFTINC_DIR
51-
"${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include/swift")
52-
5350
add_custom_command(
54-
OUTPUT "${SWIFTINC_DIR}/bridging"
51+
OUTPUT "${SWIFT_INCLUDE_DIR}/swift/bridging"
5552
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/bridging"
56-
COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/bridging" "${SWIFTINC_DIR}")
53+
COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/bridging" "${SWIFT_INCLUDE_DIR}/swift")
5754

5855
add_custom_target("copy_cxxInterop_support_header"
59-
DEPENDS "${SWIFTINC_DIR}/bridging"
60-
COMMENT "Copying C++ interop support header to ${SWIFTINC_DIR}")
56+
DEPENDS "${SWIFT_INCLUDE_DIR}/swift/bridging"
57+
COMMENT "Copying C++ interop support header to ${SWIFT_INCLUDE_DIR}/swift")
6158

6259
swift_install_in_component(FILES
6360
"${CMAKE_CURRENT_SOURCE_DIR}/bridging"

0 commit comments

Comments
 (0)