Skip to content

Commit 47cec07

Browse files
committed
Foundation: restructure Foundation
1 parent ad446e8 commit 47cec07

File tree

138 files changed

+560
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+560
-317
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ target_include_directories(CoreFoundation PRIVATE
4444
${CMAKE_CURRENT_SOURCE_DIR}
4545
${CMAKE_CURRENT_BINARY_DIR}/CoreFoundation.framework/Headers)
4646

47+
# Workaround for CMake 3.15 which does not correctly link libraries on Windows
48+
if(CMAKE_VERSION VERSION_LESS 3.16)
49+
set(CMAKE_LINK_LIBRARY_FLAG "-l")
50+
endif()
51+
4752
add_subdirectory(uuid)
48-
add_subdirectory(Foundation)
4953
add_subdirectory(Sources)
5054
add_subdirectory(Tools)
5155
if(ENABLE_TESTING)

Foundation.xcodeproj/project.pbxproj

Lines changed: 538 additions & 292 deletions
Large diffs are not rendered by default.

Sources/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
add_subdirectory(Foundation)
12
add_subdirectory(FoundationNetworking)
23
add_subdirectory(FoundationXML)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Foundation/CMakeLists.txt renamed to Sources/Foundation/CMakeLists.txt

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
2-
if(CMAKE_VERSION VERSION_LESS 3.16)
3-
set(CMAKE_LINK_LIBRARY_FLAG "-l")
4-
endif()
5-
61
add_library(Foundation
72
AffineTransform.swift
83
Array.swift
@@ -140,30 +135,29 @@ target_compile_definitions(Foundation PRIVATE
140135
DEPLOYMENT_RUNTIME_SWIFT)
141136
target_compile_options(Foundation PUBLIC
142137
"SHELL:-Xcc -F${CMAKE_BINARY_DIR}")
143-
if(CMAKE_SYSTEM_NAME STREQUAL Windows AND CMAKE_VERSION VERSION_LESS 3.16)
144-
# Work around for CMake 15 which doesn't link in the resource file
145-
# target properly
146-
add_dependencies(Foundation CoreFoundationResources)
147-
target_link_options(Foundation PRIVATE $<TARGET_OBJECTS:CoreFoundationResources>)
148-
endif()
149-
if(ENABLE_TESTING)
150-
target_compile_options(Foundation PRIVATE
151-
-enable-testing)
152-
endif()
138+
target_compile_options(Foundation PRIVATE
139+
$<$<BOOL:${ENABLE_TESTING}>:-enable-testing>)
153140
target_link_libraries(Foundation PRIVATE
154141
CoreFoundation
155142
uuid)
156143
target_link_libraries(Foundation PUBLIC
157144
swiftDispatch)
158-
159145
# TODO(compnerd) properly propogate `BUILD_RPATH` to the target using CMake
160146
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
161147
target_link_options(Foundation PRIVATE
162148
"SHELL:-Xlinker -rpath -Xlinker $<TARGET_FILE_DIR:swiftDispatch>")
163149
endif()
164150
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
165-
target_link_libraries(Foundation PRIVATE
166-
CoreFoundationResources)
151+
if(CMAKE_VERSION VERSION_LESS 3.16)
152+
# Work around for CMake 3.15 which doesn't link in the resource file
153+
# target properly
154+
add_dependencies(Foundation CoreFoundationResources)
155+
target_link_options(Foundation PRIVATE
156+
$<TARGET_OBJECTS:CoreFoundationResources>)
157+
else()
158+
target_link_libraries(Foundation PRIVATE
159+
CoreFoundationResources)
160+
endif()
167161
target_link_libraries(Foundation PRIVATE
168162
Ole32
169163
Shell32
@@ -174,15 +168,13 @@ set_target_properties(Foundation PROPERTIES
174168
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
175169
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
176170

177-
178-
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
179-
Foundation)
180-
get_swift_host_arch(swift_arch)
171+
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS Foundation)
181172
install(TARGETS Foundation
182173
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
183174
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
184175
RUNTIME DESTINATION bin)
176+
get_swift_host_arch(swift_arch)
185177
install(FILES
186-
${CMAKE_BINARY_DIR}/swift/Foundation.swiftdoc
187-
${CMAKE_BINARY_DIR}/swift/Foundation.swiftmodule
178+
$<TARGET_PROPERTY:Foundation,Swift_MODULE_DIRECTORY>/Foundation.swiftdoc
179+
$<TARGET_PROPERTY:Foundation,Swift_MODULE_DIRECTORY>/Foundation.swiftmodule
188180
DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>/${swift_arch})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)