forked from swiftlang/swift-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: initial support for building with CMake
Add support for building with CMake which is required to get the toolchain bootstrapped. This partially addresses swiftlang#7.
- Loading branch information
Showing
20 changed files
with
732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
cmake_minimum_required(VERSION 3.26...3.29) | ||
project(SwiftBuild | ||
LANGUAGES C CXX Swift) | ||
|
||
set(CMAKE_C_VISIBILITY hidden) | ||
set(CMAKE_CXX_VISIBILITY hidden) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED YES) | ||
set(CMAKE_CXX_EXTENSIONS NO) | ||
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES) | ||
|
||
option(SwiftBuild_USE_LLBUILD_FRAMEWORK "Use LLBuild Framework" NO) | ||
|
||
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-package-name SwiftBuild>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature ConciseMagicFile>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature DeprecateApplicationMain>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature DisableOutwardActorInference>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature ForwardTrailingClosures>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature GlobalConcurrency>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature ImplicitOpenExistentials>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature ImplicitOpenExistentialsImportObjcForwardDeclarations>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature InferSendableFromCaptures>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature IsolatedDefaultValues>" | ||
# rdar://127809703 | ||
# "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature RegionBasedIsolation>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature ExistentialAny>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature InternalImportsByDefault>") | ||
|
||
find_package(ArgumentParser) | ||
find_package(LLBuild) | ||
find_package(SwiftDriver) | ||
find_package(SwiftSystem) | ||
find_package(TSC) | ||
# NOTE: these two are required for LLBuild dependencies | ||
find_package(Threads) | ||
find_package(SQLite3) | ||
|
||
add_subdirectory(Sources/SWBMacro) | ||
add_subdirectory(Sources/SWBCore) | ||
add_subdirectory(Sources/SWBServiceCore) | ||
add_subdirectory(Sources/SWBBuildSystem) | ||
add_subdirectory(Sources/SWBTaskExecution) | ||
add_subdirectory(Sources/SWBBuildService) | ||
add_subdirectory(Sources/SWBCAS) | ||
add_subdirectory(Sources/SWBCSupport) | ||
add_subdirectory(Sources/SWBCLibc) | ||
add_subdirectory(Sources/SWBLibc) | ||
add_subdirectory(Sources/SWBLLBuild) | ||
add_subdirectory(Sources/SWBProjectModel) | ||
add_subdirectory(Sources/SWBProtocol) | ||
add_subdirectory(Sources/SWBTaskConstruction) | ||
add_subdirectory(Sources/SWBUtil) | ||
add_subdirectory(Sources/SwiftBuild) | ||
|
||
add_subdirectory(Sources/swbuild) | ||
add_subdirectory(Sources/SWBBuildServiceBundle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
add_library(SWBBuildService | ||
BuildDependencyInfo.swift | ||
BuildOperationMessages.swift | ||
BuildService.swift | ||
BuildServiceEntryPoint.swift | ||
ClientExchangeDelegate.swift | ||
DependencyGraphMessages.swift | ||
DocumentationInfo.swift | ||
LocalizationInfo.swift | ||
Messages.swift | ||
PlanningOperation.swift | ||
PreviewInfo.swift | ||
ProjectDescriptor.swift | ||
Session.swift | ||
Tools.swift) | ||
set_target_properties(SWBBuildService PROPERTIES | ||
Swift_LANGUAGE_VERSION 5) | ||
target_link_libraries(SWBBuildService PUBLIC | ||
SWBBuildSystem | ||
SWBServiceCore | ||
SWBTaskExecution | ||
SwiftSystem::SystemPackage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
add_executable(SWBBuildServiceBundle | ||
main.swift) | ||
set_target_properties(SWBBuildServiceBundle PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBBuildServiceBundle PRIVATE | ||
SWBBuildService | ||
SWBBuildSystem | ||
SWBServiceCore | ||
SWBUtil | ||
SWBCore) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
add_library(SWBBuildSystem | ||
BuildManager.swift | ||
BuildOperation.swift | ||
BuildOperationExtension.swift | ||
BuildSystemCache.swift | ||
CleanOperation.swift | ||
DependencyCycleFormatter.swift | ||
SandboxViolations.swift) | ||
set_target_properties(SWBBuildSystem PROPERTIES | ||
Swift_LANGUAGE_VERSION 5) | ||
target_link_libraries(SWBBuildSystem PUBLIC | ||
SWBCore | ||
SWBTaskConstruction | ||
SWBTaskExecution) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
add_library(SWBCAS | ||
CASFSNode.swift | ||
CASProtocol.swift | ||
Errors.swift | ||
plugin_api_t.swift | ||
ToolchainCASPlugin.swift) | ||
set_target_properties(SWBCAS PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBCAS PUBLIC | ||
SWBUtil | ||
SWBCSupport) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
add_library(SWBCLibc | ||
libc.c) | ||
target_include_directories(SWBCLibc INTERFACE | ||
include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
add_library(SWBCSupport STATIC | ||
CLibclang.cpp | ||
CLibRemarksHelper.c) | ||
target_compile_definitions(SWBCSupport PRIVATE | ||
$<$<PLATFORM_ID:Windows>:_CRT_SECURE_NO_WARNINGS> | ||
$<$<PLATFORM_ID:Windows>:_CRT_NONSTDC_NO_WARNINGS>) | ||
target_compile_options(SWBCSupport PRIVATE | ||
-fblocks) | ||
target_include_directories(SWBCSupport PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}) | ||
# TODO(compnerd) wire this up with `find_package` | ||
target_link_libraries(SWBCSupport PRIVATE | ||
BlocksRuntime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module SWBCSupport { | ||
header "SWBCSupport.h" | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
|
||
add_library(SWBCore | ||
ActivityReporting.swift | ||
Apple/DeviceFamily.swift | ||
Apple/InterfaceBuilderShared.swift | ||
BuildFileFilteringContext.swift | ||
BuildFileResolution.swift | ||
BuildParameters.swift | ||
BuildRequest.swift | ||
BuildRequestContext.swift | ||
BuildRuleAction.swift | ||
BuildRuleCondition.swift | ||
BuildRuleSet.swift | ||
CapturedBuildInfo.swift | ||
ClangModuleVerifier/ModuleVerifierFilenameMap.swift | ||
ClangModuleVerifier/ModuleVerifierFramework.swift | ||
ClangModuleVerifier/ModuleVerifierHeader.swift | ||
ClangModuleVerifier/ModuleVerifierLanguage.swift | ||
ClangModuleVerifier/ModuleVerifierModuleMap.swift | ||
ClangModuleVerifier/ModuleVerifierModuleMapFileVerifier.swift | ||
ClangModuleVerifier/ModuleVerifierTarget.swift | ||
ClangModuleVerifierOutputParser.swift | ||
ClangSerializedDiagnostics.swift | ||
CommandLineArgument.swift | ||
ConfiguredTarget.swift | ||
Core.swift | ||
CustomTaskTypeDescription.swift | ||
DependencyInfoEditPayload.swift | ||
DependencyResolution.swift | ||
DiagnosticSupport.swift | ||
EnvironmentBindings.swift | ||
ExecutableTask.swift | ||
Extensions/DiagnosticToolingExtension.swift | ||
Extensions/EnvironmentExtension.swift | ||
Extensions/FeatureAvailabilityExtension.swift | ||
Extensions/InputFileGroupingStrategyExtension.swift | ||
Extensions/PlatformInfoExtension.swift | ||
Extensions/SDKRegistryExtension.swift | ||
Extensions/SDKVariantInfoExtension.swift | ||
Extensions/SettingsBuilderExtension.swift | ||
Extensions/SpecificationsExtension.swift | ||
Extensions/ToolchainRegistryExtension.swift | ||
FileSystemSignatureBasedCache.swift | ||
FileToBuild.swift | ||
KnownFolders.swift | ||
LibclangVendored/ArrayExtensions.swift | ||
LibclangVendored/CStringArray.swift | ||
LibclangVendored/Libclang.swift | ||
LibSwiftDriver/LibSwiftDriver.swift | ||
LibSwiftDriver/PlannedBuild.swift | ||
LinkageDependencyResolver.swift | ||
MacCatalystInfo.swift | ||
MacroConfigFileLoader.swift | ||
MacroEvaluationExtensions.swift | ||
MacroExpressionSourceExtensions.swift | ||
MissingFrameworkDiagnostics.swift | ||
OnDemandResources.swift | ||
OptimizationRemarks.swift | ||
PlannedNode.swift | ||
PlannedTask.swift | ||
PlannedTaskAction.swift | ||
PlatformEnvironment.swift | ||
PlatformFiltering.swift | ||
PlatformRegistry.swift | ||
Process.swift | ||
ProcessExecutionCache.swift | ||
ProductTypeIdentifier.swift | ||
ProjectModel/BuildConfiguration.swift | ||
ProjectModel/BuildFile.swift | ||
ProjectModel/BuildPhase.swift | ||
ProjectModel/BuildRule.swift | ||
ProjectModel/DependencyInfoFormat.swift | ||
ProjectModel/FilePathResolver.swift | ||
ProjectModel/FileTextEncoding.swift | ||
ProjectModel/ImpartedBuildProperties.swift | ||
ProjectModel/PIFLoader.swift | ||
ProjectModel/PlatformFilter.swift | ||
ProjectModel/Project.swift | ||
ProjectModel/ProjectModelItem.swift | ||
ProjectModel/Reference.swift | ||
ProjectModel/ReferenceLookupContext.swift | ||
ProjectModel/Target.swift | ||
ProjectModel/Workspace.swift | ||
ProjectModel/WorkspaceHeaderIndex.swift | ||
ProvisionalTask.swift | ||
Provisioning.swift | ||
ProvisioningTaskInputs.swift | ||
SDKRegistry.swift | ||
Settings/BuildRuleFile.swift | ||
Settings/BuiltinMacros.swift | ||
Settings/CASOptions.swift | ||
Settings/RecursiveSearchPathResolver.swift | ||
Settings/Settings.swift | ||
Settings/StackedSearchPaths.swift | ||
ShellScript.swift | ||
SigningSupport.swift | ||
Specs/CommandLineToolSpec.swift | ||
Specs/CompilerSpec.swift | ||
Specs/CoreBuildSystem.xcspec | ||
Specs/ExternalBuildSystem.xcspec | ||
Specs/FileTypes.swift | ||
Specs/LinkerSpec.swift | ||
Specs/NativeBuildSystem.xcspec | ||
Specs/ProductTypes.swift | ||
Specs/PropertyDomainSpec.swift | ||
Specs/RegisterSpecs.swift | ||
Specs/SpecParser.swift | ||
Specs/SpecRegistry.swift | ||
Specs/Specs.swift | ||
Specs/Tools/AppIntentsMetadataCompiler.swift | ||
Specs/Tools/AppIntentsSSUTrainingCompiler.swift | ||
Specs/Tools/AppShortcutStringsMetadataCompiler.swift | ||
Specs/Tools/CCompiler.swift | ||
Specs/Tools/ClangModuleVerifierInputGenerator.swift | ||
Specs/Tools/ClangStatCache.swift | ||
Specs/Tools/CodeSign.swift | ||
Specs/Tools/ConcatenateTool.swift | ||
Specs/Tools/ConstructStubExecutorFileListTool.swift | ||
Specs/Tools/CopyTool.swift | ||
Specs/Tools/CreateAssetPackManifestTool.swift | ||
Specs/Tools/CreateBuildDirectory.swift | ||
Specs/Tools/DocumentationCompiler.swift | ||
Specs/Tools/DsymutilTool.swift | ||
Specs/Tools/Gate.swift | ||
Specs/Tools/GCCCompatibleCompilerSupport.swift | ||
Specs/Tools/GenerateAppPlaygroundAssetCatalog.swift | ||
Specs/Tools/InfoPlistTool.swift | ||
Specs/Tools/LaunchServicesRegisterTool.swift | ||
Specs/Tools/LinkerTools.swift | ||
Specs/Tools/Lipo.swift | ||
Specs/Tools/MasterObjectLink.swift | ||
Specs/Tools/MergeInfoPlist.swift | ||
Specs/Tools/MkdirTool.swift | ||
Specs/Tools/ModulesVerifierTool.swift | ||
Specs/Tools/PLUtilTool.swift | ||
Specs/Tools/ProcessXCFrameworkLibrary.swift | ||
Specs/Tools/ProductPackaging.swift | ||
Specs/Tools/RegisterExecutionPolicyException.swift | ||
Specs/Tools/SetAttributes.swift | ||
Specs/Tools/ShellScriptTool.swift | ||
Specs/Tools/SignatureCollection.swift | ||
Specs/Tools/StripTool.swift | ||
Specs/Tools/SwiftABICheckerTool.swift | ||
Specs/Tools/SwiftABIGenerationTool.swift | ||
Specs/Tools/SwiftCompiler.swift | ||
Specs/Tools/SwiftHeaderTool.swift | ||
Specs/Tools/SwiftStdLibTool.swift | ||
Specs/Tools/SwiftSymbolExtractor.swift | ||
Specs/Tools/SymlinkTool.swift | ||
Specs/Tools/TAPISymbolExtractor.swift | ||
Specs/Tools/TAPITools.swift | ||
Specs/Tools/TiffUtilTool.swift | ||
Specs/Tools/TouchTool.swift | ||
Specs/Tools/UnifdefTool.swift | ||
Specs/Tools/ValidateDevelopmentAssets.swift | ||
Specs/Tools/ValidateEmbeddedBinaryTool.swift | ||
Specs/Tools/ValidateProductTool.swift | ||
Specs/Tools/WriteFile.swift | ||
SWBFeatureFlag.swift | ||
TargetDependencyResolver.swift | ||
TargetPlatformDiagnostics.swift | ||
TaskGeneration.swift | ||
TaskResult.swift | ||
ToolchainRegistry.swift | ||
ToolInfo/ClangToolInfo.swift | ||
Tuning.swift | ||
WorkspaceContext.swift | ||
WorkspaceSettingsCache.swift | ||
XCFramework.swift) | ||
set_target_properties(SWBCore PROPERTIES | ||
Swift_LANGUAGE_VERSION 5) | ||
target_link_libraries(SWBCore PUBLIC | ||
SWBMacro | ||
SWBProtocol | ||
SWBServiceCore | ||
SWBUtil | ||
SWBCAS | ||
SWBLLBuild | ||
SwiftDriver) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
add_library(SWBLLBuild | ||
LowLevelBuildSystem.swift) | ||
set_target_properties(SWBLLBuild PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBLLBuild PUBLIC | ||
SWBUtil | ||
$<$<NOT:$<BOOL:${SwiftBuild_USE_LLBUILD_FRAMEWORK}>>:libllbuild> | ||
$<$<NOT:$<BOOL:${SwiftBuild_USE_LLBUILD_FRAMEWORK}>>:llbuildSwift>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
add_library(SWBLibc | ||
libc.swift) | ||
set_target_properties(SWBLibc PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBLibc PUBLIC | ||
SWBCLibc) | ||
|
||
# FIXME: why is this needed? We should be wiring up the Swift_MODULE_DIRECTORY | ||
# without this explicit configuration. | ||
target_include_directories(SWBLibc PUBLIC | ||
${CMAKE_CURRENT_BINARY_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
add_library(SWBMacro | ||
MacroCondition.swift | ||
MacroConditionExpression.swift | ||
MacroConditionParameter.swift | ||
MacroConditionSet.swift | ||
MacroConfigFileDiagnostic.swift | ||
MacroConfigFileParser.swift | ||
MacroDeclaration.swift | ||
MacroEvaluationProgram.swift | ||
MacroEvaluationScope.swift | ||
MacroExpression.swift | ||
MacroExpressionDiagnostic.swift | ||
MacroExpressionParsing.swift | ||
MacroNamespace.swift | ||
MacroType.swift | ||
MacroValueAssignmentTable.swift) | ||
set_target_properties(SWBMacro PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBMacro PUBLIC | ||
SWBUtil | ||
SwiftDriver | ||
TSCBasic) | ||
|
||
target_include_directories(SWBMacro PUBLIC | ||
${CMAKE_CURRENT_BINARY_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
add_library(SWBProjectModel | ||
IDE/IDEPIFGenerating.swift | ||
IDE/IDEPIFGUID.swift | ||
IDE/IDEPIFObject.swift | ||
IDE/IDEPIFObjectInfo.swift | ||
IDE/IDEPIFSerializer.swift | ||
IDE/IDESwiftPackageExtensions.swift | ||
PIFGenerationModel.swift) | ||
set_target_properties(SWBProjectModel PROPERTIES | ||
Swift_LANGUAGE_VERSION 6) | ||
target_link_libraries(SWBProjectModel PUBLIC | ||
SWBProtocol) |
Oops, something went wrong.