Skip to content

Commit 4133e38

Browse files
committed
Configure CMake to build and install the Foundation cross-import overlay
1 parent f2ea716 commit 4133e38

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

Sources/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ endif()
104104
include(AvailabilityDefinitions)
105105
include(CompilerSettings)
106106
add_subdirectory(_TestingInternals)
107+
add_subdirectory(Overlays)
107108
add_subdirectory(Testing)

Sources/Overlays/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This source file is part of the Swift.org open source project
2+
#
3+
# Copyright (c) 2024 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_subdirectory(_Testing_Foundation)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This source file is part of the Swift.org open source project
2+
#
3+
# Copyright (c) 2024 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
add_library(_Testing_Foundation
10+
Attachments/EncodingFormat.swift
11+
Attachments/Attachment+URL.swift
12+
Attachments/Attachable+NSSecureCoding.swift
13+
Attachments/Data+Attachable.swift
14+
Attachments/Attachable+Encodable+NSSecureCoding.swift
15+
Attachments/Attachable+Encodable.swift
16+
Events/Clock+Date.swift
17+
ReexportTesting.swift)
18+
19+
target_link_libraries(_Testing_Foundation PUBLIC
20+
Testing
21+
Foundation)
22+
23+
target_compile_options(_Testing_Foundation PRIVATE
24+
-enable-library-evolution
25+
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:_Testing_Foundation,Swift_MODULE_DIRECTORY>/_Testing_Foundation.swiftinterface)
26+
27+
_swift_testing_install_target(_Testing_Foundation)

Sources/Testing/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,7 @@ target_compile_options(Testing PRIVATE
125125
-emit-module-interface -emit-module-interface-path $<TARGET_PROPERTY:Testing,Swift_MODULE_DIRECTORY>/Testing.swiftinterface)
126126

127127
_swift_testing_install_target(Testing)
128+
129+
# Install the Swift cross-import overlay directory.
130+
_swift_testing_install_swiftcrossimport(Testing
131+
Testing.swiftcrossimport)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version: 1
2+
modules:
3+
- name: _Testing_Foundation

cmake/modules/SwiftModuleInstallation.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,23 @@ function(_swift_testing_install_target module)
9696
RENAME ${SwiftTesting_MODULE_TRIPLE}.swiftinterface)
9797
endif()
9898
endfunction()
99+
100+
# Install the specified .swiftcrossimport directory for the specified declaring
101+
# module.
102+
#
103+
# Usage:
104+
# _swift_testing_install_swiftcrossimport(module swiftcrossimport_dir)
105+
#
106+
# Arguments:
107+
# module: The name of the declaring module. This is used to determine where
108+
# the .swiftcrossimport directory should be installed, since it must be
109+
# adjacent to the declaring module's .swiftmodule directory.
110+
# swiftcrossimport_dir: The path to the source .swiftcrossimport directory
111+
# which will be installed.
112+
function(_swift_testing_install_swiftcrossimport module swiftcrossimport_dir)
113+
get_target_property(type ${module} TYPE)
114+
get_swift_testing_install_lib_dir(${type} lib_destination_dir)
115+
116+
install(DIRECTORY "${swiftcrossimport_dir}"
117+
DESTINATION "${lib_destination_dir}")
118+
endfunction()

0 commit comments

Comments
 (0)