Skip to content

Commit 515cf21

Browse files
committed
driver: refactor driver tool logics into a library. NFC
1 parent b7ccf1b commit 515cf21

12 files changed

+467
-412
lines changed

include/swift/DriverTool/DriverTool.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//===--- DriverTool.h - Driver control ----------------------*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This file provides a high-level API for interacting with the basic
14+
// driver operation.
15+
//
16+
//===----------------------------------------------------------------------===//
17+
18+
#ifndef SWIFT_DRIVERTOOL_H
19+
#define SWIFT_DRIVERTOOL_H
20+
21+
#include "swift/Basic/LLVM.h"
22+
23+
namespace swift {
24+
int mainEntry(int argc_, const char **argv_);
25+
} // namespace swift
26+
27+
#endif

lib/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ add_subdirectory(ClangImporter)
2222
add_subdirectory(Demangling)
2323
add_subdirectory(DependencyScan)
2424
add_subdirectory(Driver)
25+
add_subdirectory(DriverTool)
2526
add_subdirectory(Frontend)
2627
add_subdirectory(FrontendTool)
2728
add_subdirectory(Index)

lib/DriverTool/CMakeLists.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
set(driver_sources_and_options
2+
driver.cpp
3+
autolink_extract_main.cpp
4+
modulewrap_main.cpp
5+
swift_api_digester_main.cpp
6+
swift_indent_main.cpp
7+
swift_symbolgraph_extract_main.cpp
8+
swift_api_extract_main.cpp)
9+
10+
set(driver_common_libs
11+
swiftAPIDigester
12+
swiftDriver
13+
swiftFrontendTool
14+
swiftSymbolGraphGen
15+
LLVMBitstreamReader
16+
libswift)
17+
18+
add_swift_host_library(swiftDriverTool STATIC
19+
${driver_sources_and_options}
20+
)
21+
target_link_libraries(swiftDriverTool
22+
PUBLIC
23+
${driver_common_libs})
24+
25+
# If building as part of clang, make sure the headers are installed.
26+
if(NOT SWIFT_BUILT_STANDALONE)
27+
add_dependencies(swiftDriverTool clang-resource-headers)
28+
endif()
29+
30+
set_swift_llvm_is_available(swiftDriverTool)

0 commit comments

Comments
 (0)