[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33372] trunk/blender: include headers in cmake source, added a script to check for consistency, reporting missing headers & C files.

Campbell Barton ideasman42 at gmail.com
Mon Nov 29 05:35:57 CET 2010


Revision: 33372
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33372
Author:   campbellbarton
Date:     2010-11-29 05:35:56 +0100 (Mon, 29 Nov 2010)

Log Message:
-----------
include headers in cmake source, added a script to check for consistency, reporting missing headers & C files.
this is important so IDE's using CMake integration always get blender headers. - QtCreator & MSVC for eg, probably others too.

Modified Paths:
--------------
    trunk/blender/build_files/cmake/macros.cmake
    trunk/blender/extern/binreloc/CMakeLists.txt
    trunk/blender/extern/bullet2/CMakeLists.txt
    trunk/blender/extern/glew/CMakeLists.txt
    trunk/blender/extern/libopenjpeg/CMakeLists.txt
    trunk/blender/extern/lzma/CMakeLists.txt
    trunk/blender/extern/lzo/CMakeLists.txt
    trunk/blender/intern/audaspace/CMakeLists.txt
    trunk/blender/intern/boolop/CMakeLists.txt
    trunk/blender/intern/bsp/CMakeLists.txt
    trunk/blender/intern/container/CMakeLists.txt
    trunk/blender/intern/decimation/CMakeLists.txt
    trunk/blender/intern/elbeem/CMakeLists.txt
    trunk/blender/intern/ghost/CMakeLists.txt
    trunk/blender/intern/guardedalloc/CMakeLists.txt
    trunk/blender/intern/iksolver/CMakeLists.txt
    trunk/blender/intern/itasc/CMakeLists.txt
    trunk/blender/intern/memutil/CMakeLists.txt
    trunk/blender/intern/moto/CMakeLists.txt
    trunk/blender/intern/opennl/CMakeLists.txt
    trunk/blender/intern/smoke/CMakeLists.txt
    trunk/blender/intern/string/CMakeLists.txt
    trunk/blender/source/blender/avi/CMakeLists.txt
    trunk/blender/source/blender/blenfont/CMakeLists.txt
    trunk/blender/source/blender/blenkernel/CMakeLists.txt
    trunk/blender/source/blender/blenlib/CMakeLists.txt
    trunk/blender/source/blender/blenloader/CMakeLists.txt
    trunk/blender/source/blender/blenpluginapi/CMakeLists.txt
    trunk/blender/source/blender/collada/CMakeLists.txt
    trunk/blender/source/blender/editors/animation/CMakeLists.txt
    trunk/blender/source/blender/editors/armature/CMakeLists.txt
    trunk/blender/source/blender/editors/curve/CMakeLists.txt
    trunk/blender/source/blender/editors/gpencil/CMakeLists.txt
    trunk/blender/source/blender/editors/interface/CMakeLists.txt
    trunk/blender/source/blender/editors/mesh/CMakeLists.txt
    trunk/blender/source/blender/editors/metaball/CMakeLists.txt
    trunk/blender/source/blender/editors/object/CMakeLists.txt
    trunk/blender/source/blender/editors/physics/CMakeLists.txt
    trunk/blender/source/blender/editors/render/CMakeLists.txt
    trunk/blender/source/blender/editors/screen/CMakeLists.txt
    trunk/blender/source/blender/editors/sculpt_paint/CMakeLists.txt
    trunk/blender/source/blender/editors/sound/CMakeLists.txt
    trunk/blender/source/blender/editors/space_action/CMakeLists.txt
    trunk/blender/source/blender/editors/space_buttons/CMakeLists.txt
    trunk/blender/source/blender/editors/space_console/CMakeLists.txt
    trunk/blender/source/blender/editors/space_file/CMakeLists.txt
    trunk/blender/source/blender/editors/space_graph/CMakeLists.txt
    trunk/blender/source/blender/editors/space_image/CMakeLists.txt
    trunk/blender/source/blender/editors/space_info/CMakeLists.txt
    trunk/blender/source/blender/editors/space_logic/CMakeLists.txt
    trunk/blender/source/blender/editors/space_nla/CMakeLists.txt
    trunk/blender/source/blender/editors/space_node/CMakeLists.txt
    trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt
    trunk/blender/source/blender/editors/space_script/CMakeLists.txt
    trunk/blender/source/blender/editors/space_sequencer/CMakeLists.txt
    trunk/blender/source/blender/editors/space_sound/CMakeLists.txt
    trunk/blender/source/blender/editors/space_text/CMakeLists.txt
    trunk/blender/source/blender/editors/space_time/CMakeLists.txt
    trunk/blender/source/blender/editors/space_userpref/CMakeLists.txt
    trunk/blender/source/blender/editors/space_view3d/CMakeLists.txt
    trunk/blender/source/blender/editors/transform/CMakeLists.txt
    trunk/blender/source/blender/editors/util/CMakeLists.txt
    trunk/blender/source/blender/editors/uvedit/CMakeLists.txt
    trunk/blender/source/blender/gpu/CMakeLists.txt
    trunk/blender/source/blender/ikplugin/CMakeLists.txt
    trunk/blender/source/blender/imbuf/CMakeLists.txt
    trunk/blender/source/blender/makesdna/intern/CMakeLists.txt
    trunk/blender/source/blender/makesrna/intern/CMakeLists.txt
    trunk/blender/source/blender/modifiers/CMakeLists.txt
    trunk/blender/source/blender/nodes/CMakeLists.txt
    trunk/blender/source/blender/python/generic/CMakeLists.txt
    trunk/blender/source/blender/python/intern/CMakeLists.txt
    trunk/blender/source/blender/quicktime/CMakeLists.txt
    trunk/blender/source/blender/readblenfile/CMakeLists.txt
    trunk/blender/source/blender/render/CMakeLists.txt
    trunk/blender/source/blender/windowmanager/CMakeLists.txt
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
    trunk/blender/source/gameengine/Converter/CMakeLists.txt
    trunk/blender/source/gameengine/Expressions/CMakeLists.txt
    trunk/blender/source/gameengine/GameLogic/CMakeLists.txt
    trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
    trunk/blender/source/gameengine/GamePlayer/ghost/CMakeLists.txt
    trunk/blender/source/gameengine/Ketsji/CMakeLists.txt
    trunk/blender/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
    trunk/blender/source/gameengine/Network/CMakeLists.txt
    trunk/blender/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt
    trunk/blender/source/gameengine/Physics/Bullet/CMakeLists.txt
    trunk/blender/source/gameengine/Physics/Dummy/CMakeLists.txt
    trunk/blender/source/gameengine/Physics/common/CMakeLists.txt
    trunk/blender/source/gameengine/Rasterizer/CMakeLists.txt
    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
    trunk/blender/source/gameengine/SceneGraph/CMakeLists.txt
    trunk/blender/source/gameengine/VideoTexture/CMakeLists.txt
    trunk/blender/source/kernel/CMakeLists.txt

