ninjabackend: Add subdir includes before external dep includes

Fixes https://github.com/mesonbuild/meson/issues/604
pull/607/head
Nirbheek Chauhan 9 years ago
parent 06ce41b525
commit 50fef89218
  1. 15
      mesonbuild/backend/ninjabackend.py

@ -1422,21 +1422,21 @@ rule FORTRAN_DEP_HACK
commands = [] commands = []
# The first thing is implicit include directories: source, build and private. # The first thing is implicit include directories: source, build and private.
commands += compiler.get_include_args(self.get_target_private_dir(target), False) commands += compiler.get_include_args(self.get_target_private_dir(target), False)
# Compiler args for compiling this target
commands += compilers.get_base_compile_args(self.environment.coredata.base_options, commands += compilers.get_base_compile_args(self.environment.coredata.base_options,
compiler) compiler)
# Add the root source and build directories as include dirs
curdir = target.get_subdir() curdir = target.get_subdir()
tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir)) tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir))
commands += compiler.get_include_args(tmppath, False) commands += compiler.get_include_args(tmppath, False)
if curdir == '': if curdir == '':
curdir = '.' curdir = '.'
commands += compiler.get_include_args(curdir, False) commands += compiler.get_include_args(curdir, False)
commands += self.generate_basic_compiler_args(target, compiler) # -I args work differently than other ones. In them the first found
# -I args work differently than other ones. In them the # directory is used whereas for other flags (such as -ffoo -fno-foo) the
# first found directory is used whereas for other flags # latest one is used. Therefore put the internal include directories
# (such as -ffoo -fno-foo) the latest one is used. # here before generating the "basic compiler args" so they override args
# Therefore put the internal include directories here # coming from e.g. pkg-config.
# at the beginning so they override args coming from
# e.g. pkg-config.
for i in target.get_include_dirs(): for i in target.get_include_dirs():
basedir = i.get_curdir() basedir = i.get_curdir()
for d in i.get_incdirs(): for d in i.get_incdirs():
@ -1448,6 +1448,7 @@ rule FORTRAN_DEP_HACK
commands += sargs commands += sargs
for d in i.get_extra_build_dirs(): for d in i.get_extra_build_dirs():
commands += compiler.get_include_args(d, i.is_system) commands += compiler.get_include_args(d, i.is_system)
commands += self.generate_basic_compiler_args(target, compiler)
for d in target.external_deps: for d in target.external_deps:
if d.need_threads(): if d.need_threads():
commands += compiler.thread_flags() commands += compiler.thread_flags()

Loading…
Cancel
Save