blob: 84371e1dabb53abad0c65dd14a354fef06b772db [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")
Todd Fiala86dccb32014-02-26 17:44:00 +0000144 list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses)
Sylvestre Ledruf0f2d582013-11-15 14:15:10 +0000145endif()
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
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000154 asmparser
155 bitreader
156 bitwriter
157 codegen
158 ipo
159 selectiondag
160 bitreader
161 mc
162 mcjit
163 core
164 mcdisassembler
165 executionengine
Peter Collingbourne19676ac2013-11-11 04:46:09 +0000166 option
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000167 )
168
169set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
Deepak Panickala0154f92013-10-15 12:32:12 +0000170
171if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
172 set(SHARED_LIBRARY 1)
173endif()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000174
175if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
176 set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
177endif()
178
179add_lldb_library(liblldb
180 lldb.cpp
181 lldb-log.cpp
182 ${LLDB_WRAP_PYTHON}
183 ${LLDB_VERS_GENERATED_FILE}
184 )
185set_target_properties(liblldb
186 PROPERTIES
187 OUTPUT_NAME lldb
188 VERSION ${LLDB_VERSION}
189 )
190if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
191 add_dependencies(liblldb
192 ${LLDB_WRAP_PYTHON}
193 ${LLDB_VERS_GENERATED_FILE}
194 )
195endif()
196target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS})
197
198# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
199# such will not work on Windows.
200if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
201 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
202 OUTPUT_VARIABLE LLDB_REVISION)
203 if ( LLDB_REVISION )
204 string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
205 endif()
206
207 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
208 OUTPUT_VARIABLE LLDB_REPOSITORY)
209 if ( LLDB_REPOSITORY )
210 # Replace newline characters with spaces
211 string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
212
213 # Remove trailing spaces
214 string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
215 endif()
216
217 set_property(
218 SOURCE lldb.cpp
219 PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
220endif ()
221# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
222# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
223
224
225install(TARGETS liblldb
226 RUNTIME DESTINATION bin
Deepak Panickala0154f92013-10-15 12:32:12 +0000227 LIBRARY DESTINATION lib
228 ARCHIVE DESTINATION lib)