Skip to content

Commit c1257eb

Browse files
committed
Runtimes: introduce SwiftOnoneSupport
The main goal for now is to have this building, with little concern about matching the build flags used currently. Keep it disabled by default on Apple platforms. Addresses rdar://143151393
1 parent 4306b57 commit c1257eb

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ option(SwiftCore_INSTALL_NESTED_SUBDIR "Install libraries under a platform and a
118118
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}>")
119119
set(SwiftCore_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>$<$<BOOL:${SwiftCore_INSTALL_NESTED_SUBDIR}>:/${SwiftCore_PLATFORM_SUBDIR}>")
120120

121+
option(SwiftCore_ENABLE_ONONESUPPORT "Enable Onone Support" YES)
122+
121123
# TODO: Most of these should be attached to specific targets rather than applied
122124
# globally. They can be applied as part of the library interface if they
123125
# affect the behavior of libraries that build against a given target.
@@ -193,3 +195,6 @@ add_subdirectory(runtime)
193195
add_subdirectory(stubs)
194196
add_subdirectory(CommandLineSupport)
195197
add_subdirectory(core)
198+
if(SwiftCore_ENABLE_ONONESUPPORT)
199+
add_subdirectory(SwiftOnoneSupport)
200+
endif()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
add_library(swiftSwiftOnoneSupport
2+
SwiftOnoneSupport.swift
3+
"${PROJECT_SOURCE_DIR}/linker-support/magic-symbols-for-install-name.c")
4+
5+
set_target_properties(swiftSwiftOnoneSupport PROPERTIES
6+
Swift_MODULE_NAME SwiftOnoneSupport)
7+
8+
if(APPLE AND BUILD_SHARED_LIBS)
9+
target_link_options(swiftSwiftOnoneSupport PRIVATE "SHELL:-Xlinker -headerpad_max_install_names")
10+
endif()
11+
12+
target_compile_options(swiftSwiftOnoneSupport PRIVATE
13+
$<$<COMPILE_LANGUAGE:Swift>:-parse-stdlib>
14+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xllvm -sil-inline-generics=false>"
15+
16+
# We have to disable validation of TBD files, because this module is
17+
# _explicitly_ special-cased to result in extra symbols generated by the
18+
# optimizer, meaning TBDGen can't (and shouldn't: it has to run
19+
# pre-optimization for performance) list them.
20+
# See also caa3dd4d291ec93c1a59f1db62604e703bff8468
21+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -validate-tbd-against-ir=none>"
22+
23+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -check-onone-completeness>"
24+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-access-control>")
25+
26+
target_compile_definitions(swiftSwiftOnoneSupport PRIVATE
27+
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_TARGET_LIBRARY_NAME=swiftSwiftOnoneSupport>)
28+
29+
target_link_libraries(swiftSwiftOnoneSupport
30+
PRIVATE
31+
swiftShims
32+
swiftCore)
33+
34+
install(TARGETS swiftSwiftOnoneSupport
35+
ARCHIVE DESTINATION "${SwiftCore_INSTALL_LIBDIR}"
36+
LIBRARY DESTINATION "${SwiftCore_INSTALL_LIBDIR}"
37+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
38+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SwiftOnoneSupport.swiftmodule"
39+
DESTINATION "${SwiftCore_INSTALL_SWIFTMODULEDIR}/SwiftOnoneSupport.swiftmodule"
40+
RENAME "${SwiftCore_MODULE_TRIPLE}.swiftmodule")
41+
emit_swift_interface(swiftSwiftOnoneSupport)
42+
install_swift_interface(swiftSwiftOnoneSupport)
43+
44+
# Configure plist creation for Darwin platforms.
45+
generate_plist("${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_VERSION}" swiftSwiftOnoneSupport)

Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS ON CACHE BOOL "")
1313
set(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT ON CACHE BOOL "")
1414
set(SwiftCore_ENABLE_FILESYSTEM_SUPPORT ON CACHE BOOL "")
1515

16+
set(SwiftCore_ENABLE_ONONESUPPORT OFF CACHE BOOL "")
17+
1618
set(SwiftCore_INSTALL_NESTED_SUBDIR OFF CACHE BOOL "")
1719

1820
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -g -DNDEBUG" CACHE STRING "")

Runtimes/Resync.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,11 @@ set(CoreLibs
7878
CompatibilityOverride
7979
stubs
8080
CommandLineSupport
81-
core)
81+
core
82+
SwiftOnoneSupport)
8283

8384
# Add these as we get them building
84-
# core
85-
# Concurrency
86-
# SwiftOnoneSUpport
87-
# CommandLineSupport
8885
# Demangling
89-
# runtime)
9086

9187
foreach(library ${CoreLibs})
9288
copy_library_sources(${library} "public" "Core")

0 commit comments

Comments
 (0)