Skip to content

Runtimes: introduce SwiftOnoneSupport #78726

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

Merged
merged 2 commits into from
Feb 13, 2025
Merged
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
5 changes: 5 additions & 0 deletions Runtimes/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ option(SwiftCore_INSTALL_NESTED_SUBDIR "Install libraries under a platform and a
set(SwiftCore_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>$<$<BOOL:${SwiftCore_INSTALL_NESTED_SUBDIR}>:/${SwiftCore_PLATFORM_SUBDIR}/${SwiftCore_ARCH_SUBDIR}>")
set(SwiftCore_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>$<$<BOOL:${SwiftCore_INSTALL_NESTED_SUBDIR}>:/${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.
Expand Down Expand Up @@ -193,3 +195,6 @@ add_subdirectory(runtime)
add_subdirectory(stubs)
add_subdirectory(CommandLineSupport)
add_subdirectory(core)
if(SwiftCore_ENABLE_ONONESUPPORT)
add_subdirectory(SwiftOnoneSupport)
endif()
45 changes: 45 additions & 0 deletions Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<$<COMPILE_LANGUAGE:Swift>:-parse-stdlib>
"$<$<COMPILE_LANGUAGE:Swift>: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
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -validate-tbd-against-ir=none>"

"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -check-onone-completeness>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-access-control>")

target_compile_definitions(swiftSwiftOnoneSupport PRIVATE
$<$<COMPILE_LANGUAGE:C,CXX>:-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)
2 changes: 2 additions & 0 deletions Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
8 changes: 2 additions & 6 deletions Runtimes/Resync.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down