blob: de5c05c962589185d2e82463faf7a54da9955873 [file] [log] [blame]
Joerg Sonnenberger340a1752013-09-25 10:37:32 +00001include_directories(.)
2
3if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
4include_directories(
5 Plugins/Process/Linux
6 Plugins/Process/POSIX
7 )
8endif ()
9
10if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
11include_directories(
12 Plugins/Process/FreeBSD
13 Plugins/Process/POSIX
14 )
15endif ()
16
Deepak Panickal627f4ae2014-03-03 15:50:36 +000017# Need to export the API in the liblldb.dll for Windows
18# The lldbAPI source files are added directly in liblldb
19if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
20 add_subdirectory(API)
21endif ()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000022add_subdirectory(Breakpoint)
23add_subdirectory(Commands)
24add_subdirectory(Core)
25add_subdirectory(DataFormatters)
26add_subdirectory(Expression)
27add_subdirectory(Host)
28add_subdirectory(Interpreter)
29add_subdirectory(Plugins)
30add_subdirectory(Symbol)
31add_subdirectory(Target)
32add_subdirectory(Utility)
33
34set( LLDB_USED_LIBS
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000035 lldbBreakpoint
36 lldbCommands
37 lldbDataFormatters
38 lldbHostCommon
39 lldbCore
40 lldbExpression
41 lldbInterpreter
42 lldbSymbol
43 lldbTarget
44 lldbUtility
45
46 # Plugins
47 lldbPluginDisassemblerLLVM
48 lldbPluginSymbolFileDWARF
49 lldbPluginSymbolFileSymtab
50 lldbPluginDynamicLoaderStatic
51 lldbPluginDynamicLoaderPosixDYLD
52
53 lldbPluginObjectFileMachO
54 lldbPluginObjectFileELF
55 lldbPluginSymbolVendorELF
56 lldbPluginObjectContainerBSDArchive
57 lldbPluginObjectContainerMachOArchive
58 lldbPluginProcessGDBRemote
59 lldbPluginProcessMachCore
60 lldbPluginProcessUtility
61 lldbPluginPlatformGDB
62 lldbPluginPlatformFreeBSD
63 lldbPluginPlatformLinux
64 lldbPluginPlatformPOSIX
Deepak Panickala0154f92013-10-15 12:32:12 +000065 lldbPluginPlatformWindows
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000066 lldbPluginObjectFileMachO
67 lldbPluginObjectContainerMachOArchive
68 lldbPluginObjectContainerBSDArchive
69 lldbPluginPlatformMacOSX
70 lldbPluginDynamicLoaderMacOSXDYLD
71 lldbPluginUnwindAssemblyInstEmulation
72 lldbPluginUnwindAssemblyX86
73 lldbPluginAppleObjCRuntime
74 lldbPluginCXXItaniumABI
75 lldbPluginABIMacOSX_arm
76 lldbPluginABIMacOSX_i386
77 lldbPluginABISysV_x86_64
78 lldbPluginInstructionARM
79 lldbPluginObjectFilePECOFF
80 lldbPluginOSPython
81 )
82
Deepak Panickal627f4ae2014-03-03 15:50:36 +000083# Need to export the API in the liblldb.dll for Windows
84# The lldbAPI source files are added directly in liblldb
85if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
86 list(APPEND LLDB_USED_LIBS
87 lldbAPI
88 )
89endif ()
90
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000091# Windows-only libraries
92if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
93 list(APPEND LLDB_USED_LIBS
94 lldbHostWindows
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000095 Ws2_32
96 )
97endif ()
98
99# Linux-only libraries
100if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
101 list(APPEND LLDB_USED_LIBS
102 lldbHostLinux
103 lldbPluginProcessLinux
104 lldbPluginProcessPOSIX
105 lldbPluginProcessElfCore
Andrew MacPherson17220c12014-03-05 10:12:43 +0000106 lldbPluginJITLoaderGDB
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000107 )
108endif ()
109
110# FreeBSD-only libraries
111if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
112 list(APPEND LLDB_USED_LIBS
113 lldbHostFreeBSD
114 lldbPluginProcessFreeBSD
115 lldbPluginProcessPOSIX
116 lldbPluginProcessElfCore
117 )
118endif ()
119
120# Darwin-only libraries
121if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
122 set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
123 add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
124 COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
Todd Fiala5000e282014-01-18 08:05:32 +0000125 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000126 > ${LLDB_VERS_GENERATED_FILE})
127
128 set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
129 list(APPEND LLDB_USED_LIBS
130 lldbHostMacOSX
131 lldbPluginDynamicLoaderDarwinKernel
132 lldbPluginProcessMacOSXKernel
133 lldbPluginSymbolVendorMacOSX
Jason Molendaa7b5afa2013-11-15 00:17:32 +0000134 lldbPluginSystemRuntimeMacOSX
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000135 )
136endif()
137
138set( CLANG_USED_LIBS
139 clangAnalysis
140 clangAST
141 clangBasic
142 clangCodeGen
143 clangDriver
144 clangEdit
145 clangFrontend
146 clangLex
147 clangParse
148 clangRewriteCore
149 clangRewriteFrontend
150 clangSema
151 clangSerialization
152 )
153
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000154set(LLDB_SYSTEM_LIBS)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000155if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
Todd Fiala86dccb32014-02-26 17:44:00 +0000156 list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses)
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000157endif()
Ed Maste0121e432014-02-26 18:21:42 +0000158# On FreeBSD backtrace() is provided by libexecinfo, not libc.
159if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
160 list(APPEND LLDB_SYSTEM_LIBS execinfo)
161endif()
162
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000163if (NOT LLDB_DISABLE_PYTHON)
164 list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000165endif()
166
167set( LLVM_LINK_COMPONENTS
168 ${LLVM_TARGETS_TO_BUILD}
169 jit
170 interpreter
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000171 asmparser
172 bitreader
173 bitwriter
174 codegen
175 ipo
176 selectiondag
177 bitreader
178 mc
179 mcjit
180 core
181 mcdisassembler
182 executionengine
Peter Collingbourne19676ac2013-11-11 04:46:09 +0000183 option
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000184 )
185
Deepak Panickala0154f92013-10-15 12:32:12 +0000186
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000187if ( NOT LLDB_DISABLE_PYTHON )
188 set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000189 set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
190endif()
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000191set(SHARED_LIBRARY 1)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000192
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000193if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
194add_definitions( -DEXPORT_LIBLLDB )
195endif()
196
197# Need to export the API in the liblldb.dll for Windows
198# The lldbAPI source files are added directly in liblldb
199if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
200add_lldb_library(liblldb
201 lldb.cpp
202 lldb-log.cpp
203 API/SBAddress.cpp
204 API/SBBlock.cpp
205 API/SBBreakpoint.cpp
206 API/SBBreakpointLocation.cpp
207 API/SBBroadcaster.cpp
208 API/SBCommandInterpreter.cpp
209 API/SBCommandReturnObject.cpp
210 API/SBCommunication.cpp
211 API/SBCompileUnit.cpp
212 API/SBData.cpp
213 API/SBDebugger.cpp
214 API/SBDeclaration.cpp
215 API/SBError.cpp
216 API/SBEvent.cpp
217 API/SBExpressionOptions.cpp
218 API/SBFileSpec.cpp
219 API/SBFileSpecList.cpp
220 API/SBFrame.cpp
221 API/SBFunction.cpp
222 API/SBHostOS.cpp
223 API/SBInstruction.cpp
224 API/SBInstructionList.cpp
225 API/SBLineEntry.cpp
226 API/SBListener.cpp
227 API/SBModule.cpp
228 API/SBModuleSpec.cpp
229 API/SBPlatform.cpp
230 API/SBProcess.cpp
231 API/SBQueue.cpp
232 API/SBQueueItem.cpp
233 API/SBSection.cpp
234 API/SBSourceManager.cpp
235 API/SBStream.cpp
236 API/SBStringList.cpp
237 API/SBSymbol.cpp
238 API/SBSymbolContext.cpp
239 API/SBSymbolContextList.cpp
240 API/SBTarget.cpp
241 API/SBThread.cpp
242 API/SBType.cpp
243 API/SBTypeCategory.cpp
244 API/SBTypeFilter.cpp
245 API/SBTypeFormat.cpp
246 API/SBTypeNameSpecifier.cpp
247 API/SBTypeSummary.cpp
248 API/SBTypeSynthetic.cpp
249 API/SBValue.cpp
250 API/SBValueList.cpp
251 API/SBWatchpoint.cpp
252 Host/Windows/getopt/GetOptInc.cpp
253 ${LLDB_WRAP_PYTHON}
254 ${LLDB_VERS_GENERATED_FILE}
255 )
256else ()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000257add_lldb_library(liblldb
258 lldb.cpp
259 lldb-log.cpp
260 ${LLDB_WRAP_PYTHON}
261 ${LLDB_VERS_GENERATED_FILE}
262 )
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000263endif ()
264
265if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
266set_target_properties(liblldb
267 PROPERTIES
268 OUTPUT_NAME liblldb
269 VERSION ${LLDB_VERSION}
270 )
271else()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000272set_target_properties(liblldb
273 PROPERTIES
274 OUTPUT_NAME lldb
275 VERSION ${LLDB_VERSION}
276 )
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000277endif()
278
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000279if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
280 add_dependencies(liblldb
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000281 swig_wrapper
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000282 ${LLDB_WRAP_PYTHON}
283 ${LLDB_VERS_GENERATED_FILE}
284 )
285endif()
286target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS})
287
288# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
289# such will not work on Windows.
290if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
291 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
292 OUTPUT_VARIABLE LLDB_REVISION)
293 if ( LLDB_REVISION )
294 string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
295 endif()
296
297 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
298 OUTPUT_VARIABLE LLDB_REPOSITORY)
299 if ( LLDB_REPOSITORY )
300 # Replace newline characters with spaces
301 string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
302
303 # Remove trailing spaces
304 string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
305 endif()
306
307 set_property(
308 SOURCE lldb.cpp
309 PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
310endif ()
311# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
312# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
313
314
315install(TARGETS liblldb
316 RUNTIME DESTINATION bin
Deepak Panickala0154f92013-10-15 12:32:12 +0000317 LIBRARY DESTINATION lib
318 ARCHIVE DESTINATION lib)