aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-08-07 20:42:34 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2018-08-09 18:39:19 +0300
commitc69030c123e32f1f11d3dfd02a69c4eb5932bf28 (patch)
treef0a3cfe2d2f3ac9c6c8ea8bc8edadbe5171ea65e /mesonbuild
parentab01db177b58fb2b190f9b193b42f2c714322f59 (diff)
downloadmeson-c69030c123e32f1f11d3dfd02a69c4eb5932bf28.zip
meson-c69030c123e32f1f11d3dfd02a69c4eb5932bf28.tar.gz
meson-c69030c123e32f1f11d3dfd02a69c4eb5932bf28.tar.bz2
Don't require an import library for shared modules
Shared modules may be resource-only DLLs, or might automatically self-initialize using C constructors or WinMain at DLL load time. When an import library is not found for a shared module, just print a message about it instead of erroring out. Fixes #3965
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/backends.py8
-rw-r--r--mesonbuild/minstall.py7
2 files changed, 12 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 2105d42..7306848 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -55,7 +55,7 @@ class InstallData:
self.mesonintrospect = mesonintrospect
class TargetInstallData:
- def __init__(self, fname, outdir, aliases, strip, install_name_mappings, install_rpath, install_mode):
+ def __init__(self, fname, outdir, aliases, strip, install_name_mappings, install_rpath, install_mode, optional=False):
self.fname = fname
self.outdir = outdir
self.aliases = aliases
@@ -63,6 +63,7 @@ class TargetInstallData:
self.install_name_mappings = install_name_mappings
self.install_rpath = install_rpath
self.install_mode = install_mode
+ self.optional = optional
class ExecutableSerialisation:
def __init__(self, name, fname, cmd_args, env, is_cross, exe_wrapper,
@@ -1047,9 +1048,10 @@ class Backend:
implib_install_dir = outdirs[0]
else:
implib_install_dir = self.environment.get_import_lib_dir()
- # Install the import library.
+ # Install the import library; may not exist for shared modules
i = TargetInstallData(self.get_target_filename_for_linking(t),
- implib_install_dir, {}, False, {}, '', install_mode)
+ implib_install_dir, {}, False, {}, '', install_mode,
+ optional=isinstance(t, build.SharedModule))
d.targets.append(i)
# Install secondary outputs. Only used for Vala right now.
if num_outdirs > 1:
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 4615b6d..248f12e 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -384,6 +384,13 @@ class Installer:
def install_targets(self, d):
for t in d.targets:
+ if not os.path.exists(t.fname):
+ # For example, import libraries of shared modules are optional
+ if t.optional:
+ print('File {!r} not found, skipping'.format(t.fname))
+ continue
+ else:
+ raise RuntimeError('File {!r} could not be found'.format(t.fname))
fname = check_for_stampfile(t.fname)
outdir = get_destdir_path(d, t.outdir)
outname = os.path.join(outdir, os.path.basename(fname))