-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: introduce a CMake based build
This enables building DocC as a CMake project. Doing so is motivated by toolchain build times. By using CMake instead of SPM, we see an overall reduction of ~7% in the total toolchain build time on Windows.
- Loading branch information
Showing
5 changed files
with
137 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,24 @@ | ||
#[[ | ||
This source file is part of the Swift.org open source project | ||
Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
See https://swift.org/LICENSE.txt for license information | ||
See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
#]] | ||
|
||
cmake_minimum_required(VERSION 3.24) | ||
|
||
project(SymbolKit | ||
LANGUAGES Swift) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) | ||
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) | ||
|
||
add_subdirectory(Sources) | ||
add_subdirectory(cmake/modules) |
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 @@ | ||
#[[ | ||
This source file is part of the Swift.org open source project | ||
Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
See https://swift.org/LICENSE.txt for license information | ||
See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
#]] | ||
|
||
add_subdirectory(SymbolKit) |
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,69 @@ | ||
#[[ | ||
This source file is part of the DocC open source project | ||
Copyright (c) 2024 Apple Inc. and the DocC project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_library(SymbolKit | ||
Mixin/Mixin+Equals.swift | ||
Mixin/Mixin+Hash.swift | ||
Mixin/Mixin.swift | ||
SymbolGraph/AnyScalar.swift | ||
SymbolGraph/LineList/LineList.swift | ||
SymbolGraph/LineList/SourceRange/Position.swift | ||
SymbolGraph/LineList/SourceRange/SourceRange.swift | ||
SymbolGraph/Metadata.swift | ||
SymbolGraph/Module.swift | ||
SymbolGraph/OperatingSystem.swift | ||
SymbolGraph/Platform.swift | ||
SymbolGraph/Relationship/ReferenceLocation.swift | ||
SymbolGraph/Relationship/Relationship.swift | ||
SymbolGraph/Relationship/RelationshipKind.swift | ||
SymbolGraph/Relationship/SourceOrigin.swift | ||
SymbolGraph/Relationship/Swift/GenericConstraints.swift | ||
SymbolGraph/Relationship/Swift/Swift.swift | ||
SymbolGraph/SemanticVersion.swift | ||
SymbolGraph/Symbol/AccessControl.swift | ||
SymbolGraph/Symbol/AlternateDeclarations.swift | ||
SymbolGraph/Symbol/Availability/Availability.swift | ||
SymbolGraph/Symbol/Availability/AvailabilityItem.swift | ||
SymbolGraph/Symbol/Availability/Domain.swift | ||
SymbolGraph/Symbol/DeclarationFragments/DeclarationFragments+Simplify.swift | ||
SymbolGraph/Symbol/DeclarationFragments/DeclarationFragments.swift | ||
SymbolGraph/Symbol/DeclarationFragments/Fragment/Fragment.swift | ||
SymbolGraph/Symbol/DeclarationFragments/Fragment/FragmentKind.swift | ||
SymbolGraph/Symbol/FunctionSignature/FunctionParameter.swift | ||
SymbolGraph/Symbol/FunctionSignature/FunctionSignature.swift | ||
SymbolGraph/Symbol/HTTP/HTTP.swift | ||
SymbolGraph/Symbol/Identifier.swift | ||
SymbolGraph/Symbol/KindIdentifier.swift | ||
SymbolGraph/Symbol/Location.swift | ||
SymbolGraph/Symbol/Mutability.swift | ||
SymbolGraph/Symbol/Names.swift | ||
SymbolGraph/Symbol/OverloadData.swift | ||
SymbolGraph/Symbol/PlistDetails.swift | ||
SymbolGraph/Symbol/SPI.swift | ||
SymbolGraph/Symbol/Snippet.swift | ||
SymbolGraph/Symbol/Swift/Extension.swift | ||
SymbolGraph/Symbol/Swift/GenericConstraint.swift | ||
SymbolGraph/Symbol/Swift/GenericParameter.swift | ||
SymbolGraph/Symbol/Swift/Generics.swift | ||
SymbolGraph/Symbol/Swift/Namespace.swift | ||
SymbolGraph/Symbol/Symbol.swift | ||
SymbolGraph/Symbol/SymbolKind.swift | ||
SymbolGraph/Symbol/ValueConstraints.swift | ||
SymbolGraph/SymbolGraph+Overloads.swift | ||
SymbolGraph/SymbolGraph.swift | ||
UnifiedSymbolGraph/GraphCollector.swift | ||
UnifiedSymbolGraph/UnifiedSymbol+Encodable.swift | ||
UnifiedSymbolGraph/UnifiedSymbol.swift | ||
UnifiedSymbolGraph/UnifiedSymbolGraph+Encodable.swift | ||
UnifiedSymbolGraph/UnifiedSymbolGraph+Overloads.swift | ||
UnifiedSymbolGraph/UnifiedSymbolGraph.swift) | ||
set_target_properties(SymbolKit PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}) | ||
|
||
set_property(GLOBAL APPEND PROPERTY SYMBOLKIT_EXPORTS SymbolKit) |
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,20 @@ | ||
#[[ | ||
This source file is part of the Swift.org open source project | ||
Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
See https://swift.org/LICENSE.txt for license information | ||
See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
#]] | ||
|
||
set(SYMBOLKIT_EXPORTS_FILE | ||
${CMAKE_CURRENT_BINARY_DIR}/SymbolKitExports.cmake) | ||
configure_file(SymbolKitConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/SymbolKitConfig.cmake) | ||
|
||
get_property(SYMBOLKIT_EXPORTS GLOBAL PROPERTY SYMBOLKIT_EXPORTS) | ||
export(TARGETS ${SYMBOLKIT_EXPORTS} | ||
NAMESPACE DocC:: | ||
FILE ${SYMBOLKIT_EXPORTS_FILE} | ||
EXPORT_LINK_INTERFACE_LIBRARIES) |
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 @@ | ||
#[[ | ||
This source file is part of the Swift.org open source project | ||
Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
See https://swift.org/LICENSE.txt for license information | ||
See https://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
#]] | ||
|
||
if(NOT TARGET DocC::SymbolKit) | ||
include("@SYMBOLKIT_EXPORTS_FILE@") | ||
endif() |