mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
CMake: option to disable swift in swift
Adding `SWIFT_ENABLE_SWIFT_IN_SWIFT` option to enable or disable the parts of Swift that require a Swift compiler to build. This is meant for bootstrapping compilers on new platforms and is not guaranteed to result in a compiler that will pass the test suite. This option is on by default so that folks won't forget. If the option is off, the resulting compiler does not include the Swift optimizer sources in SwiftCompilerSources nor does the resulting compiler have swift macro support.
This commit is contained in:
@@ -856,7 +856,12 @@ function(_compile_swift_files
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(HOST_EXECUTABLE_SUFFIX .exe)
|
||||
endif()
|
||||
if(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
|
||||
if(NOT SWIFT_ENABLE_SWIFT_IN_SWIFT)
|
||||
# This is only for bootstrapping purposes. The just-built Swift is very
|
||||
# limited and only built for the builder to build the next stages with
|
||||
# hosttools.
|
||||
set(swift_compiler_tool "${Swift_BINARY_DIR}/bin/swiftc")
|
||||
elseif(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER)
|
||||
if(SWIFT_PREBUILT_SWIFT)
|
||||
set(swift_compiler_tool "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc${HOST_EXECUTABLE_SUFFIX}")
|
||||
elseif(CMAKE_Swift_COMPILER)
|
||||
@@ -886,8 +891,10 @@ function(_compile_swift_files
|
||||
# cross-compiling the compiler.
|
||||
list(APPEND swift_compiler_tool_dep "swift-frontend${target_suffix}")
|
||||
|
||||
# If we aren't cross compiling, also depend on SwiftMacros.
|
||||
list(APPEND swift_compiler_tool_dep SwiftMacros)
|
||||
if(SWIFT_ENABLE_SWIFT_IN_SWIFT)
|
||||
# If we aren't cross compiling, also depend on SwiftMacros.
|
||||
list(APPEND swift_compiler_tool_dep SwiftMacros)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If there are more than one output files, we assume that they are specified
|
||||
|
||||
Reference in New Issue
Block a user