Skip to content

Commit 8226e54

Browse files
authored
Merge pull request #38368 from nkcsgexi/lib-driver-tool
driver: refactor driver tool logics into a library. NFC
2 parents 16b6306 + 504cfb9 commit 8226e54

13 files changed

+468
-412
lines changed

include/swift/DriverTool/DriverTool.h

Lines changed: 27 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
17+
add_swift_host_library(swiftDriverTool STATIC
18+
${driver_sources_and_options}
19+
)
20+
target_link_libraries(swiftDriverTool
21+
PUBLIC
22+
${driver_common_libs})
23+
24+
# If building as part of clang, make sure the headers are installed.
25+
if(NOT SWIFT_BUILT_STANDALONE)
26+
add_dependencies(swiftDriverTool clang-resource-headers)
27+
endif()
28+
29+
set_swift_llvm_is_available(swiftDriverTool)

0 commit comments

Comments
 (0)