Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Host / CMakeLists.txt
blobfe6e539f758fdaaf501dfd317db4545188dc8196
1 if (APPLE AND LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
2   # The arpa/inet.h header used in the files here is providing a miscompiled
3   # htonl function on macOS < 14 when local submodule visibility is active.
4   if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 14.0)
5     # Disabling modules in this directory.
6     remove_module_flags()
7   endif()
8 endif()
10 macro(add_host_subdirectory group)
11   list(APPEND HOST_SOURCES ${ARGN})
12   source_group(${group} FILES ${ARGN})
13 endmacro()
15 add_host_subdirectory(common
16   common/FileAction.cpp
17   common/FileCache.cpp
18   common/File.cpp
19   common/FileSystem.cpp
20   common/GetOptInc.cpp
21   common/Host.cpp
22   common/HostInfoBase.cpp
23   common/HostNativeThreadBase.cpp
24   common/HostProcess.cpp
25   common/HostThread.cpp
26   common/LockFileBase.cpp
27   common/LZMA.cpp
28   common/MainLoopBase.cpp
29   common/MonitoringProcessLauncher.cpp
30   common/NativeProcessProtocol.cpp
31   common/NativeRegisterContext.cpp
32   common/NativeThreadProtocol.cpp
33   common/NativeWatchpointList.cpp
34   common/OptionParser.cpp
35   common/PipeBase.cpp
36   common/ProcessLaunchInfo.cpp
37   common/ProcessRunLock.cpp
38   common/PseudoTerminal.cpp
39   common/StreamFile.cpp
40   common/SocketAddress.cpp
41   common/Socket.cpp
42   common/TCPSocket.cpp
43   common/Terminal.cpp
44   common/ThreadLauncher.cpp
45   common/UDPSocket.cpp
46   common/XML.cpp
47   common/ZipFileResolver.cpp
48   )
50 if (LLDB_ENABLE_LIBEDIT)
51   add_host_subdirectory(common
52     common/Editline.cpp
53     )
54 endif()
56 add_host_subdirectory(posix
57   posix/ConnectionFileDescriptorPosix.cpp
58   )
60 if (CMAKE_SYSTEM_NAME MATCHES "Windows")
61   add_host_subdirectory(windows
62     windows/ConnectionGenericFileWindows.cpp
63     windows/FileSystem.cpp
64     windows/Host.cpp
65     windows/HostInfoWindows.cpp
66     windows/HostProcessWindows.cpp
67     windows/HostThreadWindows.cpp
68     windows/LockFileWindows.cpp
69     windows/MainLoopWindows.cpp
70     windows/PipeWindows.cpp
71     windows/ProcessLauncherWindows.cpp
72     windows/ProcessRunLock.cpp
73     )
74 else()
75   add_host_subdirectory(posix
76     posix/DomainSocket.cpp
77     posix/FileSystemPosix.cpp
78     posix/HostInfoPosix.cpp
79     posix/HostProcessPosix.cpp
80     posix/HostThreadPosix.cpp
81     posix/LockFilePosix.cpp
82     posix/MainLoopPosix.cpp
83     posix/PipePosix.cpp
84     posix/ProcessLauncherPosixFork.cpp
85     )
87   if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
88     add_subdirectory(macosx/objcxx)
89     set(LLDBObjCLibs lldbHostMacOSXObjCXX)
90     add_host_subdirectory(macosx
91       macosx/cfcpp/CFCBundle.cpp
92       macosx/cfcpp/CFCData.cpp
93       macosx/cfcpp/CFCMutableArray.cpp
94       macosx/cfcpp/CFCMutableDictionary.cpp
95       macosx/cfcpp/CFCMutableSet.cpp
96       macosx/cfcpp/CFCString.cpp
97       )
98     if(APPLE_EMBEDDED)
99       set_property(SOURCE macosx/Host.mm APPEND PROPERTY
100                COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
101     endif()
104   elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
105     add_host_subdirectory(linux
106       linux/AbstractSocket.cpp
107       linux/Host.cpp
108       linux/HostInfoLinux.cpp
109       linux/LibcGlue.cpp
110       linux/Support.cpp
111       )
112     if (CMAKE_SYSTEM_NAME MATCHES "Android")
113       add_host_subdirectory(android
114         android/HostInfoAndroid.cpp
115         android/LibcGlue.cpp
116         )
117     endif()
118   elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
119     add_host_subdirectory(freebsd
120       freebsd/Host.cpp
121       freebsd/HostInfoFreeBSD.cpp
122       )
124   elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
125     add_host_subdirectory(netbsd
126       netbsd/HostNetBSD.cpp
127       netbsd/HostInfoNetBSD.cpp
128       )
130   elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
131     add_host_subdirectory(openbsd
132       openbsd/Host.cpp
133       openbsd/HostInfoOpenBSD.cpp
134       )
135   endif()
136 endif()
138 set(EXTRA_LIBS)
139 if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
140   list(APPEND EXTRA_LIBS kvm)
141 endif()
142 if (LLDB_ENABLE_LIBXML2)
143   list(APPEND EXTRA_LIBS LibXml2::LibXml2)
144 endif()
145 if (HAVE_LIBDL)
146   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
147 endif()
148 if (LLDB_ENABLE_LIBEDIT)
149   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
150 endif()
151 if (LLDB_ENABLE_LZMA)
152   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
153 endif()
154 if (WIN32)
155   list(APPEND LLDB_SYSTEM_LIBS psapi)
156 endif()
158 if (LLDB_ENABLE_LIBEDIT)
159   list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
160   if (LLVM_BUILD_STATIC)
161     list(APPEND LLDB_SYSTEM_LIBS gpm)
162   endif()
163 endif()
165 add_lldb_library(lldbHost NO_PLUGIN_DEPENDENCIES
166   ${HOST_SOURCES}
168   LINK_LIBS
169     lldbUtility
170     ${EXTRA_LIBS}
171     ${LLDBObjCLibs}
172     ${LLDB_LIBEDIT_LIBS}
174   LINK_COMPONENTS
175     Object
176     Support
177   )