xref: /openbsd-src/gnu/llvm/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt (revision 58fbf5d6aa35e3d66f2c32c61d2f38824a990e85)
1# The debugserver build needs to conditionally include files depending on the
2# target architecture.
3#
4# Switch on the architecture specified by TARGET_TRIPLE, as
5# the llvm and swift build systems use this variable to identify the
6# target (through LLVM_HOST_TRIPLE).
7#
8# It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift
9# build does not provide it, preferring instead to pass arch-specific
10# CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option,
11# but it breaks down when cross-compiling.
12
13if(TARGET_TRIPLE)
14  string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH ${TARGET_TRIPLE})
15else()
16  set(LLDB_DEBUGSERVER_ARCH ${CMAKE_OSX_ARCHITECTURES})
17endif()
18
19if("${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*arm.*")
20  list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp)
21  include_directories(${CURRENT_SOURCE_DIR}/arm ${CURRENT_SOURCE_DIR}/arm64)
22endif()
23
24if(NOT LLDB_DEBUGSERVER_ARCH OR "${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*86.*")
25  list(APPEND SOURCES i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp)
26  include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64)
27endif()
28
29if("${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*ppc.*")
30  list(APPEND SOURCES ppc/DNBArchImpl.cpp)
31  include_directories(${CURRENT_SOURCE_DIR}/ppc)
32endif()
33
34add_subdirectory(DarwinLog)
35
36include_directories(..)
37
38include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
39add_library(lldbDebugserverArchSupport
40  ${SOURCES}
41  )
42
43set_target_properties(lldbDebugserverArchSupport PROPERTIES FOLDER "lldb libraries/debugserver")
44