diff options
-rw-r--r-- | interpreter.py | 13 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/meson.build | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/interpreter.py b/interpreter.py index 88f4b74..9531540 100644 --- a/interpreter.py +++ b/interpreter.py @@ -534,15 +534,24 @@ class CompilerHolder(InterpreterObject): return haz class MesonMain(InterpreterObject): - def __init__(self, build): + def __init__(self, build, interpreter): InterpreterObject.__init__(self) self.build = build + self.interpreter = interpreter self.methods.update({'get_compiler': self.get_compiler_method, 'is_cross_build' : self.is_cross_build_method, 'has_exe_wrapper' : self.has_exe_wrapper_method, 'is_unity' : self.is_unity_method, + 'current_source_dir' : self.current_source_dir_method, }) + def current_source_dir_method(self, args, kwargs): + src = self.interpreter.environment.source_dir + sub = self.interpreter.subdir + if sub == '': + return src + return os.path.join(src, sub) + def has_exe_wrapper_method(self, args, kwargs): if self.is_cross_build_method(None, None): return 'exe_wrap' in self.build.environment.cross_info @@ -600,7 +609,7 @@ class Interpreter(): self.builtin = {} self.builtin['build'] = Build() self.builtin['host'] = Host(build.environment) - self.builtin['meson'] = MesonMain(build) + self.builtin['meson'] = MesonMain(build, self) self.environment = build.environment self.build_func_dict() self.build_def_files = [environment.build_filename] diff --git a/test cases/linuxlike/3 linker script/meson.build b/test cases/linuxlike/3 linker script/meson.build index 8589eb3..30fcf62 100644 --- a/test cases/linuxlike/3 linker script/meson.build +++ b/test cases/linuxlike/3 linker script/meson.build @@ -1,6 +1,6 @@ project('linker script', 'c') -vflag = '-Wl,--version-script,@0@/bob.map'.format('/home/jpakkane/workspace/meson/test cases/linuxlike/3 linker script') +vflag = '-Wl,--version-script,@0@/bob.map'.format(meson.current_source_dir()) l = shared_library('bob', 'bob.c', link_flags : vflag) e = executable('prog', 'prog.c', link_with : l) |