Added Paths:
-----------
    trunk/blender/build_files/cmake/cmake_consistency_check.py

Added: trunk/blender/build_files/cmake/cmake_consistency_check.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_consistency_check.py	                        (rev 0)
+++ trunk/blender/build_files/cmake/cmake_consistency_check.py	2010-11-29 04:35:56 UTC (rev 33372)
@@ -0,0 +1,191 @@
+# $Id:
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Campbell Barton
+#
+# ***** END GPL LICENSE BLOCK *****
+
+IGNORE = \
+    "/test/",\
+    "/decimate_glut_test/",\
+    "/BSP_GhostTest/",\
+    "/release/",\
+    "/xembed/",\
+    "/decimation/intern/future/",\
+    "/TerraplayNetwork/",\
+    "/ik_glut_test/"
+
+import os
+from os.path import join, dirname, normpath
+
+base = join(os.getcwd(), "..", "..")
+base = normpath(base)
+
+global_h = set()
+global_c = set()
+
+import os
+from os.path import  splitext
+def source_list(path, filename_check=None):
+    for dirpath, dirnames, filenames in os.walk(path):
+
+        # skip '.svn'
+        if dirpath.startswith("."):
+            continue
+
+        for filename in filenames:
+            if filename_check is None or filename_check(filename):
+                yield os.path.join(dirpath, filename)
+
+# extension checking
+def is_c_header(filename):
+    ext = splitext(filename)[1]
+    return (ext in (".h", ".hpp", ".hxx"))
+
+def is_cmake(filename):
+    ext = splitext(filename)[1]
+    return (ext == ".cmake") or (filename == "CMakeLists.txt")
+
+def is_c_header(filename):
+    ext = splitext(filename)[1]
+    return (ext in (".h", ".hpp", ".hxx"))
+
+def is_c(filename):
+    ext = splitext(filename)[1]
+    return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
+
+def is_c_any(filename):
+    return is_c(filename) or is_c_header(filename)
+
+def cmake_get_src(f):
+    
+    sources_h = []
+    sources_c = []
+    
+    filen = open(f, "r")
+    it = iter(filen)
+    found = False
+    i = 0
+    # print(f)
+    while it is not None:
+        while it is not None:
+            i += 1
+            try:
+                l = next(it)
+            except StopIteration:
+                it = None
+                break
+            l = l.strip()
+            if not l.startswith("#"):
+                if 'SET(SRC' in l or ('SET(' in l and l.endswith("SRC")):
+                    if len(l.split()) > 1:
+                        raise Exception("strict formatting not kept 'SET(SRC*' %s:%d" % (f, i))
+                    found = True
+                    break
+                
+                if "LIST(APPEND SRC" in l:
+                    if l.endswith(")"):
+                        raise Exception("strict formatting not kept 'LIST(APPEND SRC...)' on 1 line %s:%d" % (f, i))
+                    found = True
+                    break
+
+        if found:
+            cmake_base = dirname(f)
+
+            while it is not None:
+                i += 1
+                try:
+                    l = next(it)
+                except StopIteration:
+                    it = None
+                    break
+                    
+                l = l.strip()
+
+                if not l.startswith("#"):
+                        
+                    if ")" in l:
+                        if l.strip() != ")":
+                            raise Exception("strict formatting not kept '*)' %s:%d" % (f, i))
+                        break
+
+                    if not l:
+                        pass
+                    elif l.startswith("$"):
+                        print("Cant use var '%s' %s:%d" % (l, f, i))
+                    elif len(l.split()) > 1:
+                        raise Exception("Multi-line define '%s' %s:%d" % (l, f, i))
+                    else:
+                        new_file = normpath(join(cmake_base, l))
+                        
+                        if is_c_header(new_file):
+                            sources_h.append(new_file)
+                        elif is_c(new_file):
+                            sources_c.append(new_file)
+                        else:
+                            raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
+
+                        # print(new_file)
+
+            global_h.update(set(sources_h))
+            global_c.update(set(sources_c))
+            '''
+            if not sources_h and not sources_c:
+                raise Exception("No sources %s" % f)
+
+            sources_h_fs = list(source_list(cmake_base, is_c_header))
+            sources_c_fs = list(source_list(cmake_base, is_c))
+            '''
+            # find missing C files:
+            '''
+            for ff in sources_c_fs:
+                if ff not in sources_c:
+                    print("  missing: " + ff)
+            '''
+    
+    filen.close()
+
+
+for cmake in source_list(base, is_cmake):
+    cmake_get_src(cmake)
+
+def is_ignore(f):
+    for ig in IGNORE:
+        if ig in f:
+            return True
+    return False
+    
+# First do stupid check, do these files exist?
+for f in (global_h | global_c):
+    if f.endswith("dna.c"):
+        continue
+
+    if not os.path.exists(f):
+        raise Exception("CMake referenced file missing: " + f)
+
+    
+# now check on files not accounted for.
+print("\nC/C++ Files CMake doesnt know about...")
+for cf in sorted(source_list(base, is_c)):
+    if not is_ignore(cf):
+        if cf not in global_c:
+            print("missing_c: ", cf)
+print("\nC/C++ Headers CMake doesnt know about...")
+for hf in sorted(source_list(base, is_c_header)):
+    if not is_ignore(hf):
+        if hf not in global_h:
+            print("missing_h: ", hf)

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake	2010-11-29 01:05:20 UTC (rev 33371)
+++ trunk/blender/build_files/cmake/macros.cmake	2010-11-29 04:35:56 UTC (rev 33372)
@@ -7,16 +7,12 @@
 
 	MESSAGE(STATUS "Configuring library ${name}")
 
