Skip to content

Commit b0996a2

Browse files
committed
[lldb-dap] Split lldb-dap into library and tool (NFC)
Split lldb-dap into a library (lldbDAP) and a tool (lldb-dap). The motivation is being able to link parts of lldb-dap separately, for example to support unit testing and fizzing.
1 parent a92de02 commit b0996a2

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

lldb/tools/lldb-dap/CMakeLists.txt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
if(APPLE)
2-
configure_file(
3-
${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
4-
${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
5-
)
6-
# Inline info plist in binary (use target_link_options for this as soon as CMake 3.13 is available)
7-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
8-
endif()
9-
101
# We need to include the llvm components we depend on manually, as liblldb does
112
# not re-export those.
123
set(LLVM_LINK_COMPONENTS Support)
134
set(LLVM_TARGET_DEFINITIONS Options.td)
145
tablegen(LLVM Options.inc -gen-opt-parser-defs)
156
add_public_tablegen_target(LLDBDAPOptionsTableGen)
16-
add_lldb_tool(lldb-dap
17-
lldb-dap.cpp
7+
8+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
9+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
10+
11+
add_lldb_library(lldbDAP
1812
Breakpoint.cpp
1913
BreakpointBase.cpp
2014
DAP.cpp
@@ -85,10 +79,8 @@ add_lldb_tool(lldb-dap
8579
Support
8680
)
8781

88-
target_include_directories(lldb-dap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
89-
9082
if(LLDB_DAP_WELCOME_MESSAGE)
91-
target_compile_definitions(lldb-dap
83+
target_compile_definitions(lldbDAP
9284
PRIVATE
9385
-DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
9486
endif()
@@ -105,3 +97,5 @@ if(LLDB_BUILD_FRAMEWORK)
10597
"@loader_path/../../Library/PrivateFrameworks"
10698
)
10799
endif()
100+
101+
add_subdirectory(tool)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if(APPLE)
2+
configure_file(
3+
${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
4+
${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
5+
)
6+
# Inline info plist in binary (use target_link_options for this as soon as CMake 3.13 is available)
7+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
8+
endif()
9+
10+
add_lldb_tool(lldb-dap
11+
lldb-dap.cpp
12+
13+
LINK_LIBS
14+
lldbDAP
15+
)
16+
17+
if(LLDB_BUILD_FRAMEWORK)
18+
# In the build-tree, we know the exact path to the framework directory.
19+
# The installed framework can be in different locations.
20+
lldb_setup_rpaths(lldb-dap
21+
BUILD_RPATH
22+
"${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
23+
INSTALL_RPATH
24+
"@loader_path/../../../SharedFrameworks"
25+
"@loader_path/../../System/Library/PrivateFrameworks"
26+
"@loader_path/../../Library/PrivateFrameworks"
27+
)
28+
endif()
File renamed without changes.

0 commit comments

Comments
 (0)