aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/build.py8
-rw-r--r--test cases/rust/1 basic/installed_files.txt3
-rw-r--r--test cases/rust/1 basic/meson.build4
-rw-r--r--test cases/rust/1 basic/subdir/meson.build2
-rw-r--r--test cases/rust/1 basic/subdir/prog.rs3
6 files changed, 13 insertions, 13 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index cc350b2..e0417f4 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1089,9 +1089,9 @@ int dummy;
raise InvalidArguments('Unknown target type for rustc.')
args.append(cratetype)
args += rustc.get_buildtype_args(self.environment.coredata.get_builtin_option('buildtype'))
- depfile = target.name + '.d'
- args += ['--out-dir', target.subdir]
- args += ['--emit', 'dep-info', '--emit', 'link']
+ depfile = os.path.join(target.subdir, target.name + '.d')
+ args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link']
+ 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()
for d in target.link_targets:
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 2806331..41e21e3 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -479,14 +479,6 @@ class BuildTarget(Target):
# CSharp and Java targets can't contain any other file types
assert(len(self.compilers) == 1)
return
- if 'rust' in self.compilers:
- firstname = self.sources[0]
- if isinstance(firstname, File):
- firstname = firstname.fname
- first = os.path.split(firstname)[1]
- (base, suffix) = os.path.splitext(first)
- if suffix != '.rs' or self.name != base:
- raise InvalidArguments('In Rust targets, the first source file must be named projectname.rs.')
def get_original_kwargs(self):
return self.kwargs
diff --git a/test cases/rust/1 basic/installed_files.txt b/test cases/rust/1 basic/installed_files.txt
index c7dab9f..9dea55f 100644
--- a/test cases/rust/1 basic/installed_files.txt
+++ b/test cases/rust/1 basic/installed_files.txt
@@ -1 +1,2 @@
-usr/bin/prog?exe
+usr/bin/program?exe
+usr/bin/program2?exe
diff --git a/test cases/rust/1 basic/meson.build b/test cases/rust/1 basic/meson.build
index 7cd84b6..076d86b 100644
--- a/test cases/rust/1 basic/meson.build
+++ b/test cases/rust/1 basic/meson.build
@@ -1,4 +1,6 @@
project('rustprog', 'rust')
-e = executable('prog', 'prog.rs', install : true)
+e = executable('program', 'prog.rs', install : true)
test('rusttest', e)
+
+subdir('subdir')
diff --git a/test cases/rust/1 basic/subdir/meson.build b/test cases/rust/1 basic/subdir/meson.build
new file mode 100644
index 0000000..51b385b
--- /dev/null
+++ b/test cases/rust/1 basic/subdir/meson.build
@@ -0,0 +1,2 @@
+e = executable('program2', 'prog.rs', install : true)
+test('rusttest2', e)
diff --git a/test cases/rust/1 basic/subdir/prog.rs b/test cases/rust/1 basic/subdir/prog.rs
new file mode 100644
index 0000000..b171a80
--- /dev/null
+++ b/test cases/rust/1 basic/subdir/prog.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("rust compiler is working");
+}