示例#1
0
 def _add_qa36():
     " Add C++ QA files for pre-3.7 API (not autotools) "
     fname_qa_cc = 'qa_%s.cc' % self._info['fullblockname']
     self._write_tpl('qa_cpp36', 'lib', fname_qa_cc)
     if not self.options.skip_cmakefiles:
         open(self._file['cmlib'], 'a').write(
             str(
                 Cheetah.Template.Template(
                     Templates['qa_cmakeentry36'],
                     searchList={
                         'basename': os.path.splitext(fname_qa_cc)[0],
                         'filename': fname_qa_cc,
                         'modname': self._info['modname']
                     })))
         ed = CMakeFileEditor(self._file['cmlib'])
         ed.remove_double_newlines()
         ed.write()
示例#2
0
 def _add_qa36():
     " Add C++ QA files for pre-3.7 API (not autotools) "
     fname_qa_cc = 'qa_%s.cc' % self._info['fullblockname']
     self._write_tpl('qa_cpp36', 'lib', fname_qa_cc)
     if not self.options.skip_cmakefiles:
         open(self._file['cmlib'], 'a').write(
                 str(
                     Cheetah.Template.Template(
                         Templates['qa_cmakeentry36'],
                         searchList={'basename': os.path.splitext(fname_qa_cc)[0],
                                     'filename': fname_qa_cc,
                                     'modname': self._info['modname']
                                    }
                     )
                  )
         )
         ed = CMakeFileEditor(self._file['cmlib'])
         ed.remove_double_newlines()
         ed.write()
示例#3
0
    def _run_lib(self):
        """ Do everything that needs doing in the subdir 'lib' and 'include'.
        - add .cc and .h files
        - include them into CMakeLists.txt
        - check if C++ QA code is req'd
        - if yes, create qa_*.{cc,h} and add them to CMakeLists.txt
        """
        print "Traversing lib..."
        fname_h = self._info['fullblockname'] + '.h'
        fname_cc = self._info['fullblockname'] + '.cc'
        if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator',
                                       'interpolator', 'general', 'hiercpp'):
            self._write_tpl('block_h', 'include', fname_h)
            self._write_tpl('block_cpp', 'lib', fname_cc)
        elif self._info['blocktype'] == 'impl':
            self._write_tpl('impl_h', 'include', fname_h)
            self._write_tpl('impl_cpp', 'lib', fname_cc)
        if not self.options.skip_cmakefiles:
            ed = CMakeFileEditor('lib/CMakeLists.txt')
            ed.append_value('add_library', fname_cc)
            ed.write()
            ed = CMakeFileEditor('include/CMakeLists.txt', '\n    ')
            ed.append_value('install', fname_h, 'DESTINATION[^()]+')
            ed.write()

        if not self._add_cc_qa:
            return
        fname_qa_cc = 'qa_%s' % fname_cc
        self._write_tpl('qa_cpp', 'lib', fname_qa_cc)
        if not self.options.skip_cmakefiles:
            open('lib/CMakeLists.txt', 'a').write(Template.substitute(Templates['qa_cmakeentry'],
                                          {'basename': os.path.splitext(fname_qa_cc)[0],
                                           'filename': fname_qa_cc,
                                           'modname': self._info['modname']}))
            ed = CMakeFileEditor('lib/CMakeLists.txt')
            ed.remove_double_newlines()
            ed.write()