Skip to content

Commit 1a8d902

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 3cfeeb6 commit 1a8d902

File tree

5 files changed

+619
-0
lines changed

5 files changed

+619
-0
lines changed

CMakeLists.txt

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#[[
2+
This source file is part of the swift-format open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC 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+
#]]
9+
10+
cmake_minimum_required(VERSION 3.24)
11+
12+
project(docc
13+
LANGUAGES Swift)
14+
15+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
16+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
17+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
18+
19+
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
20+
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
21+
22+
include(GNUInstallDirs)
23+
24+
find_package(ArgumentParser CONFIG)
25+
find_package(SwiftCrypto CONFIG)
26+
find_package(SwiftMarkdown CONFIG)
27+
find_package(LMDB CONFIG)
28+
find_package(SymbolKit CONFIG)
29+
find_package(cmark-gfm CONFIG)
30+
31+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:-package-name;SwiftDocC>")
32+
33+
add_subdirectory(Sources)

Sources/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#[[
2+
This source file is part of the swift-format open source project
3+
4+
Copyright (c) 2024 Apple Inc. and the DocC 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+
#]]
9+
10+
add_subdirectory(SwiftDocC)
11+
add_subdirectory(SwiftDocCUtilities)
12+
add_subdirectory(docc)
13+

0 commit comments

Comments
 (0)