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):
|
def generate_gcc_pch_command(self, target, compiler, pch):
|
||||||
commands = []
|
commands = []
|
||||||
commands += self.generate_basic_compiler_flags(target, compiler)
|
commands += self.generate_basic_compiler_flags(target, compiler)
|
||||||
|
|
||||||
dst = os.path.join(self.get_target_private_dir(target),
|
dst = os.path.join(self.get_target_private_dir(target),
|
||||||
os.path.split(pch)[-1] + '.' + compiler.get_pch_suffix())
|
os.path.split(pch)[-1] + '.' + compiler.get_pch_suffix())
|
||||||
dep = dst + '.' + compiler.get_depfile_suffix()
|
dep = dst + '.' + compiler.get_depfile_suffix()
|
||||||
|
@ -953,7 +952,7 @@ class NinjaBackend(Backend):
|
||||||
if len(pch) == 0:
|
if len(pch) == 0:
|
||||||
continue
|
continue
|
||||||
if '/' not in pch[0] or '/' not in pch[-1]:
|
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)
|
compiler = self.get_compiler_for_lang(lang)
|
||||||
if compiler.id == 'msvc':
|
if compiler.id == 'msvc':
|
||||||
src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[-1])
|
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):
|
def add_pch(self, language, pchlist):
|
||||||
if len(pchlist) == 0:
|
if len(pchlist) == 0:
|
||||||
return
|
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 environment.is_header(pchlist[0]):
|
||||||
if not environment.is_source(pchlist[1]):
|
if not environment.is_source(pchlist[1]):
|
||||||
raise InvalidArguments('PCH definition must contain one header and at most one source.')
|
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']
|
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']
|
c_suffixes = ['c']
|
||||||
clike_suffixes = c_suffixes + cpp_suffixes
|
clike_suffixes = c_suffixes + cpp_suffixes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue