diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 14:43:51 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 20:50:47 +0530 |
commit | 0143c32c7cd82872e42f57216bb94a26191f2824 (patch) | |
tree | 7b6030e63de5283548ce234dd4d96a36a7380f1b /mesonbuild/compilers.py | |
parent | bc347aed0be4d8ea6210a546fb350f7bc1eee529 (diff) | |
download | meson-0143c32c7cd82872e42f57216bb94a26191f2824.zip meson-0143c32c7cd82872e42f57216bb94a26191f2824.tar.gz meson-0143c32c7cd82872e42f57216bb94a26191f2824.tar.bz2 |
Overhaul versioning and naming of libraries
This commit contains several changes to the naming and versioning of
shared and static libraries. The details are documented at:
https://github.com/mesonbuild/meson/pull/417
Here's a brief summary:
* The results of binary and compiler detection via environment functions
are now cached so that they can be called repeatedly without
performance penalty. This is necessary because every
build.SharedLibrary object has to know whether the compiler is MSVC or
not (output filenames depend on that), and so the compiler detection
has to be called for each object instantiation.
* Linux shared libraries don't always have a library version. Sometimes
only soversions are specified (and vice-versa), so support both.
* Don't use versioned filenames when generating DLLs, DLLs are never
versioned using the suffix in the way that .so libraries are. Hence,
they don't use "aliases". Only Linux shared libraries use those.
* OS X dylibs do not use filename aliases at all. They only use the
soversion in the dylib name (libfoo.X.dylib), and that's it. If
there's no soversion specified, the dylib is called libfoo.dylib.
Further versioning in dylibs is supposed to be done with the
-current_version argument to clang, but this is TBD.
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23
* Install DLLs into bindir and import libraries into libdir
* Static libraries are now always called libfoo.a, even with MSVC
* .lib import libraries are always generated when building with MSVC
* .dll.a import libraries are always generated when building with
MinGW/GCC or MinGW/clang
* TODO: Use dlltool if available to generate .dll.a when .lib is
generated and vice-versa.
* Library and executable suffix/prefixes are now always correctly
overriden by the values of the 'name_prefix' and 'name_suffix' keyword
arguments.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 5d94182..a091dc9 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -263,6 +263,13 @@ class Compiler(): def get_linker_always_args(self): return [] + def gen_import_library_args(self, implibname): + """ + Used only on Windows for libraries that need an import library. + This currently means C, C++, Fortran. + """ + return [] + def get_options(self): return {} # build afresh every time @@ -459,6 +466,14 @@ class CCompiler(Compiler): def get_linker_search_args(self, dirname): return ['-L'+dirname] + def gen_import_library_args(self, implibname): + """ + The name of the outputted import library + + This implementation is used only on Windows by compilers that use GNU ld + """ + return ['-Wl,--out-implib=' + implibname] + def sanity_check_impl(self, work_dir, environment, sname, code): mlog.debug('Sanity testing ' + self.language + ' compiler:', ' '.join(self.exelist)) mlog.debug('Is cross compiler: %s.' % str(self.is_cross)) @@ -1485,6 +1500,10 @@ class VisualStudioCCompiler(CCompiler): objname = os.path.splitext(pchname)[0] + '.obj' return (objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname ]) + def gen_import_library_args(self, implibname): + "The name of the outputted import library" + return ['/IMPLIB:' + implibname] + def build_rpath_args(self, build_dir, rpath_paths, install_rpath): return [] @@ -2031,6 +2050,14 @@ class GnuFortranCompiler(FortranCompiler): def get_always_args(self): return ['-pipe'] + def gen_import_library_args(self, implibname): + """ + The name of the outputted import library + + Used only on Windows + """ + return ['-Wl,--out-implib=' + implibname] + class G95FortranCompiler(FortranCompiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None): super().__init__(exelist, version, is_cross, exe_wrapper=None) @@ -2042,6 +2069,14 @@ class G95FortranCompiler(FortranCompiler): def get_always_args(self): return ['-pipe'] + def gen_import_library_args(self, implibname): + """ + The name of the outputted import library + + Used only on Windows + """ + return ['-Wl,--out-implib=' + implibname] + class SunFortranCompiler(FortranCompiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None): super().__init__(exelist, version, is_cross, exe_wrapper=None) |