xcode-backend: add implicit includes

Move helper functions get_source_dir_include_args and
get_build_dir_include_args to backend base class
pull/8309/head
Jeff Moguillansky 4 years ago committed by Dylan Baker
parent 7fd69cb4c4
commit 9226a92fe0
  1. 11
      mesonbuild/backend/backends.py
  2. 11
      mesonbuild/backend/ninjabackend.py
  3. 10
      mesonbuild/backend/xcodebackend.py

@ -248,6 +248,17 @@ class Backend:
return self.environment.coredata.validate_option_value(option_name, override)
return self.environment.coredata.get_option(option_name.evolve(subproject=target.subproject))
def get_source_dir_include_args(self, target, compiler):
curdir = target.get_subdir()
tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir))
return compiler.get_include_args(tmppath, False)
def get_build_dir_include_args(self, target, compiler):
curdir = target.get_subdir()
if curdir == '':
curdir = '.'
return compiler.get_include_args(curdir, False)
def get_target_filename_for_linking(self, target):
# On some platforms (msvc for instance), the file that is used for
# dynamic linking is not the same as the dynamic library itself. This

@ -2334,17 +2334,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
self.add_build(element)
return (rel_obj, rel_src)
def get_source_dir_include_args(self, target, compiler):
curdir = target.get_subdir()
tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir))
return compiler.get_include_args(tmppath, False)
def get_build_dir_include_args(self, target, compiler):
curdir = target.get_subdir()
if curdir == '':
curdir = '.'
return compiler.get_include_args(curdir, False)
@lru_cache(maxsize=None)
def get_normpath_target(self, source) -> str:
return os.path.normpath(source)

@ -738,7 +738,6 @@ class XCodeBackend(backends.Backend):
ldargs += self.build.get_project_link_args(linker, target.subproject, target.for_machine)
ldargs += self.build.get_global_link_args(linker, target.for_machine)
cargs = []
cargs.append('-I.')
for dep in target.get_external_deps():
cargs += dep.get_compile_args()
ldargs += dep.get_link_args()
@ -756,8 +755,13 @@ class XCodeBackend(backends.Backend):
targs = target.get_extra_args(lang)
args = pargs + gargs + targs
if args:
langargs[langnamemap[lang]] = args
langargs[langnamemap[lang]] += cargs
langname = langnamemap[lang]
compiler = target.compilers.get(lang)
lang_cargs = cargs
if compiler and target.implicit_include_directories:
lang_cargs += self.get_build_dir_include_args(target, compiler)
langargs[langname] = args
langargs[langname] += lang_cargs
symroot = os.path.join(self.environment.get_build_dir(), target.subdir)
self.write_line('%s /* %s */ = {' % (valid, buildtype))
self.indent_level += 1

Loading…
Cancel
Save