コード例 #1
0
 def write_cmake_files(self):
     fileout = BaseFile.BaseFile('CMakeLists', 'txt')
     filein = '{0}{1}CMakeLists.txt'.format(self.binding, os.sep)
     if self.verbose:
         print('Writing file {0}'.format(fileout.filename))
     self.copy_file_contents(fileout, filein)
     fileout.close_file()
     if self.binding == 'csharp':
         fileout = BaseCMakeFile.BaseCMakeFile('compile-native-files')
         filein = '{0}{1}native.cmake'.format(self.binding, os.sep)
         if self.verbose:
             print('Writing file {0}'.format(fileout.filename))
         fileout.add_file_header()
         fileout.skip_line(2)
         self.copy_file_contents(fileout, filein)
         fileout.close_file()
     elif self.binding == 'java':
         fileout = BaseCMakeFile.BaseCMakeFile('compile-native-files')
         filein = '{0}{1}native.cmake'.format(self.binding, os.sep)
         if self.verbose:
             print('Writing file {0}'.format(fileout.filename))
         fileout.add_file_header()
         fileout.skip_line(2)
         self.copy_file_contents(fileout, filein)
         fileout.close_file()
コード例 #2
0
    def __init__(self, name, package, src, examples=False):

        self.package = package.lower()
        self.src = src

        self.fileout = BaseCMakeFile.BaseCMakeFile(name)

        if src:
            self.fileout.brief_description = 'Src CMake file for {0} ' \
                                             'package'.format(self.package)
        else:
            if not examples:
                self.fileout.brief_description = \
                    'Top-level CMake file for {0} ' \
                    'package'.format(self.package)
            else:
                self.fileout.brief_description = \
                    'Examples CMake file for {0} ' \
                    'package'.format(self.package)

        self.cap_package = self.package.upper()
        self.up_package = strFunctions.upper_first(self.package)

        self.language = global_variables.language
        self.cap_language = global_variables.language.upper()

        self.open_br = '{'
        self.close_br = '}'
コード例 #3
0
    def write_cmake(self, name):
        if name.startswith('lib'):
            if global_variables.library_name.lower().startswith('lib'):
                out_name = '{0}-{1}'.format(global_variables.library_name.lower(), name[4:])
            else:
                out_name = 'lib{0}-{1}'.format(global_variables.library_name.lower(), name[4:])
        else:
            out_name = name
#        out_name = 'lib{0}-{1}'.format(global_variables.language, name[4:])
        fileout = BaseCMakeFile.BaseCMakeFile(out_name)
        filein = '{0}.cmake'.format(name)
        if self.verbose:
            print('Writing file {0}'.format(fileout.filename))
        self.copy_file_contents(fileout, filein)
        fileout.close_file()
コード例 #4
0
    def write_cmake(self, name):
        """
        Copy the CMake (.cmake) file

        :param name: e.g. "Hello" will cause Hello.cmake to be written.
                A name like "libPaisley" might create libsbml-Paisley.cmake
                (depending on value of gv.library_name)
        """
        if name.startswith('lib'):
            if gv.library_name.lower().startswith('lib'):  # e.g. Libsbml
                out_name = '{0}-{1}'.format(gv.library_name.lower(), name[4:])
            else:
                out_name = 'lib{0}-{1}'.format(gv.library_name.lower(),
                                               name[4:])
        else:
            out_name = name
        # out_name = 'lib{0}-{1}'.format(gv.language, name[4:])
        fileout = BaseCMakeFile.BaseCMakeFile(out_name)
        filein = '{0}.cmake'.format(name)
        if self.verbose:
            print('Writing file {0}'.format(fileout.filename))
        self.copy_file_contents(fileout, filein)
        fileout.close_file()