(self)
Setting linker args for older versions of llvm.

        Old versions of LLVM bring an extra level of insanity with them.
        llvm-config will provide the correct arguments for static linking, but
        not for shared-linnking, we have to figure those out ourselves, because
        of course we do.
Setting linker args for older versions of llvm.
Setting linker args for older versions of llvm .
def _set_old_link_args(self) -> None:
        """Setting linker args for older versions of llvm.

        Old versions of LLVM bring an extra level of insanity with them.
        llvm-config will provide the correct arguments for static linking, but
        not for shared-linnking, we have to figure those out ourselves, because
        of course we do.
        """
        if self.static:
            self.link_args = self.get_config_value(
                ['--libs', '--ldflags', '--system-libs'] + list(self.required_modules),
                'link_args')
        else:
            # llvm-config will provide arguments for static linking, so we get
            # to figure out for ourselves what to link with. We'll do that by
            # checking in the directory provided by --libdir for a library
            # called libLLVM-<ver>.(so|dylib|dll)
            libdir = self.get_config_value(['--libdir'], 'link_args')[0]

            expected_name = f'libLLVM-{self.version}'
            re_name = re.compile(fr'{expected_name}.(so|dll|dylib)$')

            for file_ in os.listdir(libdir):
                if re_name.match(file_):
                    self.link_args = [f'-L{libdir}',
                                      '-l{}'.format(os.path.splitext(file_.lstrip('lib'))[0])]
                    break
            else:
                raise DependencyException(
                    'Could not find a dynamically linkable library for LLVM.')
def _set_old_link_args ( self ) -> None : if self . static : self . link_args = self . get_config_value ( [ '--libs' , '--ldflags' , '--system-libs' ] + list ( self . required_modules ) , 'link_args' ) else : # llvm-config will provide arguments for static linking, so we get # to figure out for ourselves what to link with. We'll do that by # checking in the directory provided by --libdir for a library # called libLLVM-<ver>.(so|dylib|dll) libdir = self . get_config_value ( [ '--libdir' ] , 'link_args' ) [ 0 ] expected_name = f'libLLVM-{self.version}' re_name = re . compile ( fr'{expected_name}.(so|dll|dylib)$' ) for file_ in os . listdir ( libdir ) : if re_name . match ( file_ ) : self . link_args = [ f'-L{libdir}' , '-l{}' . format ( os . path . splitext ( file_ . lstrip ( 'lib' ) ) [ 0 ] ) ] break else : raise DependencyException ( 'Could not find a dynamically linkable library for LLVM.' )