コード例 #1
0
 def create_object(self, output, source, params):
     cmd = '{ccname} -o {out} -c{g_param}{fpic_param} {src} {inc_dirs} {defines} {opts}'.format(
         ccname='clang++' if self.is_cpp else 'clang',
         out=output,
         src=source,
         g_param=' -g'
         if params.get('debug-symbols', 'false') == 'true' else '',
         fpic_param=' -fPIC' if params.get('for-shlib', False) else '',
         inc_dirs=''.join(
             [' -I %s' % file for file in params.get('includes', [])]),
         defines=''.join(
             [' -D %s' % mac for mac in params.get('defines', [])]),
         opts=' '.join(params.get('opts', [])),
     )
     exec_cmd(cmd)
コード例 #2
0
 def create_executable(self, output, objects, libs, params):
     tmp_output = 'OUT.EXE'
     cmd = 'wcl /l=dos /fe={output} {objs} {opts}'.format(
         objs=' '.join(Watcom.path_to_dos(o) for o in objects),
         output=tmp_output,
         link_libs=''.join(
             [
                 ' -Wl,-rpath,"{dir}" -L {dir} -l:{file}'.format(
                     dir=os.path.dirname(path), file=os.path.basename(path))
                 for path in libs
             ]
         ),  # That colon in `-l:` is important because it disables the lib-prefix nonsense
         opts=' '.join(params.get('opts', [])),
     )
     self.dosbox_exec(cmd)
     exec_cmd(f'mv {tmp_output} {output}')
コード例 #3
0
    def create_object(self, output, source, params):
        tmp_output = 'OUT.OBJ'
        cmd = 'wcl /c {src} /fo={output} {debug} {defines} {inc_dirs} {opts}'.format(
            src=Watcom.path_to_dos(source),
            output=tmp_output,
            debug='/d2'
            if params.get('debug-symbols', 'false') == 'true' else '',
            inc_dirs=' '.join([
                '/i=%s' % Watcom.path_to_dos(file)
                for file in params.get('includes', [])
            ]),
            defines=' '.join(
                ['/d%s' % mac for mac in params.get('defines', [])]),
            opts=' '.join(params.get('opts', [])),
        )
        self.dosbox_exec(cmd)

        # We don't necessarily need to know the exact output name if it's longer than 8 chars (because DOS), so we save it under a temporary name and copy it in Linux afterwards.
        exec_cmd(f'mv {tmp_output} {output}')
コード例 #4
0
 def create_shlib(self, output, objects, libs, params):
     cmd = '{ccname} -shared -{g_param}o {out} {objs} {inc_dirs} {defines} {link_libs} {opts}'.format(
         ccname='clang++' if self.is_cpp else 'clang',
         out=output,
         objs=' '.join(objects),
         g_param='-g'
         if params.get('debug-symbols', 'false') == 'true' else '',
         inc_dirs=''.join(
             [' -I %s' % file for file in params.get('includes', [])]),
         defines=''.join(
             [' -D %s' % mac for mac in params.get('defines', [])]),
         link_libs=''.join(
             [
                 ' -Wl,-rpath,"{dir}" -L {dir} -l:{file}'.format(
                     dir=os.path.dirname(path), file=os.path.basename(path))
                 for path in libs
             ]
         ),  # That colon in `-l:` is important because it disables the lib-prefix nonsense
         opts=' '.join(params.get('opts', [])),
     )
     exec_cmd(cmd)