[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59008] trunk/blender/build_files/cmake: pass compiler defines such as __FLT_MIN__ to smatch and sparse ( they fail without them).
Campbell Barton
ideasman42 at gmail.com
Thu Aug 8 03:53:05 CEST 2013
Revision: 59008
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59008
Author: campbellbarton
Date: 2013-08-08 01:53:02 +0000 (Thu, 08 Aug 2013)
Log Message:
-----------
pass compiler defines such as __FLT_MIN__ to smatch and sparse (they fail without them).
Modified Paths:
--------------
trunk/blender/build_files/cmake/cmake_static_check_smatch.py
trunk/blender/build_files/cmake/cmake_static_check_sparse.py
trunk/blender/build_files/cmake/project_source_info.py
Modified: trunk/blender/build_files/cmake/cmake_static_check_smatch.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_static_check_smatch.py 2013-08-08 01:19:38 UTC (rev 59007)
+++ trunk/blender/build_files/cmake/cmake_static_check_smatch.py 2013-08-08 01:53:02 UTC (rev 59008)
@@ -44,6 +44,7 @@
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
+ source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
@@ -52,7 +53,8 @@
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
- [("-D%s" % d) for d in defs]
+ [("-D%s" % d) for d in defs] +
+ source_defines
)
check_commands.append((c, cmd))
Modified: trunk/blender/build_files/cmake/cmake_static_check_sparse.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_static_check_sparse.py 2013-08-08 01:19:38 UTC (rev 59007)
+++ trunk/blender/build_files/cmake/cmake_static_check_sparse.py 2013-08-08 01:53:02 UTC (rev 59008)
@@ -42,6 +42,7 @@
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
+ source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
@@ -50,7 +51,8 @@
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
- [("-D%s" % d) for d in defs]
+ [("-D%s" % d) for d in defs] +
+ source_defines
)
check_commands.append((c, cmd))
Modified: trunk/blender/build_files/cmake/project_source_info.py
===================================================================
--- trunk/blender/build_files/cmake/project_source_info.py 2013-08-08 01:19:38 UTC (rev 59007)
+++ trunk/blender/build_files/cmake/project_source_info.py 2013-08-08 01:53:02 UTC (rev 59008)
@@ -171,6 +171,26 @@
return source
+def build_defines_as_source():
+ """
+ Returns a string formatted as an include:
+ '#defines A=B\n#define....'
+ """
+ import subprocess
+ # works for both gcc and clang
+ cmd = (cmake_cache_var("CMAKE_C_COMPILER"), "-dM", "-E", "-")
+ return subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.DEVNULL,
+ ).stdout.read().strip().decode('ascii')
+
+
+def build_defines_as_args():
+ return [("-D" + "=".join(l.split(maxsplit=2)[1:]))
+ for l in build_defines_as_source().split("\n")
+ if l.startswith('#define')]
+
+
# could be moved elsewhere!, this just happens to be used by scripts that also
# use this module.
def queue_processes(process_funcs, job_total=-1):
More information about the Bf-blender-cvs
mailing list