summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2017-07-18 21:15:27 +0000
committerChris Bieneman <beanz@apple.com>2017-07-18 21:15:27 +0000
commitf396708f4c584fdbb0ddc5b23f9fb160f0b004f6 (patch)
tree44f9c67930e52670125383951d41317c642d5a7f
parent154a5ff15bb2bfb9e9394121991b109496c9eeea (diff)
downloadbcm5719-llvm-f396708f4c584fdbb0ddc5b23f9fb160f0b004f6.tar.gz
bcm5719-llvm-f396708f4c584fdbb0ddc5b23f9fb160f0b004f6.zip
[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. llvm-svn: 308377
-rw-r--r--lldb/tools/debugserver/CMakeLists.txt19
-rw-r--r--lldb/tools/debugserver/source/CMakeLists.txt20
-rw-r--r--lldb/tools/debugserver/source/MacOSX/CMakeLists.txt25
-rw-r--r--lldb/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt2
-rw-r--r--lldb/tools/debugserver/source/MacOSX/i386/CMakeLists.txt4
-rw-r--r--lldb/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt8
6 files changed, 55 insertions, 23 deletions
diff --git a/lldb/tools/debugserver/CMakeLists.txt b/lldb/tools/debugserver/CMakeLists.txt
index d8414e5a2fe..ae436b8f07c 100644
--- a/lldb/tools/debugserver/CMakeLists.txt
+++ b/lldb/tools/debugserver/CMakeLists.txt
@@ -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)
diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt
index 775a1a127b6..bdca1602f4a 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -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
diff --git a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
index 59b39a1bff6..28877d122d9 100644
--- a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -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}
+ )
diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
index 47e7362f0d5..dffa357f1e6 100644
--- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/CMakeLists.txt
@@ -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
diff --git a/lldb/tools/debugserver/source/MacOSX/i386/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
deleted file mode 100644
index dee2c1ea96b..00000000000
--- a/lldb/tools/debugserver/source/MacOSX/i386/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-include_directories(${LLDB_SOURCE_DIR}/tools/debugserver/source)
-add_library(lldbDebugserverMacOSX_I386
- DNBArchImplI386.cpp
- )
diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
deleted file mode 100644
index bb41b04d9d9..00000000000
--- a/lldb/tools/debugserver/source/MacOSX/x86_64/CMakeLists.txt
+++ /dev/null
@@ -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
- )
OpenPOWER on IntegriCloud