C++ compiler can compile .h file, too.
This commit is contained in:
parent
7bc3b78c68
commit
836c978c94
|
@ -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])
|
||||
|
|
5
build.py
5
build.py
|
@ -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.')
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue