diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-06-22 20:18:15 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2017-07-20 21:11:56 +0100 |
commit | 8f859a510506318f91f639b67807a3dbdd4d0fbc (patch) | |
tree | 938852c094bbd44a6db8d57b3de56fdfd96f3abe | |
parent | 3110c209f76b3389c34ce953ae6814ed64d7a898 (diff) | |
download | meson-8f859a510506318f91f639b67807a3dbdd4d0fbc.zip meson-8f859a510506318f91f639b67807a3dbdd4d0fbc.tar.gz meson-8f859a510506318f91f639b67807a3dbdd4d0fbc.tar.bz2 |
Make the name of the executable implib configurable
-rw-r--r-- | docs/markdown/Reference-manual.md | 2 | ||||
-rw-r--r-- | mesonbuild/build.py | 11 | ||||
-rw-r--r-- | test cases/windows/12 exe implib/installed_files.txt | 6 | ||||
-rw-r--r-- | test cases/windows/12 exe implib/meson.build | 8 |
4 files changed, 17 insertions, 10 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 261d898..4989cef 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -248,7 +248,7 @@ Executable supports the following keyword arguments. Note that just like the pos - `name_suffix` the string that will be used as the extension for the target by overriding the default. By default on Windows this is `exe` and on other platforms it is omitted. - `build_by_default` causes, when set to true, to have this target be built by default, that is, when invoking plain `ninja`, the default value is true for all built target types, since 0.38.0 - `override_options` takes an array of strings in the same format as `project`'s `default_options` overriding the values of these options for this target only, since 0.40.0 -- `implib` when set to true, an import library is generated for the executable, used when the returned build target object appears elsewhere in `link_with:`, on platforms where this is meaningful (e.g. Windows), since 0.42.0 +- `implib` when set to true, an import library is generated for the executable (the name of the import library is based on *exe_name*). Alternatively, when set to a string, that gives the base name for the import library. The import library is used when the returned build target object appears in `link_with:` elsewhere. Only has any effect on platforms where that is meaningful (e.g. Windows). Since 0.42.0 The list of `sources`, `objects`, and `dependencies` is always flattened, which means you can freely nest and add lists while creating the final list. As a corollary, the best way to handle a 'disabled dependency' is by assigning an empty list `[]` to it and passing it like any other dependency to the `dependencies:` keyword argument. diff --git a/mesonbuild/build.py b/mesonbuild/build.py index df24c7f..89b96f5 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1135,14 +1135,17 @@ class Executable(BuildTarget): # The import library that GCC would generate (and prefer) self.gcc_import_filename = None - # if implib:true appears, this target is linkwith:-able, but that only - # means something on Windows platforms. + # if implib appears, this target is linkwith:-able, but that only means + # something on Windows platforms. self.is_linkwithable = False if 'implib' in kwargs and kwargs['implib']: + implib_basename = self.name + '.exe' + if not isinstance(kwargs['implib'], bool): + implib_basename = kwargs['implib'] self.is_linkwithable = True if for_windows(is_cross, environment) or for_cygwin(is_cross, environment): - self.vs_import_filename = '{0}.lib'.format(self.name) - self.gcc_import_filename = 'lib{0}.exe.a'.format(self.name) + self.vs_import_filename = '{0}.lib'.format(implib_basename) + self.gcc_import_filename = 'lib{0}.a'.format(implib_basename) if self.get_using_msvc(): self.import_filename = self.vs_import_filename diff --git a/test cases/windows/12 exe implib/installed_files.txt b/test cases/windows/12 exe implib/installed_files.txt index d0ea8f6..bd2abe9 100644 --- a/test cases/windows/12 exe implib/installed_files.txt +++ b/test cases/windows/12 exe implib/installed_files.txt @@ -1,4 +1,8 @@ usr/bin/prog.exe usr/bin/prog.pdb +usr/bin/prog2.exe +usr/bin/prog2.pdb ?gcc:usr/lib/libprog.exe.a -?msvc:usr/lib/prog.lib +?gcc:usr/lib/libburble.a +?msvc:usr/lib/prog.exe.lib +?msvc:usr/lib/burble.lib diff --git a/test cases/windows/12 exe implib/meson.build b/test cases/windows/12 exe implib/meson.build index 2393e79..2526c65 100644 --- a/test cases/windows/12 exe implib/meson.build +++ b/test cases/windows/12 exe implib/meson.build @@ -1,7 +1,7 @@ project('wintest', 'c') -# Test that we can produce an implib for an executable on Windows, and that it -# is installed along with the executable +# Test that we can produce an implib for an executable on Windows, and that it's +# name can be set, and that it is installed along with the executable -prog = executable('prog', 'prog.c', install: true, implib: true) -test('wintest', prog) +executable('prog', 'prog.c', install: true, implib: true) +executable('prog2', 'prog.c', install: true, implib: 'burble') |