[cmake] Make lldb build with the android ndk toolchain file

Summary:
The NDK cmake toolchain file defines CMAKE_SYSTEM_NAME=Android, so switch the
build to use that. I have also updated the in-tree toolchain file to do that
(instead of defining __ANDROID_NDK__), so it can still be used to build.
After migrating the last bits of non-toolchainy bits out of the in-tree
toolchain, I intend to delete it.

Reviewers: tberghammer, danalbert

Subscribers: srhines, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D28775

llvm-svn: 292212
This commit is contained in:
Pavel Labath 2017-01-17 11:55:00 +00:00
parent 1bcd53f0e7
commit e5cfc67113
7 changed files with 19 additions and 26 deletions

View File

@ -4,7 +4,7 @@ include(cmake/modules/LLDBStandalone.cmake)
include(cmake/modules/LLDBConfig.cmake)
include(cmake/modules/AddLLDB.cmake)
if (__ANDROID_NDK__ OR (CMAKE_SYSTEM_NAME MATCHES "Windows"))
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
else()
set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)

View File

@ -97,7 +97,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
endif ()
# Linux-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
list(APPEND LLDB_USED_LIBS
lldbPluginProcessLinux
lldbPluginProcessPOSIX

View File

@ -13,14 +13,12 @@ endif()
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
else()
if ( __ANDROID_NDK__ )
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
else()
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
set(LLDB_DEFAULT_DISABLE_CURSES 0)
endif()
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
set(LLDB_DEFAULT_DISABLE_CURSES 0)
endif()
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
@ -354,10 +352,7 @@ endif()
# Figure out if lldb could use lldb-server. If so, then we'll
# ensure we build lldb-server when an lldb target is being built.
if ((CMAKE_SYSTEM_NAME MATCHES "Darwin") OR
(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") OR
(CMAKE_SYSTEM_NAME MATCHES "Linux") OR
(CMAKE_SYSTEM_NAME MATCHES "NetBSD"))
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
set(LLDB_CAN_USE_LLDB_SERVER 1)
else()
set(LLDB_CAN_USE_LLDB_SERVER 0)

View File

@ -29,13 +29,12 @@ if( IS_IN_TRY_COMPILE )
return()
endif()
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_NAME Android )
include( CMakeForceCompiler )
# flags and definitions
add_definitions( -DANDROID -DLLDB_DISABLE_LIBEDIT )
set( ANDROID True )
set( __ANDROID_NDK__ True )
set( LLDB_DEFAULT_DISABLE_LIBEDIT True )
# linking lldb-server statically for Android avoids the need to ship two

View File

@ -88,7 +88,7 @@ else()
posix/PipePosix.cpp
)
if (NOT __ANDROID_NDK__)
if (NOT (CMAKE_SYSTEM_NAME MATCHES "Android"))
add_host_subdirectory(posix
posix/ProcessLauncherPosix.cpp
)
@ -110,13 +110,7 @@ else()
macosx/cfcpp/CFCString.cpp
)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
if (__ANDROID_NDK__)
add_host_subdirectory(android
android/HostInfoAndroid.cpp
android/LibcGlue.cpp
)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
add_host_subdirectory(linux
linux/AbstractSocket.cpp
linux/Host.cpp
@ -126,7 +120,12 @@ else()
linux/ProcessLauncherLinux.cpp
linux/ThisThread.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "Android")
add_host_subdirectory(android
android/HostInfoAndroid.cpp
android/LibcGlue.cpp
)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_host_subdirectory(freebsd
freebsd/Host.cpp

View File

@ -1,4 +1,4 @@
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
add_subdirectory(Linux)
add_subdirectory(POSIX)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")

View File

@ -77,7 +77,7 @@ set( LLDB_USED_LIBS
)
# Linux-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" )
list(APPEND LLDB_USED_LIBS
lldbPluginProcessLinux
lldbPluginProcessPOSIX