Skip to content

Commit

Permalink
build: add an initial CMake based build system for DocC
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
compnerd committed Feb 7, 2024
1 parent afd0a24 commit 6e5ac01
Show file tree
Hide file tree
Showing 5 changed files with 588 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#[[
This source file is part of the swift-format 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
#]]

cmake_minimum_required(VERSION 3.24)

project(docc
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)

include(GNUInstallDirs)

find_package(ArgumentParser CONFIG)
find_package(SwiftCrypto CONFIG)
find_package(SwiftMarkdown CONFIG)
find_package(LMDB CONFIG)
find_package(SymbolKit CONFIG)
find_package(cmark-gfm CONFIG)

add_subdirectory(Sources)
13 changes: 13 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#[[
This source file is part of the swift-format 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_subdirectory(SwiftDocC)
add_subdirectory(SwiftDocCUtilities)
add_subdirectory(docc)

0 comments on commit 6e5ac01

Please sign in to comment.