labath created this revision.
Herald added a subscriber: srhines.
Herald added a reviewer: EricWF.

This adds support for building libc++ tests when targetting android. The
tests are still not passing due to several other problems, but this way
we can at least build them.


https://reviews.llvm.org/D30737

Files:
  packages/Python/lldbsuite/test/make/Android.rules
  packages/Python/lldbsuite/test/make/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -324,15 +324,19 @@
 ifeq (1,$(USE_LIBCPP))
        # Clang requires an extra flag: -stdlib=libstdc++
        ifneq (,$(findstring clang,$(CC)))
+               CXXFLAGS += -DLLDB_USING_LIBCPP
                ifeq "$(OS)" "Linux"
                        # This is the default install location on Ubuntu 14.04
                        ifneq ($(wildcard /usr/include/c++/v1/.),)
-                               CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+                               CXXFLAGS += -stdlib=libc++
                                LDFLAGS += -stdlib=libc++
                                CXXFLAGS += -I/usr/include/c++/v1
                        endif
+               else ifeq "$(OS)" "Android"
+                       # Nothing to do, this is already handled in
+                       # Android.rules.
                else
-                       CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+                       CXXFLAGS += -stdlib=libc++
                        LDFLAGS += -stdlib=libc++
                endif
        endif
Index: packages/Python/lldbsuite/test/make/Android.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Android.rules
+++ packages/Python/lldbsuite/test/make/Android.rules
@@ -61,11 +61,23 @@
                -gcc-toolchain 
$(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
-ARCH_CFLAGS += \
-       
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \
-       -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-       -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-       -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-ARCH_LDFLAGS += -lm \
-       
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
 \
-       
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_LDFLAGS += 
--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+
+ifeq (1,$(USE_LIBCPP))
+       ARCH_CFLAGS += \
+               -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+               -isystem $(NDK_ROOT)/sources/android/support/include \
+               -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+
+       ARCH_LDFLAGS += \
+               -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+               
-l$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+else
+       ARCH_CFLAGS += \
+               -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
+               -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
+               -isystem 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+
+       ARCH_LDFLAGS += 
$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
+endif


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -324,15 +324,19 @@
 ifeq (1,$(USE_LIBCPP))
 	# Clang requires an extra flag: -stdlib=libstdc++
 	ifneq (,$(findstring clang,$(CC)))
+		CXXFLAGS += -DLLDB_USING_LIBCPP
 		ifeq "$(OS)" "Linux"
 			# This is the default install location on Ubuntu 14.04
 			ifneq ($(wildcard /usr/include/c++/v1/.),)
-				CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+				CXXFLAGS += -stdlib=libc++
 				LDFLAGS += -stdlib=libc++
 				CXXFLAGS += -I/usr/include/c++/v1
 			endif
+		else ifeq "$(OS)" "Android"
+			# Nothing to do, this is already handled in
+			# Android.rules.
 		else
-			CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP
+			CXXFLAGS += -stdlib=libc++
 			LDFLAGS += -stdlib=libc++
 		endif
 	endif
Index: packages/Python/lldbsuite/test/make/Android.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Android.rules
+++ packages/Python/lldbsuite/test/make/Android.rules
@@ -61,11 +61,23 @@
 		-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
 endif
 
-ARCH_CFLAGS += \
-	--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-	-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-ARCH_LDFLAGS += -lm \
-	$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a \
-	--sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)
+ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
+
+ifeq (1,$(USE_LIBCPP))
+	ARCH_CFLAGS += \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
+		-isystem $(NDK_ROOT)/sources/android/support/include \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
+
+	ARCH_LDFLAGS += \
+		-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
+		-l$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+else
+	ARCH_CFLAGS += \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+
+	ARCH_LDFLAGS += $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
+endif
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D3073... Pavel Labath via Phabricator via lldb-commits

Reply via email to