summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/fortran.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-05 17:54:45 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-07 12:57:56 +0000
commit186eed2dc6948ebbf553e0b8214c0843b5270427 (patch)
tree37624f25e67806e607a32479d94e5860a038a990 /mesonbuild/compilers/fortran.py
parent6b7dba7f06e51f3375b75d62e8f57b0bb4234793 (diff)
downloadmeson-186eed2dc6948ebbf553e0b8214c0843b5270427.tar.gz
find_library: Add a cache for library searching
Otherwise we can end up searching for the same library tens of times, because pkg-config does not de-duplicate -lfoo args before returning them. We use -Wl,--start-group/end-group, so we do not need to worry about ordering issues in static libraries.
Diffstat (limited to 'mesonbuild/compilers/fortran.py')
-rw-r--r--mesonbuild/compilers/fortran.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index d0b538a8c..11d07b8f0 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -23,6 +23,8 @@ from .compilers import (
class FortranCompiler(Compiler):
library_dirs_cache = CCompiler.library_dirs_cache
+ program_dirs_cache = CCompiler.library_dirs_cache
+ find_library_cache = CCompiler.library_dirs_cache
def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs):
self.language = 'fortran'
@@ -174,11 +176,17 @@ class FortranCompiler(Compiler):
def get_library_naming(self, env, libtype, strict=False):
return CCompiler.get_library_naming(self, env, libtype, strict)
+ def find_library_real(self, *args):
+ return CCompiler.find_library_real(self, *args)
+
+ def find_library_impl(self, *args):
+ return CCompiler.find_library_impl(self, *args)
+
def find_library(self, libname, env, extra_dirs, libtype='default'):
code = '''program main
call exit(0)
end program main'''
- return CCompiler.find_library_impl(self, libname, env, extra_dirs, code, libtype)
+ return self.find_library_impl(libname, env, extra_dirs, code, libtype)
def thread_flags(self, env):
return CCompiler.thread_flags(self, env)