diff options
-rw-r--r-- | backends.py | 3 | ||||
-rw-r--r-- | build.py | 5 | ||||
-rw-r--r-- | environment.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/backends.py b/backends.py index e4aaced..4af9be2 100644 --- a/backends.py +++ b/backends.py @@ -938,7 +938,6 @@ class NinjaBackend(Backend): def generate_gcc_pch_command(self, target, compiler, pch): commands = [] commands += self.generate_basic_compiler_flags(target, compiler) - dst = os.path.join(self.get_target_private_dir(target), os.path.split(pch)[-1] + '.' + compiler.get_pch_suffix()) dep = dst + '.' + compiler.get_depfile_suffix() @@ -953,7 +952,7 @@ class NinjaBackend(Backend): if len(pch) == 0: continue if '/' not in pch[0] or '/' not in pch[-1]: - raise build.InvalidArguments('Precompiled header of "%s" must not be in the same direcotory as source, please put it in a subdirectory.' % target.get_basename()) + raise build.InvalidArguments('Precompiled header of "%s" must not be in the same directory as source, please put it in a subdirectory.' % target.get_basename()) compiler = self.get_compiler_for_lang(lang) if compiler.id == 'msvc': src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[-1]) @@ -319,7 +319,10 @@ class BuildTarget(): def add_pch(self, language, pchlist): if len(pchlist) == 0: return - if len(pchlist) == 2: + elif len(pchlist) == 1: + if not environment.is_header(pchlist[0]): + raise InvalidArguments('Pch argument %s is not a header.' % pchlist[0]) + elif len(pchlist) == 2: if environment.is_header(pchlist[0]): if not environment.is_source(pchlist[1]): raise InvalidArguments('PCH definition must contain one header and at most one source.') diff --git a/environment.py b/environment.py index c48d87d..58a7bf6 100644 --- a/environment.py +++ b/environment.py @@ -775,7 +775,7 @@ def detect_ninja(): header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H'] -cpp_suffixes = ['cc', 'cpp', 'cxx', 'hh', 'hpp', 'hxx'] +cpp_suffixes = ['cc', 'cpp', 'cxx', 'h', 'hh', 'hpp', 'hxx', 'c++'] c_suffixes = ['c'] clike_suffixes = c_suffixes + cpp_suffixes |