diff options
7 files changed, 26 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 50de9e1..3044d51 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1552,10 +1552,6 @@ class Interpreter(): return self.do_subproject(dirname, kwargs) def do_subproject(self, dirname, kwargs): - if self.subdir != '': - segs = os.path.split(self.subdir) - if len(segs) != 2 or segs[0] != self.subproject_dir: - raise InterpreterException('Subprojects must be defined at the root directory.') if dirname in self.subproject_stack: fullstack = self.subproject_stack + [dirname] incpath = ' => '.join(fullstack) diff --git a/test cases/common/120 subdir subproject/meson.build b/test cases/common/120 subdir subproject/meson.build new file mode 100644 index 0000000..54ecfe0 --- /dev/null +++ b/test cases/common/120 subdir subproject/meson.build @@ -0,0 +1,2 @@ +project('proj', 'c') +subdir('prog') diff --git a/test cases/common/120 subdir subproject/prog/meson.build b/test cases/common/120 subdir subproject/prog/meson.build new file mode 100644 index 0000000..360b5f5 --- /dev/null +++ b/test cases/common/120 subdir subproject/prog/meson.build @@ -0,0 +1,5 @@ +subproject('sub') +libSub = dependency('sub', fallback: ['sub', 'libSub']) + +exe = executable('prog', 'prog.c', dependencies: libSub) +test('subdir subproject', exe) diff --git a/test cases/common/120 subdir subproject/prog/prog.c b/test cases/common/120 subdir subproject/prog/prog.c new file mode 100644 index 0000000..02ae337 --- /dev/null +++ b/test cases/common/120 subdir subproject/prog/prog.c @@ -0,0 +1,5 @@ +#include <sub.h> + +int main() { + return sub(); +} diff --git a/test cases/common/120 subdir subproject/subprojects/sub/meson.build b/test cases/common/120 subdir subproject/subprojects/sub/meson.build new file mode 100644 index 0000000..94e9eec --- /dev/null +++ b/test cases/common/120 subdir subproject/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/120 subdir subproject/subprojects/sub/sub.c b/test cases/common/120 subdir subproject/subprojects/sub/sub.c new file mode 100644 index 0000000..3291e3c --- /dev/null +++ b/test cases/common/120 subdir subproject/subprojects/sub/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/120 subdir subproject/subprojects/sub/sub.h b/test cases/common/120 subdir subproject/subprojects/sub/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/120 subdir subproject/subprojects/sub/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif |