summaryrefslogtreecommitdiffstats
path: root/llvm/utils/gn/build
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-01-04 17:14:55 +0000
committerNico Weber <nicolasweber@gmx.de>2019-01-04 17:14:55 +0000
commit2c497b51bcd14dc6de869a6acf58b71ce80a25df (patch)
treef227ee2b30052c274c60be0c9aa72b50e8ab4591 /llvm/utils/gn/build
parent421c17fe4585d14efbd218eac3f9b81c0a6031e8 (diff)
downloadbcm5719-llvm-2c497b51bcd14dc6de869a6acf58b71ce80a25df.tar.gz
bcm5719-llvm-2c497b51bcd14dc6de869a6acf58b71ce80a25df.zip
[gn build] Start adding build files for LLVM unittests
Adds build files for //llvm/unittest/[A-D]. Also teach sync_source_lists_from_cmake.py to not complain about missing BUILD.gn files for CMakeLists.txt files that just call add_subdirectory() without calling add_.+_unittest, like e.g. llvm/unittests/Target/CMakeLists.txt. (Omits CodeGen/GlobalISel and DebugInfo/PDB because their build files are somewhat interesting, and this patch is already on the larger side.) Differential Revision: https://reviews.llvm.org/D56212 llvm-svn: 350411
Diffstat (limited to 'llvm/utils/gn/build')
-rwxr-xr-xllvm/utils/gn/build/sync_source_lists_from_cmake.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index f5d92ce0bba..03cba7ad396 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -21,9 +21,9 @@ def sync_source_lists():
gn_files = subprocess.check_output(
['git', 'ls-files', '*BUILD.gn']).splitlines()
- # Matches e.g. | "foo.cpp",|.
+ # Matches e.g. | "foo.cpp",|, captures |foo| in group 1.
gn_cpp_re = re.compile(r'^\s*"([^"]+\.(?:cpp|h))",$', re.MULTILINE)
- # Matches e.g. | "foo.cpp"|.
+ # Matches e.g. | foo.cpp|, captures |foo| in group 1.
cmake_cpp_re = re.compile(r'^\s*([A-Za-z_0-9/-]+\.(?:cpp|h))$',
re.MULTILINE)
@@ -57,12 +57,18 @@ def sync_source_lists():
def sync_unittests():
+ # Matches e.g. |add_llvm_unittest_with_input_files|.
+ unittest_re = re.compile(r'^add_\S+_unittest', re.MULTILINE)
+
+ # FIXME: Add 'llvm' here once it's complete.
checked = [ 'clang', 'lld' ]
for c in checked:
for root, _, _ in os.walk(os.path.join(c, 'unittests')):
cmake_file = os.path.join(root, 'CMakeLists.txt')
if not os.path.exists(cmake_file):
continue
+ if not unittest_re.search(open(cmake_file).read()):
+ continue # Skip CMake files that just add subdirectories.
gn_file = os.path.join('llvm/utils/gn/secondary', root, 'BUILD.gn')
if not os.path.exists(gn_file):
print('missing GN file %s for unittest CMake file %s' %
OpenPOWER on IntegriCloud