|
28 | 28 | # Catalyst Support
|
29 | 29 | # -- Will need shadow invocations to generate swiftmodules for Swift parts
|
30 | 30 | # Install *.abi.json, swiftdoc, and swiftsourceinfo
|
| 31 | +# Pointer bounds (SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS) |
31 | 32 |
|
32 | 33 | cmake_minimum_required(VERSION 3.26...3.29)
|
33 | 34 |
|
| 35 | +set(CMAKE_C_VISIBILITY_PRESET "hidden") |
| 36 | +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") |
| 37 | + |
34 | 38 | set(SwiftCore_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
|
35 | 39 | list(APPEND CMAKE_MODULE_PATH ${SwiftCore_CMAKE_MODULES_DIR})
|
| 40 | + |
36 | 41 | include(CMakeWorkarounds)
|
37 | 42 | project(SwiftCore LANGUAGES C CXX Swift VERSION 6.1)
|
38 | 43 |
|
@@ -74,22 +79,42 @@ defaulted_option(SwiftCore_ENABLE_VECTOR_TYPES "Enable vector support")
|
74 | 79 | defaulted_option(SwiftCore_ENABLE_REFLECTION "Enable runtime support for mirrors and reflection support")
|
75 | 80 | defaulted_option(SwiftCore_ENABLE_COMMANDLINE_SUPPORT "Enable command line argument support")
|
76 | 81 | defaulted_option(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS "Enable runtime function counter support")
|
| 82 | +defaulted_option(SwiftCore_ENABLE_STDIN "Enable functions that use stdin support") |
| 83 | +defaulted_option(SwiftCore_ENABLE_ENVIRONMENT "Enable environment variable support") |
| 84 | +defaulted_option(SwiftCore_ENABLE_OVERRIDABLE_RETAIN_RELEASE "Enable override hooks for retain/release") |
| 85 | +defaulted_option(SwiftCore_ENABLE_MALLOC_TYPE "Enable malloc type information") |
| 86 | +defaulted_option(SwiftCore_ENABLE_RUNTIME_OS_VERSIONING "Enable runtime OS version detection") |
| 87 | +defaulted_option(SwiftCore_ENABLE_STATIC_PRINT "Disable full print") |
| 88 | +defaulted_option(SwiftCore_ENABLE_UNICODE_DATA "Embed Unicode info in Swift Core") |
| 89 | +defaulted_option(SwiftCore_ENABLE_COMPACT_ABSOLUTE_FUNCTION_POINTERS "Resolve absolute function pointer as identity") |
| 90 | +defaulted_option(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT "Add symbols for runtime backdeployment") |
77 | 91 |
|
78 | 92 | defaulted_option(SwiftCore_ENABLE_BACKTRACING "Enable backtracing runtime support")
|
79 | 93 | defaulted_set(SwiftCore_BACKTRACER_PATH STRING "Set a fixed path to the Swift backtracer")
|
80 | 94 |
|
81 | 95 | option(SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS "" OFF)
|
82 | 96 | option(SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER "" OFF)
|
| 97 | +option(SwiftCore_ENABLE_INTERNAL_CHECKS "" OFF) |
83 | 98 |
|
84 | 99 | defaulted_set(SwiftCore_OBJECT_FORMAT STRING "Object format: ELF COFF")
|
85 | 100 |
|
| 101 | +# TODO: Most of these should be attached to specific targets rather than applied |
| 102 | +# globally. They can be applied as part of the library interface if they |
| 103 | +# affect the behavior of libraries that build against a given target. |
86 | 104 | add_compile_definitions(
|
87 | 105 | $<$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>:-DSWIFT_OBJC_INTEROP>
|
88 | 106 | $<$<BOOL:${SwiftCore_ENABLE_LIBRARY_EVOLUTION}>:-DSWIFT_LIBRARY_EVOLUTION>
|
89 | 107 | $<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>
|
90 | 108 | $<$<BOOL:${SwiftCore_ENABLE_VECTOR_TYPES}>:-DSWIFT_STDLIB_ENABLE_VECTOR_TYPES>
|
91 | 109 | $<$<BOOL:${SwiftCore_ENABLE_REFLECTION}>:-DSWIFT_ENABLE_REFLECTION>
|
92 | 110 | $<$<BOOL:${SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS}>:-DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS>
|
| 111 | + $<$<BOOL:${SwiftCore_ENABLE_STDIN}>:-DSWIFT_STDLIB_HAS_STDIN> # core + stubs |
| 112 | + $<$<BOOL:${SwiftCore_ENABLE_RUNTIME_OS_VERSIONING}>:-DSWIFT_RUNTIME_OS_VERSIONING> # core + stubs |
| 113 | + $<$<BOOL:${SwiftCore_ENABLE_INTERNAL_CHECKS}>:-DINTERNAL_CHECKS_ENABLED> # core |
| 114 | + $<$<BOOL:${SwiftCore_ENABLE_STATIC_PRINT}>:-DSWIFT_STDLIB_STATIC_PRINT> # core + concurrency |
| 115 | + $<$<BOOL:${SwiftCore_ENABLE_UNICODE_DATA}>:-DSWIFT_STDLIB_ENABLE_UNICODE_DATA> # Stubs |
| 116 | + $<$<BOOL:${SwiftCore_ENABLE_ENVIRONMENT}>:-DSWIFT_STDLIB_HAS_ENVIRON> # Concurrency, runtime, shims, platform overlay |
| 117 | + $<$<BOOL:${SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT}>:-DSWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT> # Concurrency, Compatibility override, magic symbols |
93 | 118 | $<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER=$<BOOL:${SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER}>>
|
94 | 119 | $<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>>)
|
95 | 120 |
|
|
0 commit comments