Skip to content
Open
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
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ option(SwiftTesting_INSTALL_NESTED_SUBDIR "Install libraries under a platform an
set(SwiftTesting_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SwiftTesting_PLATFORM_SUBDIR}$<$<AND:$<PLATFORM_ID:Darwin>,$<NOT:$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>>>:/testing>$<$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>:/${SwiftTesting_ARCH_SUBDIR}>")
set(SwiftTesting_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SwiftTesting_PLATFORM_SUBDIR}$<$<AND:$<PLATFORM_ID:Darwin>,$<NOT:$<BOOL:${SwiftTesting_INSTALL_NESTED_SUBDIR}>>>:/testing>")

if(APPLE)
set(_SwiftTesting_ENABLE_LIBRARY_EVOLUTION YES)
else()
set(_SwiftTesting_ENABLE_LIBRARY_EVOLUTION NO)
endif()
option(SwiftTesting_ENABLE_LIBRARY_EVOLUTION "Generate ABI resilient runtime libraries"
${_SwiftTesting_ENABLE_LIBRARY_EVOLUTION})

add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-no-toolchain-stdlib-rpath>)

add_subdirectory(Sources)
4 changes: 3 additions & 1 deletion Sources/Overlays/_Testing_Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_library(_Testing_Foundation
ReexportTesting.swift)

target_link_libraries(_Testing_Foundation PUBLIC
_TestingInternals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Foundation overlay shouldn't need to link to this module.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that it did - there was a missing module error otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay doesn't import it and it's a static library, so if it's complaining, that probably aligns with what @stmontgomery noted in his comment.

Testing)

# Although this library links Foundation on all platforms, it only does so using
Expand All @@ -35,6 +36,7 @@ endif()
# interface, because Foundation does not have Library Evolution enabled for all
# platforms.
target_compile_options(_Testing_Foundation PRIVATE
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:_Testing_Foundation,Swift_MODULE_DIRECTORY>/_Testing_Foundation.swiftinterface)
-emit-module-interface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a stylistic change, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after the indentation for the conditional, yes.

-emit-module-interface-path $<TARGET_PROPERTY:_Testing_Foundation,Swift_MODULE_DIRECTORY>/_Testing_Foundation.swiftinterface)

_swift_testing_install_target(_Testing_Foundation)
10 changes: 7 additions & 3 deletions Sources/Overlays/_Testing_WinSDK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
ReexportTesting.swift)

target_link_libraries(_Testing_WinSDK PUBLIC
_TestingInternals
Testing)

target_compile_options(_Testing_WinSDK PRIVATE
-enable-library-evolution
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:_Testing_WinSDK,Swift_MODULE_DIRECTORY>/_Testing_WinSDK.swiftinterface)
if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION)
target_compile_options(_Testing_WinSDK PRIVATE
-enable-library-evolution
-emit-module-interface
-emit-module-interface-path $<TARGET_PROPERTY:_Testing_WinSDK,Swift_MODULE_DIRECTORY>/_Testing_WinSDK.swiftinterface)
endif()

_swift_testing_install_target(_Testing_WinSDK)
endif()
10 changes: 7 additions & 3 deletions Sources/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ if(NOT BUILD_SHARED_LIBS)
endif()
add_dependencies(Testing
TestingMacros)
target_compile_options(Testing PRIVATE
-enable-library-evolution
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:Testing,Swift_MODULE_DIRECTORY>/Testing.swiftinterface)

if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this module needs a .swiftinterface even without library evolution, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swift interface is not generated without library evolution AFAIK. @etcwilde?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swift interfaces are invalid without library evolution. Swift can't describe struct layouts and the interface doesn't include all properties resulting in ABI issues without library evolution.

target_compile_options(Testing PRIVATE
-enable-library-evolution
-emit-module-interface
-emit-module-interface-path $<TARGET_PROPERTY:Testing,Swift_MODULE_DIRECTORY>/Testing.swiftinterface)
endif()

_swift_testing_install_target(Testing)

Expand Down
9 changes: 6 additions & 3 deletions Sources/_TestDiscovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ add_library(_TestDiscovery STATIC
target_link_libraries(_TestDiscovery PRIVATE
_TestingInternals)

target_compile_options(_TestDiscovery PRIVATE
-enable-library-evolution
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:_TestDiscovery,Swift_MODULE_DIRECTORY>/_TestDiscovery.swiftinterface)
if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION)
target_compile_options(_TestDiscovery PRIVATE
-enable-library-evolution
-emit-module-interface
-emit-module-interface-path $<TARGET_PROPERTY:_TestDiscovery,Swift_MODULE_DIRECTORY>/_TestDiscovery.swiftinterface)
endif()
set(CMAKE_STATIC_LIBRARY_PREFIX_Swift "lib")

_swift_testing_install_target(_TestDiscovery)
Expand Down
12 changes: 9 additions & 3 deletions cmake/modules/SwiftModuleInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ function(_swift_testing_install_target module)
install(FILES $<TARGET_PROPERTY:${module},Swift_MODULE_DIRECTORY>/${module_name}.swiftdoc
DESTINATION "${module_dir}"
RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftdoc)
install(FILES $<TARGET_PROPERTY:${module},Swift_MODULE_DIRECTORY>/${module_name}.swiftinterface
DESTINATION "${module_dir}"
RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftinterface)
if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION)
install(FILES $<TARGET_PROPERTY:${module},Swift_MODULE_DIRECTORY>/${module_name}.swiftinterface
DESTINATION "${module_dir}"
RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftinterface)
else()
install(FILES $<TARGET_PROPERTY:${module},Swift_MODULE_DIRECTORY>/${module_name}.swiftmodule
DESTINATION "${module_dir}"
RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftmodule)
endif()
endfunction()

# Install the specified .swiftcrossimport directory for the specified declaring
Expand Down