1#add_subdirectory(arm64) 2#add_subdirectory(arm) 3add_subdirectory(i386) 4#add_subdirectory(ppc) 5add_subdirectory(x86_64) 6 7include_directories(..) 8 9set(generated_mach_interfaces 10 ${CMAKE_CURRENT_BINARY_DIR}/mach_exc.h 11 ${CMAKE_CURRENT_BINARY_DIR}/mach_excServer.c 12 ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c 13 ) 14add_custom_command(OUTPUT ${generated_mach_interfaces} 15 COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs 16 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs 17 ) 18 19set(DEBUGSERVER_VERS_GENERATED_FILE ${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c) 20set_source_files_properties(${DEBUGSERVER_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) 21 22add_custom_command(OUTPUT ${DEBUGSERVER_VERS_GENERATED_FILE} 23 COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl 24 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj debugserver 25 > ${DEBUGSERVER_VERS_GENERATED_FILE} 26 DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl 27 ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj 28 ) 29 30set(DEBUGSERVER_USED_LIBS 31 lldbDebugserverCommon 32 lldbUtility 33 lldbDebugserverMacOSX_I386 34 lldbDebugserverMacOSX_X86_64 35 ) 36 37add_lldb_executable(debugserver 38 HasAVX.s 39 CFBundle.cpp 40 CFData.cpp 41 CFString.cpp 42 Genealogy.cpp 43 MachException.cpp 44 MachProcess.mm 45 MachTask.mm 46 MachThread.cpp 47 MachThreadList.cpp 48 MachVMMemory.cpp 49 MachVMRegion.cpp 50 ${generated_mach_interfaces} 51 ${DEBUGSERVER_VERS_GENERATED_FILE} 52 ) 53 54set_source_files_properties( 55 HasAVX.s 56 # Necessary since compilation will fail with stand-alone assembler 57 PROPERTIES LANGUAGE C COMPILE_FLAGS "-x assembler-with-cpp" 58 ) 59 60target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS}) 61 62set(LLDB_CODESIGN_IDENTITY "lldb_codesign" 63 CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.") 64if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) 65 execute_process( 66 COMMAND xcrun -f codesign_allocate 67 OUTPUT_STRIP_TRAILING_WHITESPACE 68 OUTPUT_VARIABLE CODESIGN_ALLOCATE 69 ) 70 # Older cmake versions don't support "-E env". 71 if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2) 72 add_custom_command(TARGET debugserver 73 POST_BUILD 74 # Note: --entitlements option removed, as it causes errors when debugging. 75 # was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${LLDB_CODESIGN_IDENTITY} debugserver 76 COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${LLDB_CODESIGN_IDENTITY} debugserver 77 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin 78 ) 79 else() 80 add_custom_command(TARGET debugserver 81 POST_BUILD 82 # Note: --entitlements option removed (see comment above). 83 COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${LLDB_CODESIGN_IDENTITY} debugserver 84 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin 85 ) 86 endif() 87endif() 88 89install(TARGETS debugserver 90 RUNTIME DESTINATION bin 91 ) 92