diff --git a/Runtimes/Core/CMakeLists.txt b/Runtimes/Core/CMakeLists.txt index 54c25b0bbb5aa..a69845cb0dbe6 100644 --- a/Runtimes/Core/CMakeLists.txt +++ b/Runtimes/Core/CMakeLists.txt @@ -118,6 +118,8 @@ option(SwiftCore_INSTALL_NESTED_SUBDIR "Install libraries under a platform and a set(SwiftCore_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>$<$:/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}>") set(SwiftCore_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>$<$:/${SwiftCore_PLATFORM_SUBDIR}>") +option(SwiftCore_ENABLE_ONONESUPPORT "Enable Onone Support" YES) + # TODO: Most of these should be attached to specific targets rather than applied # globally. They can be applied as part of the library interface if they # affect the behavior of libraries that build against a given target. @@ -193,3 +195,6 @@ add_subdirectory(runtime) add_subdirectory(stubs) add_subdirectory(CommandLineSupport) add_subdirectory(core) +if(SwiftCore_ENABLE_ONONESUPPORT) + add_subdirectory(SwiftOnoneSupport) +endif() diff --git a/Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt b/Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt new file mode 100644 index 0000000000000..c7437d94ea8b6 --- /dev/null +++ b/Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt @@ -0,0 +1,45 @@ +add_library(swiftSwiftOnoneSupport + SwiftOnoneSupport.swift + "${PROJECT_SOURCE_DIR}/linker-support/magic-symbols-for-install-name.c") + +set_target_properties(swiftSwiftOnoneSupport PROPERTIES + Swift_MODULE_NAME SwiftOnoneSupport) + +if(APPLE AND BUILD_SHARED_LIBS) + target_link_options(swiftSwiftOnoneSupport PRIVATE "SHELL:-Xlinker -headerpad_max_install_names") +endif() + +target_compile_options(swiftSwiftOnoneSupport PRIVATE + $<$:-parse-stdlib> + "$<$:SHELL:-Xllvm -sil-inline-generics=false>" + + # We have to disable validation of TBD files, because this module is + # _explicitly_ special-cased to result in extra symbols generated by the + # optimizer, meaning TBDGen can't (and shouldn't: it has to run + # pre-optimization for performance) list them. + # See also caa3dd4d291ec93c1a59f1db62604e703bff8468 + "$<$:SHELL:-Xfrontend -validate-tbd-against-ir=none>" + + "$<$:SHELL:-Xfrontend -check-onone-completeness>" + "$<$:SHELL:-Xfrontend -disable-access-control>") + +target_compile_definitions(swiftSwiftOnoneSupport PRIVATE + $<$:-DSWIFT_TARGET_LIBRARY_NAME=swiftSwiftOnoneSupport>) + +target_link_libraries(swiftSwiftOnoneSupport + PRIVATE + swiftShims + swiftCore) + +install(TARGETS swiftSwiftOnoneSupport + ARCHIVE DESTINATION "${SwiftCore_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${SwiftCore_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SwiftOnoneSupport.swiftmodule" + DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/SwiftOnoneSupport.swiftmodule" + RENAME "${SwiftCore_MODULE_TRIPLE}.swiftmodule") +emit_swift_interface(swiftSwiftOnoneSupport) +install_swift_interface(swiftSwiftOnoneSupport) + +# Configure plist creation for Darwin platforms. +generate_plist("${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_VERSION}" swiftSwiftOnoneSupport) diff --git a/Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake b/Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake index b5a335cc4f4e0..803d26a1b1239 100644 --- a/Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake +++ b/Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake @@ -13,6 +13,8 @@ set(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS ON CACHE BOOL "") set(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT ON CACHE BOOL "") set(SwiftCore_ENABLE_FILESYSTEM_SUPPORT ON CACHE BOOL "") +set(SwiftCore_ENABLE_ONONESUPPORT OFF CACHE BOOL "") + set(SwiftCore_INSTALL_NESTED_SUBDIR OFF CACHE BOOL "") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -g -DNDEBUG" CACHE STRING "") diff --git a/Runtimes/Resync.cmake b/Runtimes/Resync.cmake index 2fb3584ab6bce..c412b17197626 100644 --- a/Runtimes/Resync.cmake +++ b/Runtimes/Resync.cmake @@ -78,15 +78,11 @@ set(CoreLibs CompatibilityOverride stubs CommandLineSupport - core) + core + SwiftOnoneSupport) # Add these as we get them building - # core - # Concurrency - # SwiftOnoneSUpport - # CommandLineSupport # Demangling - # runtime) foreach(library ${CoreLibs}) copy_library_sources(${library} "public" "Core")