blob: 333f109a9a26b84c686279c08a7b961ba92fa602 [file] [log] [blame]
Zachary Turner4ec5d0d2014-08-15 23:50:36 +00001macro(add_host_subdirectory group)
2 list(APPEND HOST_SOURCES ${ARGN})
Zachary Turner3ffabc22014-08-18 16:47:33 +00003 source_group(${group} FILES ${ARGN})
Zachary Turner4ec5d0d2014-08-15 23:50:36 +00004endmacro()
5
Raphael Isemann2c77eef2018-06-13 15:50:45 +00006# Removes all module flags from the current CMAKE_CXX_FLAGS. Used for
7# the Objective-C++ code in lldb which we don't want to build with modules.
8# Reasons for this are that modules with Objective-C++ would require that
9# all LLVM/Clang modules are Objective-C++ compatible (which they are likely
10# not) and we would have rebuild a second set of modules just for the few
11# Objective-C++ files in lldb (which slows down the build process).
12macro(remove_module_flags)
13 string(REGEX REPLACE "-fmodules-cache-path=[^ ]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Adrian Prantle884ccb2018-11-09 00:49:18 +000014 string(REGEX REPLACE "-fmodules-local-submodule-visibility" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Raphael Isemann2c77eef2018-06-13 15:50:45 +000015 string(REGEX REPLACE "-fmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Adrian Prantle884ccb2018-11-09 00:49:18 +000016 string(REGEX REPLACE "-gmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Raphael Isemann2c77eef2018-06-13 15:50:45 +000017 string(REGEX REPLACE "-fcxx-modules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
18endmacro()
19
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000020add_host_subdirectory(common
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000021 common/File.cpp
22 common/FileCache.cpp
Oleksiy Vyalov7a9e7622015-02-20 18:34:03 +000023 common/FileSystem.cpp
Pavel Labatha04668f2015-09-04 09:06:15 +000024 common/GetOptInc.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000025 common/Host.cpp
Zachary Turner97a14e62014-08-19 17:18:29 +000026 common/HostInfoBase.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000027 common/HostNativeThreadBase.cpp
Zachary Turnerf5e4f372014-09-11 22:22:16 +000028 common/HostProcess.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000029 common/HostThread.cpp
Oleksiy Vyalov919ef9d2015-05-07 15:28:49 +000030 common/LockFileBase.cpp
Chris Bieneman11827792017-04-26 23:17:20 +000031 common/MainLoop.cpp
Zachary Turner172d37d2014-10-14 21:55:08 +000032 common/MonitoringProcessLauncher.cpp
Chaoren Lin18fe6402015-02-03 01:51:47 +000033 common/NativeWatchpointList.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000034 common/NativeProcessProtocol.cpp
Chaoren Lin2fe1d0a2015-02-03 01:51:38 +000035 common/NativeRegisterContext.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000036 common/NativeThreadProtocol.cpp
37 common/OptionParser.cpp
Oleksiy Vyalovd5f8b6a2015-01-13 23:19:40 +000038 common/PipeBase.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000039 common/ProcessRunLock.cpp
Zachary Turner24ae6292017-02-16 19:38:21 +000040 common/PseudoTerminal.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000041 common/Socket.cpp
42 common/SocketAddress.cpp
Vince Harron5275aaa2015-01-15 20:08:35 +000043 common/StringConvert.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000044 common/Symbols.cpp
Francis Ricci7ddfe8e2017-09-19 15:38:30 +000045 common/TaskPool.cpp
Oleksiy Vyalove98628c2015-10-15 23:54:09 +000046 common/TCPSocket.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000047 common/Terminal.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000048 common/ThreadLauncher.cpp
Greg Claytond04f0ed2015-05-26 18:00:51 +000049 common/XML.cpp
Oleksiy Vyalove98628c2015-10-15 23:54:09 +000050 common/UDPSocket.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000051 )
Joerg Sonnenberger340a1752013-09-25 10:37:32 +000052
Zachary Turnerd553d002014-11-17 21:31:18 +000053if (NOT LLDB_DISABLE_LIBEDIT)
54 add_host_subdirectory(common
55 common/Editline.cpp
56 )
Shawn Best8da0bf32014-11-08 01:41:49 +000057endif()
58
Zachary Turner93a66fc2014-10-06 21:22:36 +000059add_host_subdirectory(posix
60 posix/ConnectionFileDescriptorPosix.cpp
61 )
62
Zachary Turnerc00cf4a2014-08-15 22:04:21 +000063if (CMAKE_SYSTEM_NAME MATCHES "Windows")
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000064 add_host_subdirectory(windows
Zachary Turner12792af2014-10-06 21:23:09 +000065 windows/ConnectionGenericFileWindows.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000066 windows/EditLineWin.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000067 windows/FileSystem.cpp
68 windows/Host.cpp
Zachary Turner97a14e62014-08-19 17:18:29 +000069 windows/HostInfoWindows.cpp
Zachary Turner4e82ec92014-08-27 20:15:30 +000070 windows/HostProcessWindows.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000071 windows/HostThreadWindows.cpp
Oleksiy Vyalov919ef9d2015-05-07 15:28:49 +000072 windows/LockFileWindows.cpp
Zachary Turnerb2df30d2014-10-08 20:38:41 +000073 windows/PipeWindows.cpp
Zachary Turner172d37d2014-10-14 21:55:08 +000074 windows/ProcessLauncherWindows.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000075 windows/ProcessRunLock.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000076 windows/Windows.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000077 )
Zachary Turnerc00cf4a2014-08-15 22:04:21 +000078else()
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000079 add_host_subdirectory(posix
Oleksiy Vyalove98628c2015-10-15 23:54:09 +000080 posix/DomainSocket.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000081 posix/FileSystem.cpp
Zachary Turner97a14e62014-08-19 17:18:29 +000082 posix/HostInfoPosix.cpp
Zachary Turner4e82ec92014-08-27 20:15:30 +000083 posix/HostProcessPosix.cpp
Zachary Turner39de3112014-09-09 20:54:56 +000084 posix/HostThreadPosix.cpp
Oleksiy Vyalov919ef9d2015-05-07 15:28:49 +000085 posix/LockFilePosix.cpp
Zachary Turnerb2df30d2014-10-08 20:38:41 +000086 posix/PipePosix.cpp
Kamil Rytarowski816ae4b2017-02-01 14:30:40 +000087 posix/ProcessLauncherPosixFork.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000088 )
Zachary Turnerc00cf4a2014-08-15 22:04:21 +000089
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000090 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
91 include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
Raphael Isemann2c77eef2018-06-13 15:50:45 +000092 add_subdirectory(macosx/objcxx)
93 set(LLDBObjCLibs lldbHostMacOSXObjCXX)
Stefan Granitz73ee35e2018-11-12 16:22:24 +000094 add_host_subdirectory(macosx
Zachary Turner39de3112014-09-09 20:54:56 +000095 macosx/Symbols.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +000096 macosx/cfcpp/CFCBundle.cpp
97 macosx/cfcpp/CFCData.cpp
98 macosx/cfcpp/CFCMutableArray.cpp
99 macosx/cfcpp/CFCMutableDictionary.cpp
100 macosx/cfcpp/CFCMutableSet.cpp
101 macosx/cfcpp/CFCString.cpp
102 )
Chris Bienemanf6b8ac22017-07-18 21:15:53 +0000103 if(IOS)
104 set_property(SOURCE macosx/Host.mm APPEND PROPERTY
105 COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
106 endif()
Zachary Turner4ec5d0d2014-08-15 23:50:36 +0000107
Chris Bieneman494f2772017-01-31 20:43:05 +0000108
Pavel Labathe5cfc672017-01-17 11:55:00 +0000109 elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
Pavel Labath5ad891f2016-07-21 14:54:03 +0000110 add_host_subdirectory(linux
111 linux/AbstractSocket.cpp
112 linux/Host.cpp
113 linux/HostInfoLinux.cpp
Pavel Labath5ad891f2016-07-21 14:54:03 +0000114 linux/LibcGlue.cpp
Pavel Labath7e437f82017-03-15 15:08:49 +0000115 linux/Support.cpp
Pavel Labath5ad891f2016-07-21 14:54:03 +0000116 )
Pavel Labathe5cfc672017-01-17 11:55:00 +0000117 if (CMAKE_SYSTEM_NAME MATCHES "Android")
118 add_host_subdirectory(android
119 android/HostInfoAndroid.cpp
120 android/LibcGlue.cpp
121 )
122 endif()
Zachary Turner4ec5d0d2014-08-15 23:50:36 +0000123 elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
124 add_host_subdirectory(freebsd
125 freebsd/Host.cpp
Zachary Turner97a14e62014-08-19 17:18:29 +0000126 freebsd/HostInfoFreeBSD.cpp
Zachary Turner4ec5d0d2014-08-15 23:50:36 +0000127 )
Bruce Mitchener64f74da2015-10-24 00:27:04 +0000128
129 elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
130 add_host_subdirectory(netbsd
131 netbsd/Host.cpp
132 netbsd/HostInfoNetBSD.cpp
Bruce Mitchener64f74da2015-10-24 00:27:04 +0000133 )
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000134
135 elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
136 add_host_subdirectory(openbsd
137 openbsd/Host.cpp
138 openbsd/HostInfoOpenBSD.cpp
139 )
Zachary Turnerc00cf4a2014-08-15 22:04:21 +0000140 endif()
Joerg Sonnenberger340a1752013-09-25 10:37:32 +0000141endif()
Zachary Turner4ec5d0d2014-08-15 23:50:36 +0000142
Michal Gorny7e1c51e2017-08-21 17:41:33 +0000143set(EXTRA_LIBS)
Chris Bieneman987401b2017-01-31 20:52:41 +0000144if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
Michal Gorny7e1c51e2017-08-21 17:41:33 +0000145 list(APPEND EXTRA_LIBS kvm)
Chris Bieneman987401b2017-01-31 20:52:41 +0000146endif ()
Michal Gorny7e1c51e2017-08-21 17:41:33 +0000147if (APPLE)
148 list(APPEND EXTRA_LIBS xml2)
149else ()
150 if (LIBXML2_FOUND)
151 list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
152 endif()
153endif ()
154if (HAVE_LIBDL)
155 list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
156endif()
157if (NOT LLDB_DISABLE_LIBEDIT)
Tatyana Krasnukha3f166e42018-11-27 19:41:30 +0000158 list(APPEND EXTRA_LIBS ${libedit_LIBRARIES})
Michal Gorny7e1c51e2017-08-21 17:41:33 +0000159endif()
Chris Bieneman987401b2017-01-31 20:52:41 +0000160
Chris Bieneman494f2772017-01-31 20:43:05 +0000161add_lldb_library(lldbHost
162 ${HOST_SOURCES}
Raphael Isemann2c77eef2018-06-13 15:50:45 +0000163
Chris Bieneman494f2772017-01-31 20:43:05 +0000164 LINK_LIBS
165 lldbCore
Chris Bieneman494f2772017-01-31 20:43:05 +0000166 lldbSymbol
167 lldbTarget
168 lldbUtility
Chris Bieneman987401b2017-01-31 20:52:41 +0000169 ${EXTRA_LIBS}
Raphael Isemann2c77eef2018-06-13 15:50:45 +0000170 ${LLDBObjCLibs}
171
Chris Bieneman494f2772017-01-31 20:43:05 +0000172 LINK_COMPONENTS
Pavel Labath36e82202018-01-29 10:46:00 +0000173 Object
Chris Bieneman494f2772017-01-31 20:43:05 +0000174 Support
175 )
Tatyana Krasnukhac4bc88b2018-09-21 18:34:41 +0000176
177if (NOT LLDB_DISABLE_LIBEDIT)
178 target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS})
179endif()