[Lldb-commits] [lldb] r308377 - [CMake] Refactor debugserver build system

Chris Bieneman via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 18 14:15:27 PDT 2017


Author: cbieneman
Date: Tue Jul 18 14:15:27 2017
New Revision: 308377

URL: http://llvm.org/viewvc/llvm-project?rev=308377&view=rev
Log:
[CMake] Refactor debugserver build system

This refactoring changes two significant things about how the debugserver build system works:

(1) debugserver will include all appropriate architecture support, so we can now build arm or ppc debugservers
(2) debugserver can be built by itself, so you don't have to configure all of LLDB in order to generate debugserver.

Removed:
    lldb/trunk/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
    lldb/trunk/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
Modified:
    lldb/trunk/tools/debugserver/CMakeLists.txt
    lldb/trunk/tools/debugserver/source/CMakeLists.txt
    lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
    lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt

Modified: lldb/trunk/tools/debugserver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/CMakeLists.txt?rev=308377&r1=308376&r2=308377&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/CMakeLists.txt Tue Jul 18 14:15:27 2017
@@ -1,2 +1,19 @@
-project(C CXX ASM-ATT)
+cmake_minimum_required(VERSION 3.4.3)
+
+project(Debugserver LANGUAGES C CXX ASM-ATT)
+
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(CMAKE_MODULE_PATH
+    ${CMAKE_MODULE_PATH}
+    "${CMAKE_SOURCE_DIR}/../../cmake"
+    "${CMAKE_SOURCE_DIR}/../../cmake/modules"
+    )
+  
+  include(LLDBStandalone)
+  include(AddLLDB)
+
+  set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
+  include_directories(${LLDB_SOURCE_DIR}/include)
+endif()
+
 add_subdirectory(source)

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=308377&r1=308376&r2=308377&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Jul 18 14:15:27 2017
@@ -1,3 +1,4 @@
+include(CheckCXXCompilerFlag)
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
 include_directories(${LLDB_SOURCE_DIR}/source)
 include_directories(MacOSX/DarwinLog)
@@ -25,7 +26,6 @@ if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
 endif ()
 
-find_library(COCOA_LIBRARY Cocoa)
 add_subdirectory(MacOSX)
 
 set(generated_mach_interfaces
@@ -91,11 +91,23 @@ set(lldbDebugserverCommonSources
 
 add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
 
+
+if (APPLE)
+  if(IOS)
+    find_library(COCOA_LIBRARY UIKit)
+    target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY})
+  else()
+    find_library(COCOA_LIBRARY Cocoa)
+    target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY})
+  endif()
+endif()
+
 target_link_libraries(lldbDebugserverCommon
                       INTERFACE ${COCOA_LIBRARY}
-                      lldbDebugserverMacOSX_I386
-                      lldbDebugserverMacOSX_X86_64
-                      lldbDebugserverMacOSX_DarwinLog)
+                      ${CORE_FOUNDATION_LIBRARY}
+                      ${FOUNDATION_LIBRARY}
+                      lldbDebugserverArchSupport
+                      lldbDebugserverDarwin_DarwinLog)
 
 set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
 add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK

Modified: lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt?rev=308377&r1=308376&r2=308377&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt Tue Jul 18 14:15:27 2017
@@ -1,8 +1,23 @@
-#add_subdirectory(arm64)
-#add_subdirectory(arm)
-add_subdirectory(i386)
-#add_subdirectory(ppc)
-add_subdirectory(x86_64)
+if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*arm.*")
+  list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp)
+  include_directories(${CURRENT_SOURCE_DIR}/arm ${CURRENT_SOURCE_DIR}/arm64)
+endif()
+
+if(NOT CMAKE_OSX_ARCHITECTURES OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*86.*")
+  list(APPEND SOURCES i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp)
+  include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64)
+endif()
+
+if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*ppc.*")
+  list(APPEND SOURCES ppc/DNBArchImpl.cpp)
+  include_directories(${CURRENT_SOURCE_DIR}/ppc)
+endif()
+
 add_subdirectory(DarwinLog)
 
 include_directories(..)
+
+include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
+add_library(lldbDebugserverArchSupport
+  ${SOURCES}
+  )

Modified: lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt?rev=308377&r1=308376&r2=308377&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt Tue Jul 18 14:15:27 2017
@@ -3,7 +3,7 @@
 # we must include the grandparent directory...
 include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
 
-add_library(lldbDebugserverMacOSX_DarwinLog
+add_library(lldbDebugserverDarwin_DarwinLog
   ActivityStore.cpp
   DarwinLogCollector.cpp
   LogFilter.cpp

Removed: lldb/trunk/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/CMakeLists.txt?rev=308376&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/CMakeLists.txt (removed)
@@ -1,4 +0,0 @@
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-add_library(lldbDebugserverMacOSX_I386
-  DNBArchImplI386.cpp
-  )

Removed: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt?rev=308376&view=auto
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt (removed)
@@ -1,8 +0,0 @@
-# Due to sources including headers like:
-# #include "MacOSX/i386/DNBArchImplI386.h"
-# we must include the grandparent directory...
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-
-add_library(lldbDebugserverMacOSX_X86_64
-  DNBArchImplX86_64.cpp
-  )




More information about the lldb-commits mailing list