Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create infrastructure to separate Foundation into multiple modules; move all code into FoundationBase module. #1799

Closed
wants to merge 5 commits into from
Closed
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
52 changes: 47 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
endif()

add_swift_library(Foundation
add_swift_library(FoundationBase
MODULE_NAME
Foundation
FoundationBase
MODULE_LINK_NAME
Foundation
FoundationBase
MODULE_PATH
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftmodule
${CMAKE_CURRENT_BINARY_DIR}/swift/FoundationBase.swiftmodule
SOURCES
Foundation/AffineTransform.swift
Foundation/Array.swift
Expand Down Expand Up @@ -180,8 +180,8 @@ add_swift_library(Foundation
Foundation/NSDate.swift
Foundation/NSDecimalNumber.swift
Foundation/NSDictionary.swift
Foundation/NSEnumerator.swift
Foundation/NSError.swift
Foundation/NSEnumerator.swift
Foundation/NSExpression.swift
Foundation/NSGeometry.swift
Foundation/NSIndexPath.swift
Expand Down Expand Up @@ -301,10 +301,48 @@ add_swift_library(Foundation
DEPENDS
CoreFoundation)

add_swift_library(Foundation
MODULE_NAME
Foundation
MODULE_LINK_NAME
Foundation
MODULE_PATH
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftmodule
SOURCES
Foundation/Foundation.swift
TARGET
${CMAKE_C_COMPILER_TARGET}
CFLAGS
${deployment_target}
${deployment_enable_libdispatch}
-F${install_dir}/System/Library/Frameworks
LINK_FLAGS
-L${install_dir}/usr/lib
-L${CMAKE_CURRENT_BINARY_DIR}
-lFoundationBase
-lCoreFoundation
${CURL_LIBRARIES}
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
${LIBXML2_LIBRARIES}
${libdispatch_ldflags}
${uuid_LIBRARIES}
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN"
SWIFT_FLAGS
-DDEPLOYMENT_RUNTIME_SWIFT
${deployment_enable_libdispatch}
-I;${ICU_INCLUDE_DIR}
-I;${CMAKE_CURRENT_BINARY_DIR}/swift
${libdispatch_cflags}
${swift_enable_testing}
${swift_optimization_flags}
DEPENDS
FoundationBase)

if(NOT BUILD_SHARED_LIBS)
set(Foundation_INTERFACE_LIBRARIES
-L${install_dir}/usr/lib
-lCoreFoundation
-lFoundationBase
-L${CMAKE_CURRENT_BINARY_DIR}
-luuid
${CURL_LIBRARIES}
Expand Down Expand Up @@ -524,16 +562,20 @@ endif()
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftdoc
${CMAKE_CURRENT_BINARY_DIR}/swift/Foundation.swiftmodule
${CMAKE_CURRENT_BINARY_DIR}/swift/FoundationBase.swiftdoc
${CMAKE_CURRENT_BINARY_DIR}/swift/FoundationBase.swiftmodule
DESTINATION
lib/swift/${swift_os}/${swift_arch})
if(BUILD_SHARED_LIBS)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}Foundation${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}FoundationBase${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION
lib/swift/${swift_os})
else()
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}Foundation${CMAKE_STATIC_LIBRARY_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}FoundationBase${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION
lib/swift_static/${swift_os})
endif()
Expand Down
4 changes: 2 additions & 2 deletions CoreFoundation/Base.subproj/ForFoundationOnly.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ CF_EXPORT void *_CFCreateArrayStorage(size_t numPointers, Boolean zeroed, size_t
// --- Static class references for Swift use; implements {DECLARE_,}STATIC_CLASS_REF.

#if TARGET_OS_MAC
#define STATIC_CLASS_PREFIX $s15SwiftFoundation
#define STATIC_CLASS_PREFIX $s19SwiftFoundationBase
#else
#define STATIC_CLASS_PREFIX $s10Foundation
#define STATIC_CLASS_PREFIX $s14FoundationBase
#endif

#define STATIC_CLASS_NAME_LENGTH_LOOKUP___NSCFType 10
Expand Down
4 changes: 2 additions & 2 deletions CoreFoundation/String.subproj/CFString.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ since it is the default choice with Mac OS X developer tools.

#if DEPLOYMENT_RUNTIME_SWIFT
#if TARGET_OS_MAC
#define _CF_CONSTANT_STRING_SWIFT_CLASS $s15SwiftFoundation19_NSCFConstantStringCN
#define _CF_CONSTANT_STRING_SWIFT_CLASS $s19SwiftFoundationBase19_NSCFConstantStringCN
#else
#define _CF_CONSTANT_STRING_SWIFT_CLASS $s10Foundation19_NSCFConstantStringCN
#define _CF_CONSTANT_STRING_SWIFT_CLASS $s14FoundationBase19_NSCFConstantStringCN
#endif

CF_EXPORT void *_CF_CONSTANT_STRING_SWIFT_CLASS[];
Expand Down
Loading