--- a/ProjectController.py Fri Jan 13 15:08:40 2017 +0300
+++ b/ProjectController.py Fri Jan 13 16:47:46 2017 +0300
@@ -84,6 +84,60 @@
return ExtractMenuItemsFromCatalog(features.catalog)
+ self.iec2c = os.path.join(base_folder, "matiec", "iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "")) + self.iec2c_buildopts = None + self.ieclib_path = os.path.join(base_folder, "matiec", "lib") + self.ieclib_c_path = None + def findLibCPath(self): + os.path.join(base_folder, "matiec", "lib", "C"), + os.path.join(base_folder, "matiec", "lib") ] + filename=os.path.join(p, "iec_types.h") + if (os.path.isfile(filename)): + def findSupportedOptions(self): + buildcmd = "\"%s\" -h"%(self.iec2c) + options =["-f", "-l", "-p"] + # Invoke compiler. Output files are listed to stdout, errors to stderr + status, result, err_result = ProcessLogger(self.logger, buildcmd, + no_stdout=True, no_stderr=True).spin() + buildopt = buildopt + " " + opt + if self.iec2c_buildopts is None: + self.iec2c_buildopts = self.findSupportedOptions() + return self.iec2c_buildopts + return self.ieclib_path + if self.ieclib_c_path is None: + self.ieclib_c_path = self.findLibCPath() + return self.ieclib_c_path +iec2c_cfg = Iec2CSettings() class ProjectController(ConfigTreeNode, PLCControler):
This class define Root object of the confnode tree.
@@ -139,10 +193,6 @@
self.SetAppFrame(frame, logger)
- self.iec2c_path = os.path.join(base_folder, "matiec", "iec2c"+(".exe" if wx.Platform == '__WXMSW__' else ""))
- self.ieclib_path = os.path.join(base_folder, "matiec", "lib")
- self.ieclib_c_path = self._getMatIecCPath()
# Setup debug information
self.IECdebug_lock = Lock()
@@ -228,10 +278,10 @@
- return self.ieclib_c_path
+ return iec2c_cfg.getLibCPath()
+ return iec2c_cfg.getCmd() def GetCurrentLocation(self):
@@ -638,43 +688,14 @@
- def _getMatIecCPath(self):
- os.path.join(base_folder, "matiec", "lib", "C"),
- os.path.join(base_folder, "matiec", "lib") ]
- filename=os.path.join(p, "iec_types.h")
- if (os.path.isfile(filename)):
- def _getMatIecOptions(self):
- buildpath = self._getBuildPath()
- buildcmd = "\"%s\" -h"%(self.iec2c_path)
- options =["-f", "-l", "-p"]
- # Invoke compiler. Output files are listed to stdout, errors to stderr
- status, result, err_result = ProcessLogger(self.logger, buildcmd,
- no_stdout=True, no_stderr=True).spin()
- buildopt = buildopt + " " + opt
def _Compile_ST_to_SoftPLC(self):
self.logger.write(_("Compiling IEC Program into C code...\n"))
buildpath = self._getBuildPath()
buildcmd = "\"%s\" %s -I \"%s\" -T \"%s\" \"%s\""%(
- self._getMatIecOptions(),
+ iec2c_cfg.getOptions(), + iec2c_cfg.getLibPath(), @@ -743,7 +764,7 @@
# Keep track of generated C files for later use by self.CTNGenerate_C
self.PLCGeneratedCFiles = C_files
- self.plcCFLAGS = '"-I%s" -Wno-unused-function'%self.ieclib_c_path
+ self.plcCFLAGS = '"-I%s" -Wno-unused-function'%iec2c_cfg.getLibCPath()