Hi danalbert, jroelofs,
The main section of this patch teaches CMake a new option
`LIBCXXABI_LIBCXX_PATH` that specifies the path to the libcxx source root. This
information is passed to lit so that it can better find libc++'s python module.
`LIBCXXABI_LIBCXX_PATH` is also used to help find the libc++ headers.
The rest of this patch is misc cleanup, mostly to make pep8 and pylint happy.
I've also copied libc++'s .gitignore into libc++abi.
http://reviews.llvm.org/D7130
Files:
.gitignore
CMakeLists.txt
test/libcxxabi/test/config.py
test/lit.cfg
test/lit.site.cfg.in
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: .gitignore
===================================================================
--- /dev/null
+++ .gitignore
@@ -0,0 +1,54 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+#lib/ # We actually have things checked in to lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -97,6 +97,7 @@
set(LIBCXXABI_BUILT_STANDALONE 1)
else()
+ set(LLVM_MAIN_SRC_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Path to LLVM source tree")
set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
set(LIBCXXABI_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
endif()
@@ -126,14 +127,32 @@
LIBCXXABI_LIBCXX_INCLUDES
vector
PATHS ${LIBCXXABI_LIBCXX_INCLUDES}
+ ${LIBCXXABI_LIBCXX_PATH}/include
${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
${LLVM_INCLUDE_DIR}/c++/v1
)
-set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE STRING
+set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
"Specify path to libc++ includes." FORCE)
+find_path(
+ LIBCXXABI_LIBCXX_PATH
+ test/libcxx/__init__.py
+ PATHS ${LIBCXXABI_LIBCXX_PATH}
+ ${LIBCXXABI_LIBCXX_INCLUDES}/../
+ ${LLVM_MAIN_SRC_DIR}/projects/libcxx/
+ NO_DEFAULT_PATH
+ )
+
+if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
+ message(WARNING "LIBCXXABI_LIBCXX_PATH was not specified and couldn't be infered.")
+ set(LIBCXXABI_LIBCXX_PATH "")
+endif()
+
+set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
+ "Specify path to libc++ source." FORCE)
+
#===============================================================================
# Configure System
#===============================================================================
Index: test/libcxxabi/test/config.py
===================================================================
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -1,26 +1,23 @@
-import locale
import os
-import platform
-import re
-import shlex
import sys
-import lit.Test # pylint: disable=import-error,no-name-in-module
-import lit.util # pylint: disable=import-error,no-name-in-module
-
-from libcxx.test.format import LibcxxTestFormat
from libcxx.test.config import Configuration as LibcxxConfiguration
-from libcxx.compiler import CXXCompiler
+
class Configuration(LibcxxConfiguration):
# pylint: disable=redefined-outer-name
def __init__(self, lit_config, config):
super(Configuration, self).__init__(lit_config, config)
+ self.libcxxabi_src_root = None
+ self.libcxx_src_root = None
+ self.obj_root = None
def configure_src_root(self):
- self.libcxxabi_src_root = self.get_lit_conf('libcxxabi_src_root',
+ self.libcxxabi_src_root = self.get_lit_conf(
+ 'libcxxabi_src_root',
os.path.dirname(self.config.test_source_root))
- self.libcxx_src_root = self.get_lit_conf('libcxx_src_root',
+ self.libcxx_src_root = self.get_lit_conf(
+ 'libcxx_src_root',
os.path.join(self.libcxxabi_src_root, '/../libcxx'))
def configure_obj_root(self):
@@ -32,16 +29,17 @@
super(Configuration, self).configure_compile_flags()
def configure_compile_flags_header_includes(self):
- cxx_headers = self.get_lit_conf('cxx_headers',
+ cxx_headers = self.get_lit_conf(
+ 'cxx_headers',
os.path.join(self.libcxx_src_root, '/include'))
if not os.path.isdir(cxx_headers):
self.lit_config.fatal("cxx_headers='%s' is not a directory."
% cxx_headers)
self.cxx.compile_flags += ['-I' + cxx_headers]
- libcxxabi_headers = self.get_lit_conf('libcxxabi_headers',
- os.path.join(self.libcxxabi_src_root,
- 'include'))
+ libcxxabi_headers = self.get_lit_conf(
+ 'libcxxabi_headers',
+ os.path.join(self.libcxxabi_src_root, 'include'))
if not os.path.isdir(libcxxabi_headers):
self.lit_config.fatal("libcxxabi_headers='%s' is not a directory."
% libcxxabi_headers)
Index: test/lit.cfg
===================================================================
--- test/lit.cfg
+++ test/lit.cfg
@@ -26,9 +26,9 @@
# Infer the libcxx_test_source_root for configuration import.
# If libcxx_source_root isn't specified in the config, assume that the libcxx
# and libcxxabi source directories are sibling directories.
-libcxx_source_root = getattr(config, 'libcxx_source_root',
- os.path.join(config.test_source_root,
- '../../libcxx'))
+libcxx_source_root = getattr(config, 'libcxx_src_root', None)
+if not libcxx_source_root:
+ libcxx_source_root = os.path.join(config.test_source_root, '../../libcxx')
libcxx_test_source_root = os.path.join(libcxx_source_root, 'test')
if os.path.isdir(libcxx_test_source_root):
sys.path.insert(0, libcxx_test_source_root)
@@ -48,7 +48,7 @@
# configuration hasn't been created by the build system, or we are in an
# out-of-tree build situation).
site_cfg = lit_config.params.get('libcxxabi_site_config',
- os.environ.get('LIBCXX_SITE_CONFIG'))
+ os.environ.get('LIBCXXABI_SITE_CONFIG'))
if not site_cfg:
lit_config.warning('No site specific configuration file found!'
' Running the tests in the default configuration.')
@@ -73,4 +73,5 @@
configuration = config_module.Configuration(lit_config, config)
configuration.configure()
+configuration.print_config_info()
config.test_format = configuration.get_test_format()
Index: test/lit.site.cfg.in
===================================================================
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -2,6 +2,7 @@
config.cxx_under_test = "@LIBCXXABI_COMPILER@"
config.libcxxabi_src_root = "@LIBCXXABI_SOURCE_DIR@"
config.libcxxabi_obj_root = "@LIBCXXABI_LIBRARY_DIR@"
+config.libcxx_src_root = "@LIBCXXABI_LIBCXX_PATH@"
config.cxx_headers = "@LIBCXXABI_LIBCXX_INCLUDES@"
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
config.enable_threads = "@LIBCXXABI_ENABLE_THREADS@"
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits