aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2016-03-18 02:24:41 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2016-03-18 02:58:02 +0530
commit64a0dc626993f61106a4000ce24aed0806f8f5e8 (patch)
treee4208d900a3952228efa11d7f3fbf6e0da91773e /mesonbuild/compilers.py
parent8b6848ebc3e146427bdf501208bd5ecb57316dc4 (diff)
downloadmeson-64a0dc626993f61106a4000ce24aed0806f8f5e8.zip
meson-64a0dc626993f61106a4000ce24aed0806f8f5e8.tar.gz
meson-64a0dc626993f61106a4000ce24aed0806f8f5e8.tar.bz2
Implement cc.find_library for the Visual Studio C/C++ compilers
Without this find_library always succeeds because MSVC just ignores -lfoo as an invalid argument
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 22978f5..5461d07 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1150,6 +1150,9 @@ class VisualStudioCCompiler(CCompiler):
def get_linker_output_args(self, outputname):
return ['/OUT:' + outputname]
+ def get_linker_search_args(self, dirname):
+ return ['/LIBPATH:' + dirname]
+
def get_pic_args(self):
return [] # PIC is handled by the loader on Windows
@@ -1181,6 +1184,19 @@ 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 []