blob: 11e2a355af09a9ba33d3bc421a30b0117e740b3c [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
17add_subdirectory(API)
18add_subdirectory(Breakpoint)
19add_subdirectory(Commands)
20add_subdirectory(Core)
21add_subdirectory(DataFormatters)
22add_subdirectory(Expression)
23add_subdirectory(Host)
24add_subdirectory(Interpreter)
25add_subdirectory(Plugins)
26add_subdirectory(Symbol)
27add_subdirectory(Target)
28add_subdirectory(Utility)
29
30set( LLDB_USED_LIBS
31 lldbAPI
32 lldbBreakpoint
33 lldbCommands
34 lldbDataFormatters
35 lldbHostCommon
36 lldbCore
37 lldbExpression
38 lldbInterpreter
39 lldbSymbol
40 lldbTarget
41 lldbUtility
42
43 # Plugins
44 lldbPluginDisassemblerLLVM
45 lldbPluginSymbolFileDWARF
46 lldbPluginSymbolFileSymtab
47 lldbPluginDynamicLoaderStatic
48 lldbPluginDynamicLoaderPosixDYLD
49
50 lldbPluginObjectFileMachO
51 lldbPluginObjectFileELF
52 lldbPluginSymbolVendorELF
53 lldbPluginObjectContainerBSDArchive
54 lldbPluginObjectContainerMachOArchive
55 lldbPluginProcessGDBRemote
56 lldbPluginProcessMachCore
57 lldbPluginProcessUtility
58 lldbPluginPlatformGDB
59 lldbPluginPlatformFreeBSD
60 lldbPluginPlatformLinux
61 lldbPluginPlatformPOSIX
Deepak Panickala0154f92013-10-15 12:32:12 +000062 lldbPluginPlatformWindows
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000063 lldbPluginObjectFileMachO
64 lldbPluginObjectContainerMachOArchive
65 lldbPluginObjectContainerBSDArchive
66 lldbPluginPlatformMacOSX
67 lldbPluginDynamicLoaderMacOSXDYLD
68 lldbPluginUnwindAssemblyInstEmulation
69 lldbPluginUnwindAssemblyX86
70 lldbPluginAppleObjCRuntime
71 lldbPluginCXXItaniumABI
72 lldbPluginABIMacOSX_arm
73 lldbPluginABIMacOSX_i386
74 lldbPluginABISysV_x86_64
75 lldbPluginInstructionARM
76 lldbPluginObjectFilePECOFF
77 lldbPluginOSPython
78 )
79
80# Windows-only libraries
81if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
82 list(APPEND LLDB_USED_LIBS
83 lldbHostWindows
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000084 Ws2_32
85 )
86endif ()
87
88# Linux-only libraries
89if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
90 list(APPEND LLDB_USED_LIBS
91 lldbHostLinux
92 lldbPluginProcessLinux
93 lldbPluginProcessPOSIX
94 lldbPluginProcessElfCore
95 )
96endif ()
97
98# FreeBSD-only libraries
99if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
100 list(APPEND LLDB_USED_LIBS
101 lldbHostFreeBSD
102 lldbPluginProcessFreeBSD
103 lldbPluginProcessPOSIX
104 lldbPluginProcessElfCore
105 )
106endif ()
107
108# Darwin-only libraries
109if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
110 set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
111 add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
112 COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
Todd Fiala5000e282014-01-18 08:05:32 +0000113 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000114 > ${LLDB_VERS_GENERATED_FILE})
115
116 set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
117 list(APPEND LLDB_USED_LIBS
118 lldbHostMacOSX
119 lldbPluginDynamicLoaderDarwinKernel
120 lldbPluginProcessMacOSXKernel
121 lldbPluginSymbolVendorMacOSX
Jason Molendaa7b5afa2013-11-15 00:17:32 +0000122 lldbPluginSystemRuntimeMacOSX
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000123 )
124endif()
125
126set( CLANG_USED_LIBS
127 clangAnalysis
128 clangAST
129 clangBasic
130 clangCodeGen
131 clangDriver
132 clangEdit
133 clangFrontend
134 clangLex
135 clangParse
136 clangRewriteCore
137 clangRewriteFrontend
138 clangSema
139 clangSerialization
140 )
141
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000142set(LLDB_SYSTEM_LIBS)
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000143if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000144 list(APPEND LLDB_SYSTEM_LIBS edit)
145endif()
146if (NOT LLDB_DISABLE_PYTHON)
147 list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000148endif()
149
150set( LLVM_LINK_COMPONENTS
151 ${LLVM_TARGETS_TO_BUILD}
152 jit
153 interpreter
154 nativecodegen
155 asmparser
156 bitreader
157 bitwriter
158 codegen
159 ipo
160 selectiondag
161 bitreader
162 mc
163 mcjit
164 core
165 mcdisassembler
166 executionengine
Peter Collingbourne19676ac2013-11-11 04:46:09 +0000167 option
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000168 )
169
170set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
Deepak Panickala0154f92013-10-15 12:32:12 +0000171
172if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
173 set(SHARED_LIBRARY 1)
174endif()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000175
176if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
177 set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
178endif()
179
180add_lldb_library(liblldb
181 lldb.cpp
182 lldb-log.cpp
183 ${LLDB_WRAP_PYTHON}
184 ${LLDB_VERS_GENERATED_FILE}
185 )
186set_target_properties(liblldb
187 PROPERTIES
188 OUTPUT_NAME lldb
189 VERSION ${LLDB_VERSION}
190 )
191if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
192 add_dependencies(liblldb
193 ${LLDB_WRAP_PYTHON}
194 ${LLDB_VERS_GENERATED_FILE}
195 )
196endif()
197target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS})
198
199# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
200# such will not work on Windows.
201if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
202 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
203 OUTPUT_VARIABLE LLDB_REVISION)
204 if ( LLDB_REVISION )
205 string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
206 endif()
207
208 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
209 OUTPUT_VARIABLE LLDB_REPOSITORY)
210 if ( LLDB_REPOSITORY )
211 # Replace newline characters with spaces
212 string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
213
214 # Remove trailing spaces
215 string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
216 endif()
217
218 set_property(
219 SOURCE lldb.cpp
220 PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
221endif ()
222# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
223# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
224
225
226install(TARGETS liblldb
227 RUNTIME DESTINATION bin
Deepak Panickala0154f92013-10-15 12:32:12 +0000228 LIBRARY DESTINATION lib
229 ARCHIVE DESTINATION lib)