diff --git a/CMakeLists.txt b/CMakeLists.txt index 38aeda617..df997572f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,14 @@ option(SwiftTesting_INSTALL_NESTED_SUBDIR "Install libraries under a platform an set(SwiftTesting_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/${SwiftTesting_PLATFORM_SUBDIR}$<$,$>>:/testing>$<$:/${SwiftTesting_ARCH_SUBDIR}>") set(SwiftTesting_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>/${SwiftTesting_PLATFORM_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($<$:-no-toolchain-stdlib-rpath>) add_subdirectory(Sources) diff --git a/Sources/Overlays/_Testing_Foundation/CMakeLists.txt b/Sources/Overlays/_Testing_Foundation/CMakeLists.txt index 9343960ab..612d0f4a6 100644 --- a/Sources/Overlays/_Testing_Foundation/CMakeLists.txt +++ b/Sources/Overlays/_Testing_Foundation/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(_Testing_Foundation ReexportTesting.swift) target_link_libraries(_Testing_Foundation PUBLIC + _TestingInternals Testing) # Although this library links Foundation on all platforms, it only does so using @@ -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 $/_Testing_Foundation.swiftinterface) + -emit-module-interface + -emit-module-interface-path $/_Testing_Foundation.swiftinterface) _swift_testing_install_target(_Testing_Foundation) diff --git a/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt index 4dcbc706e..6a1750a23 100644 --- a/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt +++ b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt @@ -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 $/_Testing_WinSDK.swiftinterface) + if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION) + target_compile_options(_Testing_WinSDK PRIVATE + -enable-library-evolution + -emit-module-interface + -emit-module-interface-path $/_Testing_WinSDK.swiftinterface) + endif() _swift_testing_install_target(_Testing_WinSDK) endif() diff --git a/Sources/Testing/CMakeLists.txt b/Sources/Testing/CMakeLists.txt index d2cd21ab9..83cfc7b8d 100644 --- a/Sources/Testing/CMakeLists.txt +++ b/Sources/Testing/CMakeLists.txt @@ -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 $/Testing.swiftinterface) + +if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION) + target_compile_options(Testing PRIVATE + -enable-library-evolution + -emit-module-interface + -emit-module-interface-path $/Testing.swiftinterface) +endif() _swift_testing_install_target(Testing) diff --git a/Sources/_TestDiscovery/CMakeLists.txt b/Sources/_TestDiscovery/CMakeLists.txt index 7d6059792..9d0eec68c 100644 --- a/Sources/_TestDiscovery/CMakeLists.txt +++ b/Sources/_TestDiscovery/CMakeLists.txt @@ -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 $/_TestDiscovery.swiftinterface) +if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION) + target_compile_options(_TestDiscovery PRIVATE + -enable-library-evolution + -emit-module-interface + -emit-module-interface-path $/_TestDiscovery.swiftinterface) +endif() set(CMAKE_STATIC_LIBRARY_PREFIX_Swift "lib") _swift_testing_install_target(_TestDiscovery) diff --git a/cmake/modules/SwiftModuleInstallation.cmake b/cmake/modules/SwiftModuleInstallation.cmake index f9bade57d..c073cd8bc 100644 --- a/cmake/modules/SwiftModuleInstallation.cmake +++ b/cmake/modules/SwiftModuleInstallation.cmake @@ -26,9 +26,15 @@ function(_swift_testing_install_target module) install(FILES $/${module_name}.swiftdoc DESTINATION "${module_dir}" RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftdoc) - install(FILES $/${module_name}.swiftinterface - DESTINATION "${module_dir}" - RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftinterface) + if(SwiftTesting_ENABLE_LIBRARY_EVOLUTION) + install(FILES $/${module_name}.swiftinterface + DESTINATION "${module_dir}" + RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftinterface) + else() + install(FILES $/${module_name}.swiftmodule + DESTINATION "${module_dir}" + RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftmodule) + endif() endfunction() # Install the specified .swiftcrossimport directory for the specified declaring