CMake: update cmake_consistency_check
authorCampbell Barton <ideasman42@gmail.com>
Mon, 28 Oct 2019 16:41:34 +0000 (03:41 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 28 Oct 2019 16:46:50 +0000 (03:46 +1100)
Support for listing files which are known not to exist
(needed by standalone cycles).

build_files/cmake/cmake_consistency_check.py
build_files/cmake/cmake_consistency_check_config.py

index c56892689330bb081c16a1748de2084f0f590efb..b4c91e6ba4f936ada9f99236324c248bdce443f9 100755 (executable)
@@ -28,6 +28,7 @@ if not sys.version.startswith("3"):
 
 from cmake_consistency_check_config import (
     IGNORE_SOURCE,
+    IGNORE_SOURCE_MISSING,
     IGNORE_CMAKE,
     UTF8_CHECK,
     SOURCE_DIR,
@@ -42,6 +43,11 @@ global_h = set()
 global_c = set()
 global_refs = {}
 
+# Ignore cmake file, path pairs.
+global_ignore_source_missing = {}
+for k, v in IGNORE_SOURCE_MISSING:
+    global_ignore_source_missing.setdefault(k, []).append(v)
+
 
 def replace_line(f, i, text, keep_indent=True):
     file_handle = open(f, 'r')
@@ -137,6 +143,13 @@ def cmake_get_src(f):
             cmake_base = dirname(f)
             cmake_base_bin = os.path.join(BUILD_DIR, os.path.relpath(cmake_base, SOURCE_DIR))
 
+            # Find known missing sources list (if we have one).
+            f_rel = os.path.relpath(f, SOURCE_DIR)
+            f_rel_key = f_rel
+            if os.sep != "/":
+                f_rel_key = f_rel_key.replace(os.sep, "/")
+            local_ignore_source_missing = global_ignore_source_missing.get(f_rel_key, [])
+
             while it is not None:
                 i += 1
                 try:
@@ -214,7 +227,10 @@ def cmake_get_src(f):
                                     # replace_line(f, i - 1, new_path_rel)
 
                             else:
-                                raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
+                                if l in local_ignore_source_missing:
+                                    local_ignore_source_missing.remove(l)
+                                else:
+                                    raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
 
                         # print(new_file)
 
@@ -344,6 +360,12 @@ def main():
         if not ignore_used_source[index]:
             print("unused ignore: %r" % ig)
 
+    # Check ignores aren't stale
+    print("\nCheck for unused 'IGNORE_SOURCE_MISSING' paths...")
+    for k, v in sorted(global_ignore_source_missing.items()):
+        for ig in v:
+            print("unused ignore: %r -> %r" % (ig, k))
+
     # Check ignores aren't stale
     print("\nCheck for unused 'IGNORE_CMAKE' paths...")
     for index, ig in enumerate(IGNORE_CMAKE):
index 7ecfe6f1e5f4205f3ccc4f7fadf6594bbf281a9f..c3a1036af426fe5b3a52b6c185e91dabfa5595c7 100644 (file)
@@ -17,8 +17,6 @@ IGNORE_SOURCE = (
     "extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp",
     "extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp",
     "extern/bullet2/src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp",
-    "intern/audaspace/SRC/AUD_SRCResampleFactory.cpp",
-    "intern/audaspace/SRC/AUD_SRCResampleReader.cpp",
 
     "doc/doxygen/doxygen.extern.h",
     "doc/doxygen/doxygen.intern.h",
@@ -32,8 +30,12 @@ IGNORE_SOURCE = (
     "extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.h",
     "extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.h",
     "extern/bullet2/src/BulletDynamics/ConstraintSolver/btUniversalConstraint.h",
-    "intern/audaspace/SRC/AUD_SRCResampleFactory.h",
-    "intern/audaspace/SRC/AUD_SRCResampleReader.h",
+)
+
+# Ignore cmake file, path pairs.
+IGNORE_SOURCE_MISSING = (
+    # Use for cycles stand-alone.
+    ("intern/cycles/util/CMakeLists.txt", "../../third_party/numaapi/include"),
 )
 
 IGNORE_CMAKE = (