Xcode: put all include dirs via a property rather than a cmd line arg.

pull/8683/head
Jussi Pakkanen 4 years ago
parent b42a5e21d0
commit 674538d8c9
  1. 8
      mesonbuild/backend/backends.py
  2. 15
      mesonbuild/backend/xcodebackend.py

@ -1169,7 +1169,7 @@ class Backend:
def get_normpath_target(self, source) -> str: def get_normpath_target(self, source) -> str:
return os.path.normpath(source) return os.path.normpath(source)
def get_custom_target_dir_include_args(self, target, compiler, *, absolute_path=False): def get_custom_target_dirs(self, target, compiler, *, absolute_path=False):
custom_target_include_dirs = [] custom_target_include_dirs = []
for i in target.get_generated_sources(): for i in target.get_generated_sources():
# Generator output goes into the target private dir which is # Generator output goes into the target private dir which is
@ -1184,11 +1184,15 @@ class Backend:
idir = os.path.join(self.environment.get_build_dir(), idir) idir = os.path.join(self.environment.get_build_dir(), idir)
if idir not in custom_target_include_dirs: if idir not in custom_target_include_dirs:
custom_target_include_dirs.append(idir) custom_target_include_dirs.append(idir)
return custom_target_include_dirs
def get_custom_target_dir_include_args(self, target, compiler, *, absolute_path=False):
incs = [] incs = []
for i in custom_target_include_dirs: for i in self.get_custom_target_dirs(target, compiler, absolute_path=absolute_path):
incs += compiler.get_include_args(i, False) incs += compiler.get_include_args(i, False)
return incs return incs
def eval_custom_target_command(self, target, absolute_outputs=False): def eval_custom_target_command(self, target, absolute_outputs=False):
# We want the outputs to be absolute only when using the VS backend # We want the outputs to be absolute only when using the VS backend
# XXX: Maybe allow the vs backend to use relative paths too? # XXX: Maybe allow the vs backend to use relative paths too?

@ -1406,9 +1406,6 @@ class XCodeBackend(backends.Backend):
# It is unclear what is the cwd when xcode runs. -I. does not seem to # It is unclear what is the cwd when xcode runs. -I. does not seem to
# add the root build dir to the search path. So add an absolute path instead. # add the root build dir to the search path. So add an absolute path instead.
# This may break reproducible builds, in which case patches are welcome. # This may break reproducible builds, in which case patches are welcome.
lang_cargs += compiler.get_include_args(self.get_target_private_dir_abs(target), is_system=False)
lang_cargs += self.get_build_dir_include_args(target, compiler, absolute_path=True)
lang_cargs += self.get_source_dir_include_args(target, compiler, absolute_path=True)
lang_cargs += self.get_custom_target_dir_include_args(target, compiler, absolute_path=True) lang_cargs += self.get_custom_target_dir_include_args(target, compiler, absolute_path=True)
langargs[langname] = args langargs[langname] = args
langargs[langname] += lang_cargs langargs[langname] += lang_cargs
@ -1448,12 +1445,18 @@ class XCodeBackend(backends.Backend):
settings_dict.add_item('GCC_PREFIX_HEADER', f'"$(PROJECT_DIR)/{relative_pch_path}"') settings_dict.add_item('GCC_PREFIX_HEADER', f'"$(PROJECT_DIR)/{relative_pch_path}"')
settings_dict.add_item('GCC_PREPROCESSOR_DEFINITIONS', '""') settings_dict.add_item('GCC_PREPROCESSOR_DEFINITIONS', '""')
settings_dict.add_item('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO') settings_dict.add_item('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO')
header_arr = PbxArray()
unquoted_headers = []
unquoted_headers.append(self.get_target_private_dir_abs(target))
unquoted_headers.append(os.path.join(self.environment.get_build_dir(), target.get_subdir()))
unquoted_headers.append(os.path.join(self.environment.get_source_dir(), target.get_subdir()))
if headerdirs: if headerdirs:
header_arr = PbxArray()
for i in headerdirs: for i in headerdirs:
i = os.path.normpath(i) i = os.path.normpath(i)
header_arr.add_item(f'"\\"{i}\\""') unquoted_headers.append(i)
settings_dict.add_item('HEADER_SEARCH_PATHS', header_arr) for i in unquoted_headers:
header_arr.add_item(f'"\\"{i}\\""')
settings_dict.add_item('HEADER_SEARCH_PATHS', header_arr)
settings_dict.add_item('INSTALL_PATH', f'"{install_path}"') settings_dict.add_item('INSTALL_PATH', f'"{install_path}"')
settings_dict.add_item('LIBRARY_SEARCH_PATHS', '""') settings_dict.add_item('LIBRARY_SEARCH_PATHS', '""')
if isinstance(target, build.SharedModule): if isinstance(target, build.SharedModule):

Loading…
Cancel
Save