Skip to content

Commit 9d079f3

Browse files
committed
Runtimes: export the SwiftOverlay targets
This allows wiring up dependencies across the projects. In particular, this is needed to get the generated VFS mapping in the Android build for the explicit dependencies to work. The PCM emission does not receive the required mapping and thus is unable to load the modulemaps for the build of the PCM.
1 parent 5d66fda commit 9d079f3

File tree

9 files changed

+32
-1
lines changed

9 files changed

+32
-1
lines changed

Runtimes/Overlay/Android/Android/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ target_link_libraries(swiftAndroid PRIVATE
1616
swiftCore)
1717

1818
install(TARGETS swiftAndroid
19+
EXPORT SwiftOverlayTargets
1920
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
2021
LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
2122
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

Runtimes/Overlay/Android/Math/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ target_link_libraries(swift_math PRIVATE
88
swiftCore)
99

1010
install(TARGETS swift_math
11+
EXPORT SwiftOverlayTargets
1112
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1213
LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1314
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

Runtimes/Overlay/Android/clang/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ target_compile_options(SwiftAndroid INTERFACE
2828
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc --sysroot=\"${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot\">"
2929
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-vfsoverlay ${CMAKE_CURRENT_BINARY_DIR}/android-ndk-overlay.yaml>")
3030

31+
install(TARGETS SwiftAndroid
32+
EXPORT SwiftOverlayTargets)
3133
install(FILES
3234
android.modulemap
3335
SwiftAndroidNDK.h
3436
SwiftBionic.h
3537
DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift/${SwiftOverlay_PLATFORM_SUBDIR}/${SwiftOverlay_ARCH_SUBDIR})
36-
3738
install(FILES
3839
posix_filesystem.apinotes
3940
spawn.apinotes

Runtimes/Overlay/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,22 @@ endif()
6666
if(WIN32)
6767
add_subdirectory(Windows)
6868
endif()
69+
70+
# Inter-project install info
71+
export(EXPORT SwiftOverlayTargets
72+
FILE "cmake/SwiftOverlay/SwiftOverlayTargets.cmake")
73+
install(EXPORT SwiftOverlayTargets
74+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SwiftOverlay"
75+
FILE "SwiftOverlayTargets.cmake"
76+
COMPONENT SwiftOverlayCMake)
77+
include(CMakePackageConfigHelpers)
78+
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/interface/SwiftOverlayConfig.cmake.in"
79+
"${CMAKE_CURRENT_BINARY_DIR}/cmake/SwiftOverlay/SwiftOverlayConfig.cmake"
80+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SwiftOverlay")
81+
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/cmake/SwiftOverlay/SwiftOverlayConfigVersion.cmake"
82+
VERSION "${PROJECT_VERSION}"
83+
COMPATIBILITY ExactVersion)
84+
install(FILES
85+
"${CMAKE_CURRENT_BINARY_DIR}/cmake/SwiftOverlay/SwiftOverlayConfig.cmake"
86+
"${CMAKE_CURRENT_BINARY_DIR}/cmake/SwiftOverlay/SwiftOverlayConfigVersion.cmake"
87+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SwiftOverlay")

Runtimes/Overlay/Windows/CRT/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ target_link_libraries(swiftCRT PRIVATE
1818
swiftCore)
1919

2020
install(TARGETS swiftCRT
21+
EXPORT SwiftOverlayTargets
2122
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
2223
LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
2324
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

Runtimes/Overlay/Windows/WinSDK/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ target_link_libraries(swiftWinSDK PRIVATE
1010
swiftCore)
1111

1212
install(TARGETS swiftWinSDK
13+
EXPORT SwiftOverlayTargets
1314
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1415
LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1516
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

Runtimes/Overlay/Windows/clang/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ add_library(ClangModules INTERFACE)
4141
target_compile_options(ClangModules INTERFACE
4242
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-vfsoverlay ${CMAKE_CURRENT_BINARY_DIR}/windows-sdk-overlay.yaml>")
4343

44+
install(TARGETS ClangModules
45+
EXPORT SwiftOverlayTargets)
4446
install(FILES
4547
ucrt.modulemap
4648
vcruntime.apinotes

Runtimes/Overlay/clang/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ target_link_libraries(swift_Builtin_float PRIVATE
1313
swiftCore)
1414

1515
install(TARGETS swift_Builtin_float
16+
EXPORT SwiftOverlayTargets
1617
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1718
LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"
1819
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@PACKAGE_INIT@
2+
include("${CMAKE_CURRENT_LIST_DIR}/SwiftOverlayTargets.cmake")
3+
4+
set(SwiftOverlay_ENABLE_REFLECTION @SwiftOverlay_ENABLE_REFLECTION@)

0 commit comments

Comments
 (0)