Merged rust_args branch.

pull/1775/head
Jussi Pakkanen 8 years ago
commit c2282f9382
  1. 3
      docs/markdown/Release-notes-for-0.41.0.md
  2. 1
      mesonbuild/backend/ninjabackend.py
  3. 5
      mesonbuild/build.py
  4. 8
      mesonbuild/compilers.py
  5. 5
      test cases/rust/1 basic/meson.build

@ -53,3 +53,6 @@ other build systems. Currently this only works for projects using Git
and only with the Ninja backend.
## Support for passing arguments to Rust compiler
Targets for building rust now take a `rust_args` keyword.

@ -1150,6 +1150,7 @@ int dummy;
args += rustc.get_buildtype_args(self.get_option_for_target('buildtype', target))
depfile = os.path.join(target.subdir, target.name + '.d')
args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link']
args += target.get_extra_args('rust')
args += ['-o', os.path.join(target.subdir, target.get_filename())]
orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets]
linkdirs = OrderedDict()

@ -34,6 +34,7 @@ known_basic_kwargs = {'install': True,
'fortran_args': True,
'd_args': True,
'java_args': True,
'rust_args': True,
'link_args': True,
'link_depends': True,
'link_with': True,
@ -632,6 +633,10 @@ class BuildTarget(Target):
if not isinstance(fortranlist, list):
fortranlist = [fortranlist]
self.add_compiler_args('fortran', fortranlist)
rustlist = kwargs.get('rust_args', [])
if not isinstance(rustlist, list):
rustlist = [rustlist]
self.add_compiler_args('rust', rustlist)
if not isinstance(self, Executable):
self.vala_header = kwargs.get('vala_header', self.name + '.h')
self.vala_vapi = kwargs.get('vala_vapi', self.name + '.vapi')

@ -146,10 +146,10 @@ java_buildtype_args = {'plain': [],
}
rust_buildtype_args = {'plain': [],
'debug': ['-g'],
'debugoptimized': ['-g', '--opt-level', '2'],
'release': ['--opt-level', '3'],
'minsize': [],
'debug': ['-C', 'debuginfo=2'],
'debugoptimized': ['-C', 'debuginfo=2', '-C', 'opt-level=2'],
'release': ['-C', 'opt-level=3'],
'minsize': [], # In a future release: ['-C', 'opt-level=s'],
}
d_gdc_buildtype_args = {'plain': [],

@ -1,6 +1,9 @@
project('rustprog', 'rust')
e = executable('program', 'prog.rs', install : true)
e = executable('program', 'prog.rs',
rust_args : ['-C', 'lto'], # Just a test
install : true
)
test('rusttest', e)
subdir('subdir')

Loading…
Cancel
Save