From d87f2f5b427c1da74450bc6eb553f3dba6b3cbe0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 19 Apr 2016 00:30:29 +0530 Subject: [PATCH 1/2] compilers: Convert args to cc.{links,run} from unix to native This allows build files to pass -L and -l flags and have them converted automatically as needed. --- mesonbuild/compilers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 1915644e6..87bd0d56f 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -520,7 +520,8 @@ int main () {{ {1}; }}''' ofile = open(srcname, 'w') ofile.write(code) ofile.close() - extra_args = extra_args + self.get_output_args(dstname) + extra_args = self.unix_link_flags_to_native(extra_args) + \ + self.get_output_args(dstname) p = self.compile(code, srcname, extra_args) try: os.remove(dstname) @@ -539,7 +540,7 @@ int main () {{ {1}; }}''' ofile.close() exename = srcname + '.exe' # Is guaranteed to be executable on every platform. commands = self.get_exelist() - commands += extra_args + commands += self.unix_link_flags_to_native(extra_args) commands.append(srcname) commands += self.get_output_args(exename) p = subprocess.Popen(commands, cwd=os.path.split(srcname)[0], stdout=subprocess.PIPE, stderr=subprocess.PIPE) From aa7202d42fdbfba3e7ff358be8d41133e5ec431a Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 19 Apr 2016 14:12:53 +0530 Subject: [PATCH 2/2] compilers: Remove outdated MSVC implementation of cc.find_library With the change to cc.links to translate unix link flags, this is no longer needed and is wrong because it hasn't kept-up with the improved default cc.find_library implementation. --- mesonbuild/compilers.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 87bd0d56f..a320e7d30 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1393,19 +1393,6 @@ class VisualStudioCCompiler(CCompiler): def build_rpath_args(self, build_dir, rpath_paths, install_rpath): return [] - def find_library(self, libname, extra_dirs): - code = '''int main(int argc, char **argv) { - return 0; -} - ''' - args = [] - for i in extra_dirs: - args += self.get_linker_search_args(i) - args.append(libname + '.lib') - if self.links(code, extra_args=args): - return args - return None - # FIXME, no idea what these should be. def thread_flags(self): return []