From a57c8b38a04c5918124dbb3d51fe9d59dec1dbf8 Mon Sep 17 00:00:00 2001 From: Nicola Vigano <nicola.vigano@esrf.fr> Date: Tue, 17 Jul 2012 15:22:54 +0000 Subject: [PATCH] MEX/Compilation: added defines field Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr> git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@665 4c865b51-4357-4376-afb4-474e03ccb993 --- zUtil_Conf/conf.example.xml | 7 +++++++ zUtil_Python/compile_mex_functions.py | 11 +++++++---- zUtil_Python/xml_dct_io.py | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) mode change 100644 => 100755 zUtil_Python/xml_dct_io.py diff --git a/zUtil_Conf/conf.example.xml b/zUtil_Conf/conf.example.xml index 25989e54..dc595b6d 100644 --- a/zUtil_Conf/conf.example.xml +++ b/zUtil_Conf/conf.example.xml @@ -54,5 +54,12 @@ <lib>z</lib> </libraries> </file> + + <file> + <path>zUtil_Cxx/gtImgMeanValue.cpp</path> + <preprocessor> + <define>HAVE_OMP</define> + </preprocessor> + </file> </mex_files> </config> diff --git a/zUtil_Python/compile_mex_functions.py b/zUtil_Python/compile_mex_functions.py index 4190ed74..8e19f004 100755 --- a/zUtil_Python/compile_mex_functions.py +++ b/zUtil_Python/compile_mex_functions.py @@ -44,7 +44,7 @@ class MexBuilder(object): print('File: ' + file_name + ' ( ' + self.c_files[file_name] + ' )') print('') - def _buildMakeCmd(self, cmd, includes, lib_paths, libs, verbose): + def _buildMakeCmd(self, cmd, includes, lib_paths, libs, defines, verbose): if verbose is True: cmd.append('-v') for include in includes: @@ -53,6 +53,8 @@ class MexBuilder(object): cmd.append("-L" + lib_path) for lib in libs: cmd.append("-l" + lib) + for define in defines: + cmd.append("-D" + define) print('\n file: ' + cmd[1] + ' (cmd: ' + string.join(cmd, ' ') + ' )') subprocess.call(cmd) @@ -70,7 +72,7 @@ class MexBuilder(object): if self.mex_info is None: # No info at all into the xml file print("\nWarning: Mex info not loaded.") - self._buildMakeCmd(cmd, std_include, [], [], verbose) + self._buildMakeCmd(cmd, std_include, [], [], [], verbose) else: if self.mex_info.isExcluded(file_path) is False: props = self.mex_info.getFileProperties(file_path) @@ -78,11 +80,12 @@ class MexBuilder(object): includes = std_include + props.get("includes") self._buildMakeCmd(cmd, includes, props.get("lib_paths"), - props.get("libs"), verbose) + props.get("libs"), + props.get("defines"), verbose) else: # info found, but not about this file, so let's use standard params print("\nWarning: No Mex info on file: '" + file_name + "'") - self._buildMakeCmd(cmd, std_include, [], [], verbose) + self._buildMakeCmd(cmd, std_include, [], [], [], verbose) def compileFuncs(self, mfiles_to_consider, force_compile, verbose): """ diff --git a/zUtil_Python/xml_dct_io.py b/zUtil_Python/xml_dct_io.py old mode 100644 new mode 100755 index 15846aa0..e7894d4b --- a/zUtil_Python/xml_dct_io.py +++ b/zUtil_Python/xml_dct_io.py @@ -78,6 +78,10 @@ class MexConf(object): for lib in fileEntry.findall("libraries/lib"): output["libs"].append(lib.text) + output["defines"] = [] + for lib in fileEntry.findall("preprocessor/define"): + output["defines"].append(lib.text) + return output else: return None -- GitLab