blob: d928c30bc6b84c8b7497a98f55c75dca73834d6f [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
62 lldbPluginObjectFileMachO
63 lldbPluginObjectContainerMachOArchive
64 lldbPluginObjectContainerBSDArchive
65 lldbPluginPlatformMacOSX
66 lldbPluginDynamicLoaderMacOSXDYLD
67 lldbPluginUnwindAssemblyInstEmulation
68 lldbPluginUnwindAssemblyX86
69 lldbPluginAppleObjCRuntime
70 lldbPluginCXXItaniumABI
71 lldbPluginABIMacOSX_arm
72 lldbPluginABIMacOSX_i386
73 lldbPluginABISysV_x86_64
74 lldbPluginInstructionARM
75 lldbPluginObjectFilePECOFF
76 lldbPluginOSPython
77 )
78
79# Windows-only libraries
80if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
81 list(APPEND LLDB_USED_LIBS
82 lldbHostWindows
83 #lldbPluginPlatformWindows
84 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
113 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
114 > ${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
122 )
123endif()
124
125set( CLANG_USED_LIBS
126 clangAnalysis
127 clangAST
128 clangBasic
129 clangCodeGen
130 clangDriver
131 clangEdit
132 clangFrontend
133 clangLex
134 clangParse
135 clangRewriteCore
136 clangRewriteFrontend
137 clangSema
138 clangSerialization
139 )
140
141if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
142 set( LLDB_SYSTEM_LIBS
143 edit
144 python2.7
145 )
146endif()
147
148set( LLVM_LINK_COMPONENTS
149 ${LLVM_TARGETS_TO_BUILD}
150 jit
151 interpreter
152 nativecodegen
153 asmparser
154 bitreader
155 bitwriter
156 codegen
157 ipo
158 selectiondag
159 bitreader
160 mc
161 mcjit
162 core
163 mcdisassembler
164 executionengine
165 )
166
167set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
168set(SHARED_LIBRARY 1)
169
170if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
171 set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
172endif()
173
174add_lldb_library(liblldb
175 lldb.cpp
176 lldb-log.cpp
177 ${LLDB_WRAP_PYTHON}
178 ${LLDB_VERS_GENERATED_FILE}
179 )
180set_target_properties(liblldb
181 PROPERTIES
182 OUTPUT_NAME lldb
183 VERSION ${LLDB_VERSION}
184 )
185if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
186 add_dependencies(liblldb
187 ${LLDB_WRAP_PYTHON}
188 ${LLDB_VERS_GENERATED_FILE}
189 )
190endif()
191target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS})
192
193# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
194# such will not work on Windows.
195if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
196 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
197 OUTPUT_VARIABLE LLDB_REVISION)
198 if ( LLDB_REVISION )
199 string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
200 endif()
201
202 execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
203 OUTPUT_VARIABLE LLDB_REPOSITORY)
204 if ( LLDB_REPOSITORY )
205 # Replace newline characters with spaces
206 string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
207
208 # Remove trailing spaces
209 string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
210 endif()
211
212 set_property(
213 SOURCE lldb.cpp
214 PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
215endif ()
216# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
217# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
218
219
220install(TARGETS liblldb
221 RUNTIME DESTINATION bin
222 LIBRARY DESTINATION lib)