Allow building test suite with non-default libc++
- add new "--libcxx" parameter to dotest.py to specify path to custom libc++
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187802 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lldbtest.py b/test/lldbtest.py
index 3fbaff1..32d51b7 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -821,6 +821,11 @@
#import traceback
#traceback.print_stack()
+ if "LIBCXX_PATH" in os.environ:
+ self.libcxxPath = os.environ["LIBCXX_PATH"]
+ else:
+ self.libcxxPath = None
+
if "LLDB_EXEC" in os.environ:
self.lldbExec = os.environ["LLDB_EXEC"]
else:
@@ -1360,11 +1365,24 @@
if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
raise Exception("Don't know how to build binary with dwarf")
- def getBuildFlags(self, use_cpp11=True, use_pthreads=True):
+ def getBuildFlags(self, use_cpp11=True, use_libcxx=False, use_libstdcxx=False, use_pthreads=True):
""" Returns a dictionary (which can be provided to build* functions above) which
contains OS-specific build flags.
"""
cflags = ""
+
+ # On Mac OS X, unless specifically requested to use libstdc++, use libc++
+ if not use_libstdcxx and sys.platform.startswith('darwin'):
+ use_libcxx = True
+
+ if use_libcxx and self.libcxxPath:
+ cflags += "-stdlib=libc++ "
+ if self.libcxxPath:
+ libcxxInclude = os.path.join(self.libcxxPath, "include")
+ libcxxLib = os.path.join(self.libcxxPath, "lib")
+ if os.path.isdir(libcxxInclude) and os.path.isdir(libcxxLib):
+ cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (libcxxInclude, libcxxLib, libcxxLib)
+
if use_cpp11:
cflags += "-std="
if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():