[Bf-blender-cvs] [fb057153b05] master: CMake: update checker

Campbell Barton noreply at git.blender.org
Wed Nov 28 22:55:24 CET 2018


Commit: fb057153b05555606d801d1e942113d40ec15cec
Author: Campbell Barton
Date:   Thu Nov 29 08:49:50 2018 +1100
Branches: master
https://developer.blender.org/rBfb057153b05555606d801d1e942113d40ec15cec

CMake: update checker

Support skipping cmake files

===================================================================

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

===================================================================

diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py
index ab87095874f..90a9631fe79 100755
--- a/build_files/cmake/cmake_consistency_check.py
+++ b/build_files/cmake/cmake_consistency_check.py
@@ -29,7 +29,8 @@ if not sys.version.startswith("3"):
     sys.exit(1)
 
 from cmake_consistency_check_config import (
-    IGNORE,
+    IGNORE_SOURCE,
+    IGNORE_CMAKE,
     UTF8_CHECK,
     SOURCE_DIR,
     BUILD_DIR,
@@ -156,6 +157,7 @@ def cmake_get_src(f):
                         break
 
                     # replace dirs
+                    l = l.replace("${CMAKE_SOURCE_DIR}", SOURCE_DIR)
                     l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
                     l = l.replace("${CMAKE_CURRENT_BINARY_DIR}", cmake_base_bin)
                     l = l.strip('"')
@@ -238,8 +240,16 @@ def cmake_get_src(f):
     filen.close()
 
 
-def is_ignore(f, ignore_used):
-    for index, ig in enumerate(IGNORE):
+def is_ignore_source(f, ignore_used):
+    for index, ig in enumerate(IGNORE_SOURCE):
+        if ig in f:
+            ignore_used[index] = True
+            return True
+    return False
+
+
+def is_ignore_cmake(f, ignore_used):
+    for index, ig in enumerate(IGNORE_CMAKE):
         if ig in f:
             ignore_used[index] = True
             return True
@@ -250,8 +260,12 @@ def main():
 
     print("Scanning:", SOURCE_DIR)
 
+    ignore_used_source = [False] * len(IGNORE_SOURCE)
+    ignore_used_cmake = [False] * len(IGNORE_CMAKE)
+
     for cmake in source_list(SOURCE_DIR, is_cmake):
-        cmake_get_src(cmake)
+        if not is_ignore_cmake(cmake, ignore_used_cmake):
+            cmake_get_src(cmake)
 
     # First do stupid check, do these files exist?
     print("\nChecking for missing references:")
@@ -282,12 +296,10 @@ def main():
     del is_err
     del errs
 
-    ignore_used = [False] * len(IGNORE)
-
     # now check on files not accounted for.
     print("\nC/C++ Files CMake does not know about...")
     for cf in sorted(source_list(SOURCE_DIR, is_c)):
-        if not is_ignore(cf, ignore_used):
+        if not is_ignore_source(cf, ignore_used_source):
             if cf not in global_c:
                 print("missing_c: ", cf)
 
@@ -304,7 +316,7 @@ def main():
 
     print("\nC/C++ Headers CMake does not know about...")
     for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
-        if not is_ignore(hf, ignore_used):
+        if not is_ignore_source(hf, ignore_used_source):
             if hf not in global_h:
                 print("missing_h: ", hf)
 
@@ -326,9 +338,15 @@ def main():
                                 traceback.print_exc()
 
     # Check ignores aren't stale
-    print("\nCheck for unused 'IGNORE' paths...")
-    for index, ig in enumerate(IGNORE):
-        if not ignore_used[index]:
+    print("\nCheck for unused 'IGNORE_SOURCE' paths...")
+    for index, ig in enumerate(IGNORE_SOURCE):
+        if not ignore_used_source[index]:
+            print("unused ignore: %r" % ig)
+
+    # Check ignores aren't stale
+    print("\nCheck for unused 'IGNORE_CMAKE' paths...")
+    for index, ig in enumerate(IGNORE_CMAKE):
+        if not ignore_used_cmake[index]:
             print("unused ignore: %r" % ig)
 
 
diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py
index 2fbf855c386..bb98cb22644 100644
--- a/build_files/cmake/cmake_consistency_check_config.py
+++ b/build_files/cmake/cmake_consistency_check_config.py
@@ -1,10 +1,13 @@
 import os
 
-IGNORE = (
+IGNORE_SOURCE = (
     "/test/",
     "/tests/gtests/",
     "/release/",
 
+    # specific source files
+    "extern/audaspace/"
+
     # specific source files
     "extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
     "extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",
@@ -17,6 +20,10 @@ IGNORE = (
     "intern/audaspace/SRC/AUD_SRCResampleFactory.cpp",
     "intern/audaspace/SRC/AUD_SRCResampleReader.cpp",
 
+    "doc/doxygen/doxygen.extern.h",
+    "doc/doxygen/doxygen.intern.h",
+    "doc/doxygen/doxygen.main.h",
+    "doc/doxygen/doxygen.source.h",
     "extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h",
     "extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h",
     "extern/bullet2/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h",
@@ -29,6 +36,9 @@ IGNORE = (
     "intern/audaspace/SRC/AUD_SRCResampleReader.h",
 )
 
+IGNORE_CMAKE = (
+)
+
 UTF8_CHECK = True
 
 SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))))



More information about the Bf-blender-cvs mailing list