summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/CMakeLists.txt
blob: aa409bf24c9b0f271595ed460529cf3d6f05c1cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
macro(add_host_subdirectory group)
  list(APPEND HOST_SOURCES ${ARGN})
  source_group(${group} FILES ${ARGN})
endmacro()

# Removes all module flags from the current CMAKE_CXX_FLAGS. Used for
# the Objective-C++ code in lldb which we don't want to build with modules.
# Reasons for this are that modules with Objective-C++ would require that
# all LLVM/Clang modules are Objective-C++ compatible (which they are likely
# not) and we would have rebuild a second set of modules just for the few
# Objective-C++ files in lldb (which slows down the build process).
macro(remove_module_flags)
  string(REGEX REPLACE "-fmodules-cache-path=[^ ]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  string(REGEX REPLACE "-fmodules-local-submodule-visibility" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  string(REGEX REPLACE "-fmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  string(REGEX REPLACE "-gmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  string(REGEX REPLACE "-fcxx-modules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endmacro()

add_host_subdirectory(common
  common/FileAction.cpp
  common/FileCache.cpp
  common/File.cpp
  common/FileSystem.cpp
  common/GetOptInc.cpp
  common/Host.cpp
  common/HostInfoBase.cpp
  common/HostNativeThreadBase.cpp
  common/HostProcess.cpp
  common/HostThread.cpp
  common/LockFileBase.cpp
  common/LZMA.cpp
  common/MainLoop.cpp
  common/MonitoringProcessLauncher.cpp
  common/NativeProcessProtocol.cpp
  common/NativeRegisterContext.cpp
  common/NativeThreadProtocol.cpp
  common/NativeWatchpointList.cpp
  common/OptionParser.cpp
  common/PipeBase.cpp
  common/ProcessLaunchInfo.cpp
  common/ProcessRunLock.cpp
  common/PseudoTerminal.cpp
  common/SocketAddress.cpp
  common/Socket.cpp
  common/StringConvert.cpp
  common/TaskPool.cpp
  common/TCPSocket.cpp
  common/Terminal.cpp
  common/ThreadLauncher.cpp
  common/UDPSocket.cpp
  common/XML.cpp
  )

if (NOT LLDB_DISABLE_LIBEDIT)
  add_host_subdirectory(common
    common/Editline.cpp
    )
endif()

add_host_subdirectory(posix
  posix/ConnectionFileDescriptorPosix.cpp
  )

if (CMAKE_SYSTEM_NAME MATCHES "Windows")
  add_host_subdirectory(windows
    windows/ConnectionGenericFileWindows.cpp
    windows/EditLineWin.cpp
    windows/FileSystem.cpp
    windows/Host.cpp
    windows/HostInfoWindows.cpp
    windows/HostProcessWindows.cpp
    windows/HostThreadWindows.cpp
    windows/LockFileWindows.cpp
    windows/PipeWindows.cpp
    windows/ProcessLauncherWindows.cpp
    windows/ProcessRunLock.cpp
    windows/Windows.cpp
    )
else()
  add_host_subdirectory(posix
    posix/DomainSocket.cpp
    posix/FileSystem.cpp
    posix/HostInfoPosix.cpp
    posix/HostProcessPosix.cpp
    posix/HostThreadPosix.cpp
    posix/LockFilePosix.cpp
    posix/PipePosix.cpp
    posix/ProcessLauncherPosixFork.cpp
    )

  if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
    include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
    add_subdirectory(macosx/objcxx)
    set(LLDBObjCLibs lldbHostMacOSXObjCXX)
    add_host_subdirectory(macosx
      macosx/cfcpp/CFCBundle.cpp
      macosx/cfcpp/CFCData.cpp
      macosx/cfcpp/CFCMutableArray.cpp
      macosx/cfcpp/CFCMutableDictionary.cpp
      macosx/cfcpp/CFCMutableSet.cpp
      macosx/cfcpp/CFCString.cpp
      )
    if(IOS)
      set_property(SOURCE macosx/Host.mm APPEND PROPERTY
               COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
    endif()


  elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
    add_host_subdirectory(linux
      linux/AbstractSocket.cpp
      linux/Host.cpp
      linux/HostInfoLinux.cpp
      linux/LibcGlue.cpp
      linux/Support.cpp
      )
    if (CMAKE_SYSTEM_NAME MATCHES "Android")
      add_host_subdirectory(android
        android/HostInfoAndroid.cpp
        android/LibcGlue.cpp
        )
    endif()
  elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
    add_host_subdirectory(freebsd
      freebsd/Host.cpp
      freebsd/HostInfoFreeBSD.cpp
      )

  elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
    add_host_subdirectory(netbsd
      netbsd/Host.cpp
      netbsd/HostInfoNetBSD.cpp
      )

  elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
    add_host_subdirectory(openbsd
      openbsd/Host.cpp
      openbsd/HostInfoOpenBSD.cpp
      )
  endif()
endif()

set(EXTRA_LIBS)
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
  list(APPEND EXTRA_LIBS kvm)
endif ()
if (APPLE)
  list(APPEND EXTRA_LIBS xml2)
else ()
  if (LIBXML2_FOUND)
    list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
  endif()
endif ()
if (HAVE_LIBDL)
  list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
endif()
if (NOT LLDB_DISABLE_LIBEDIT)
  list(APPEND EXTRA_LIBS ${libedit_LIBRARIES})
endif()
if (LLDB_ENABLE_LZMA)
  list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
endif()

if (NOT LLDB_DISABLE_LIBEDIT)
  list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES})
  if (LLVM_BUILD_STATIC)
    list(APPEND LLDB_SYSTEM_LIBS gpm)
  endif()
endif()

add_lldb_library(lldbHost
  ${HOST_SOURCES}

  LINK_LIBS
    lldbUtility
    ${EXTRA_LIBS}
    ${LLDBObjCLibs}
    ${LLDB_LIBEDIT_LIBS}

  LINK_COMPONENTS
    Object
    Support
  )

if (NOT LLDB_DISABLE_LIBEDIT)
  target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS})
endif()
OpenPOWER on IntegriCloud