Can get source dir location and use it to build stuff.

pull/15/head
Jussi Pakkanen 11 years ago
parent 040083cdb6
commit 9318203257
  1. 13
      interpreter.py
  2. 2
      test cases/linuxlike/3 linker script/meson.build

@ -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]

@ -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)

Loading…
Cancel
Save