diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-11-16 17:23:51 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-11-16 17:30:32 +0300 |
commit | b9f8ce999538aa1a8880a8e41202b9e70f514e71 (patch) | |
tree | d17e40f13e35a42c28a343afdb30af1cdbe54c38 /cargo_wrapper.py | |
parent | 717477fd36f00c5f1b8dbb64ec4dadc602d5fc22 (diff) |
meson: add support for static build
There is no way to dynamically ask Cargo to build static or dynamic lib
so we have to build both and pick the one we care when doing the meson
processing.
Fix #88
Diffstat (limited to 'cargo_wrapper.py')
-rw-r--r-- | cargo_wrapper.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py index f951c514d..23c0dabc0 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -27,6 +27,12 @@ if len(extra_env) > 0: if command == 'build': # cargo build ext = sys.argv[8] + # when using --default-library=both 2 extensions are passed + try: + ext2 = sys.argv[9] + except IndexError: + ext2 = None + cargo_cmd = ['cargo', 'build', '--all-targets', '--manifest-path', os.path.join( meson_current_source_dir, 'Cargo.toml'), @@ -56,3 +62,6 @@ if command == 'build': # Copy so files to build dir for f in glob.glob(os.path.join(cargo_target_dir, target, '*.' + ext)): shutil.copy(f, meson_build_dir) + if ext2: + for f in glob.glob(os.path.join(cargo_target_dir, target, '*.' + ext2)): + shutil.copy(f, meson_build_dir) |