1set(LLVM_NO_RTTI 1)
2
3#add_subdirectory(arm)
4add_subdirectory(i386)
5#add_subdirectory(ppc)
6add_subdirectory(x86_64)
7
8include_directories(..)
9
10set(generated_mach_interfaces
11  ${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h
12  ${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c
13  ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
14  )
15add_custom_command(OUTPUT ${generated_mach_interfaces}
16  COMMAND mig -I${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs
17  DEPENDS ${dnbconfig_header}
18  )
19
20set(DEBUGSERVER_USED_LIBS
21  lldbDebugserverCommon
22  lldbUtility
23  lldbDebugserverMacOSX_I386
24  lldbDebugserverMacOSX_X86_64
25  )
26
27add_lldb_executable(debugserver
28  ${dnbconfig_header}
29  HasAVX.s
30  CFBundle.cpp
31  CFData.cpp
32  CFString.cpp
33  MachException.cpp
34  MachProcess.cpp
35  MachTask.cpp
36  MachThread.cpp
37  MachThreadList.cpp
38  MachVMMemory.cpp
39  MachVMRegion.cpp
40  ${generated_mach_interfaces}
41  )
42
43add_dependencies(debugserver generate_dnbconfig)
44target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})
45
46# Sign the debugserver binary
47set (CODESIGN_IDENTITY lldb_codesign)
48set (CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
49add_custom_command(TARGET debugserver
50  POST_BUILD
51  COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
52  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
53  )
54
55install(TARGETS debugserver
56  RUNTIME DESTINATION bin
57  )
58