Skip to content

Commit d3e63fa

Browse files
committed
build: add an initial CMake based build system for DocC
Using this (along with its dependencies) allows us to significantly reduce the build times for the Swift toolchain (~7% of the overall build time in local testing).
1 parent 30bc32e commit d3e63fa

File tree

5 files changed

+624
-0
lines changed

5 files changed

+624
-0
lines changed

CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#[[
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
#]]
10+
11+
cmake_minimum_required(VERSION 3.24)
12+
13+
project(docc
14+
LANGUAGES Swift)
15+
16+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
17+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
18+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
19+
20+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
21+
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
22+
23+
include(GNUInstallDirs)
24+
25+
find_package(ArgumentParser CONFIG)
26+
find_package(SwiftCrypto CONFIG)
27+
find_package(SwiftMarkdown CONFIG)
28+
find_package(LMDB CONFIG)
29+
find_package(SymbolKit CONFIG)
30+
find_package(cmark-gfm CONFIG)
31+
32+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:-package-name;SwiftDocC>")
33+
34+
add_subdirectory(Sources)

Sources/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#[[
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See https://swift.org/LICENSE.txt for license information
8+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
#]]
10+
11+
add_subdirectory(SwiftDocC)
12+
add_subdirectory(SwiftDocCUtilities)
13+
add_subdirectory(docc)
14+

0 commit comments

Comments
 (0)