blob: 33b1342ba8584ac71fcefab7346debfdd6046558 [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
106 )
107endif ()
108
109# FreeBSD-only libraries
110if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
111 list(APPEND LLDB_USED_LIBS
112 lldbHostFreeBSD
113 lldbPluginProcessFreeBSD
114 lldbPluginProcessPOSIX
115 lldbPluginProcessElfCore
116 )
117endif ()
118
119# Darwin-only libraries
120if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
121 set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
122 add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
123 COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
Todd Fiala5000e282014-01-18 08:05:32 +0000124 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000125 > ${LLDB_VERS_GENERATED_FILE})
126
127 set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
128 list(APPEND LLDB_USED_LIBS
129 lldbHostMacOSX
130 lldbPluginDynamicLoaderDarwinKernel
131 lldbPluginProcessMacOSXKernel
132 lldbPluginSymbolVendorMacOSX
Jason Molendaa7b5afa2013-11-15 00:17:32 +0000133 lldbPluginSystemRuntimeMacOSX
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000134 )
135endif()
136
137set( CLANG_USED_LIBS
138 clangAnalysis
139 clangAST
140 clangBasic
141 clangCodeGen
142 clangDriver
143 clangEdit
144 clangFrontend
145 clangLex
146 clangParse
147 clangRewriteCore
148 clangRewriteFrontend
149 clangSema
150 clangSerialization
151 )
152
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000153set(LLDB_SYSTEM_LIBS)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000154if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
Todd Fiala86dccb32014-02-26 17:44:00 +0000155 list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses)
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000156endif()
Ed Maste0121e432014-02-26 18:21:42 +0000157# On FreeBSD backtrace() is provided by libexecinfo, not libc.
158if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
159 list(APPEND LLDB_SYSTEM_LIBS execinfo)
160endif()
161
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000162if (NOT LLDB_DISABLE_PYTHON)
163 list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000164endif()
165
166set( LLVM_LINK_COMPONENTS
167 ${LLVM_TARGETS_TO_BUILD}
168 jit
169 interpreter
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000170 asmparser
171 bitreader
172 bitwriter
173 codegen
174 ipo
175 selectiondag
176 bitreader
177 mc
178 mcjit
179 core
180 mcdisassembler
181 executionengine
Peter Collingbourne19676ac2013-11-11 04:46:09 +0000182 option
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000183 )
184
Deepak Panickala0154f92013-10-15 12:32:12 +0000185
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000186if ( NOT LLDB_DISABLE_PYTHON )
187 set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000188 set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
189endif()
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000190set(SHARED_LIBRARY 1)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000191
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000192if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
193add_definitions( -DEXPORT_LIBLLDB )
194endif()
195
196# Need to export the API in the liblldb.dll for Windows
197# The lldbAPI source files are added directly in liblldb
198if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
199add_lldb_library(liblldb
200 lldb.cpp
201 lldb-log.cpp
202 API/SBAddress.cpp
203 API/SBBlock.cpp
204 API/SBBreakpoint.cpp
205 API/SBBreakpointLocation.cpp
206 API/SBBroadcaster.cpp
207 API/SBCommandInterpreter.cpp
208 API/SBCommandReturnObject.cpp
209 API/SBCommunication.cpp
210 API/SBCompileUnit.cpp
211 API/SBData.cpp
212 API/SBDebugger.cpp
213 API/SBDeclaration.cpp
214 API/SBError.cpp
215 API/SBEvent.cpp
216 API/SBExpressionOptions.cpp
217 API/SBFileSpec.cpp
218 API/SBFileSpecList.cpp
219 API/SBFrame.cpp
220 API/SBFunction.cpp
221 API/SBHostOS.cpp
222 API/SBInstruction.cpp
223 API/SBInstructionList.cpp
224 API/SBLineEntry.cpp
225 API/SBListener.cpp
226 API/SBModule.cpp
227 API/SBModuleSpec.cpp
228 API/SBPlatform.cpp
229 API/SBProcess.cpp
230 API/SBQueue.cpp
231 API/SBQueueItem.cpp
232 API/SBSection.cpp
233 API/SBSourceManager.cpp
234 API/SBStream.cpp
235 API/SBStringList.cpp
236 API/SBSymbol.cpp
237 API/SBSymbolContext.cpp
238 API/SBSymbolContextList.cpp
239 API/SBTarget.cpp
240 API/SBThread.cpp
241 API/SBType.cpp
242 API/SBTypeCategory.cpp
243 API/SBTypeFilter.cpp
244 API/SBTypeFormat.cpp
245 API/SBTypeNameSpecifier.cpp
246 API/SBTypeSummary.cpp
247 API/SBTypeSynthetic.cpp
248 API/SBValue.cpp
249 API/SBValueList.cpp
250 API/SBWatchpoint.cpp
251 Host/Windows/getopt/GetOptInc.cpp
252 ${LLDB_WRAP_PYTHON}
253 ${LLDB_VERS_GENERATED_FILE}
254 )
255else ()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000256add_lldb_library(liblldb
257 lldb.cpp
258 lldb-log.cpp
259 ${LLDB_WRAP_PYTHON}
260 ${LLDB_VERS_GENERATED_FILE}
261 )
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000262endif ()
263
264if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
265set_target_properties(liblldb
266 PROPERTIES
267 OUTPUT_NAME liblldb
268 VERSION ${LLDB_VERSION}
269 )
270else()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000271set_target_properties(liblldb
272 PROPERTIES
273 OUTPUT_NAME lldb
274 VERSION ${LLDB_VERSION}
275 )
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000276endif()
277
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000278if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
279 add_dependencies(liblldb
Deepak Panickal627f4ae2014-03-03 15:50:36 +0000280 swig_wrapper
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000281 ${LLDB_WRAP_PYTHON}
282 ${LLDB_VERS_GENERATED_FILE}
283 )
284endif()
285target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS})
286
287# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
288# such will not work on Windows.
289if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
290 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
291 OUTPUT_VARIABLE LLDB_REVISION)
292 if ( LLDB_REVISION )
293 string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
294 endif()
295
296 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
297 OUTPUT_VARIABLE LLDB_REPOSITORY)
298 if ( LLDB_REPOSITORY )
299 # Replace newline characters with spaces
300 string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
301
302 # Remove trailing spaces
303 string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
304 endif()
305
306 set_property(
307 SOURCE lldb.cpp
308 PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
309endif ()
310# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
311# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
312
313
314install(TARGETS liblldb
315 RUNTIME DESTINATION bin
Deepak Panickala0154f92013-10-15 12:32:12 +0000316 LIBRARY DESTINATION lib
317 ARCHIVE DESTINATION lib)