-	# Gather all headers
-	FILE(GLOB_RECURSE INC_ALL *.h)
-		 
 	INCLUDE_DIRECTORIES(${includes})
-	ADD_LIBRARY(${name} ${INC_ALL} ${sources})
+	ADD_LIBRARY(${name} ${sources})
 
 	# Group by location on disk
 	SOURCE_GROUP("Source Files" FILES CMakeLists.txt)
-	SET(ALL_FILES ${sources} ${INC_ALL})
-	FOREACH(SRC ${ALL_FILES})
+	FOREACH(SRC ${sources})
 		GET_FILENAME_COMPONENT(SRC_EXT ${SRC} EXT)
 		IF(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") 
 			SOURCE_GROUP("Header Files" FILES ${SRC})

Modified: trunk/blender/extern/binreloc/CMakeLists.txt
===================================================================
--- trunk/blender/extern/binreloc/CMakeLists.txt	2010-11-29 01:05:20 UTC (rev 33371)
+++ trunk/blender/extern/binreloc/CMakeLists.txt	2010-11-29 04:35:56 UTC (rev 33372)
@@ -20,6 +20,8 @@
 
 SET(SRC
 	binreloc.c
+
+	include/binreloc.h
 )
 
 SET(INC

Modified: trunk/blender/extern/bullet2/CMakeLists.txt
===================================================================
--- trunk/blender/extern/bullet2/CMakeLists.txt	2010-11-29 01:05:20 UTC (rev 33371)
+++ trunk/blender/extern/bullet2/CMakeLists.txt	2010-11-29 04:35:56 UTC (rev 33372)
@@ -143,6 +143,180 @@
 	src/LinearMath/btConvexHull.cpp
 	src/LinearMath/btGeometryUtil.cpp
 	src/LinearMath/btQuickprof.cpp
+
+	src/Bullet-C-Api.h
+	src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
+	src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h
+	src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
+	src/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h
+	src/BulletCollision/BroadphaseCollision/btDbvt.h
+	src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h
+	src/BulletCollision/BroadphaseCollision/btDispatcher.h
+	src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h
+	src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
+	src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h
+	src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
+	src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h
+	src/BulletCollision/CollisionDispatch/SphereTriangleDetector.h
+	src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btBoxBoxDetector.h
+	src/BulletCollision/CollisionDispatch/btCollisionConfiguration.h
+	src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
+	src/BulletCollision/CollisionDispatch/btCollisionDispatcher.h
+	src/BulletCollision/CollisionDispatch/btCollisionObject.h
+	src/BulletCollision/CollisionDispatch/btCollisionWorld.h
+	src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h
+	src/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btGhostObject.h
+	src/BulletCollision/CollisionDispatch/btManifoldResult.h
+	src/BulletCollision/CollisionDispatch/btSimulationIslandManager.h
+	src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h
+	src/BulletCollision/CollisionDispatch/btUnionFind.h
+	src/BulletCollision/CollisionShapes/btBoxShape.h
+	src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h
+	src/BulletCollision/CollisionShapes/btCapsuleShape.h
+	src/BulletCollision/CollisionShapes/btCollisionMargin.h

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list