[Lldb-commits] [lldb] r292212 - [cmake] Make lldb build with the android ndk toolchain file

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 17 03:55:00 PST 2017


Author: labath
Date: Tue Jan 17 05:55:00 2017
New Revision: 292212

URL: http://llvm.org/viewvc/llvm-project?rev=292212&view=rev
Log:
[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

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/cmake/LLDBDependencies.cmake
    lldb/trunk/cmake/modules/LLDBConfig.cmake
    lldb/trunk/cmake/platforms/Android.cmake
    lldb/trunk/source/Host/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/CMakeLists.txt
    lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Jan 17 05:55:00 2017
@@ -4,7 +4,7 @@ include(cmake/modules/LLDBStandalone.cma
 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)

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Tue Jan 17 05:55:00 2017
@@ -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

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Jan 17 05:55:00 2017
@@ -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)

Modified: lldb/trunk/cmake/platforms/Android.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/cmake/platforms/Android.cmake (original)
+++ lldb/trunk/cmake/platforms/Android.cmake Tue Jan 17 05:55:00 2017
@@ -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

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Jan 17 05:55:00 2017
@@ -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

Modified: lldb/trunk/source/Plugins/Process/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/CMakeLists.txt?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/CMakeLists.txt Tue Jan 17 05:55:00 2017
@@ -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")

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=292212&r1=292211&r2=292212&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Tue Jan 17 05:55:00 2017
@@ -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




More information about the lldb-commits mailing list