C++ is now called cpp rather than cxx.
This commit is contained in:
parent
8364bfcc6d
commit
89aa4e2233
|
@ -164,23 +164,23 @@ int main(int argc, char **argv) {
|
|||
raise EnvironmentException('Could not run sizeof test binary.')
|
||||
return int(so.decode())
|
||||
|
||||
cxx_suffixes = ['cc', 'cpp', 'cxx', 'hh', 'hpp', 'hxx']
|
||||
cpp_suffixes = ['cc', 'cpp', 'cxx', 'hh', 'hpp', 'hxx']
|
||||
|
||||
class CXXCompiler(CCompiler):
|
||||
class CPPCompiler(CCompiler):
|
||||
def __init__(self, exelist):
|
||||
CCompiler.__init__(self, exelist)
|
||||
self.language = 'cxx'
|
||||
self.language = 'cpp'
|
||||
self.default_suffix = 'cpp'
|
||||
|
||||
def can_compile(self, filename):
|
||||
suffix = filename.split('.')[-1]
|
||||
if suffix in cxx_suffixes:
|
||||
if suffix in cpp_suffixes:
|
||||
return True
|
||||
return False
|
||||
|
||||
def sanity_check(self, work_dir):
|
||||
source_name = os.path.join(work_dir, 'sanitycheckcxx.cc')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckcxx')
|
||||
source_name = os.path.join(work_dir, 'sanitycheckcpp.cc')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckcpp')
|
||||
ofile = open(source_name, 'w')
|
||||
ofile.write('class breakCCompiler;int main(int argc, char **argv) { return 0; }\n')
|
||||
ofile.close()
|
||||
|
@ -205,10 +205,10 @@ class ObjCCompiler(CCompiler):
|
|||
return True
|
||||
return False
|
||||
|
||||
class ObjCXXCompiler(CXXCompiler):
|
||||
class ObjCPPCompiler(CPPCompiler):
|
||||
def __init__(self, exelist):
|
||||
CXXCompiler.__init__(self, exelist)
|
||||
self.language = 'objcxx'
|
||||
CPPCompiler.__init__(self, exelist)
|
||||
self.language = 'objcpp'
|
||||
self.default_suffix = 'mm'
|
||||
|
||||
def can_compile(self, filename):
|
||||
|
@ -218,8 +218,8 @@ class ObjCXXCompiler(CXXCompiler):
|
|||
return False
|
||||
|
||||
def sanity_check(self, work_dir):
|
||||
source_name = os.path.join(work_dir, 'sanitycheckobjcxx.mm')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckobjcxx')
|
||||
source_name = os.path.join(work_dir, 'sanitycheckobjcpp.mm')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckobjcpp')
|
||||
ofile = open(source_name, 'w')
|
||||
ofile.write('#import<stdio.h>\nclass MyClass;int main(int argc, char **argv) { return 0; }\n')
|
||||
ofile.close()
|
||||
|
@ -290,21 +290,21 @@ class VisualStudioCCompiler(CCompiler):
|
|||
if pe.returncode != 0:
|
||||
raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string())
|
||||
|
||||
class VisualStudioCXXCompiler(VisualStudioCCompiler):
|
||||
class VisualStudioCPPCompiler(VisualStudioCCompiler):
|
||||
def __init__(self, exelist):
|
||||
VisualStudioCCompiler.__init__(self, exelist)
|
||||
self.language = 'cxx'
|
||||
self.language = 'cpp'
|
||||
self.default_suffix = 'cpp'
|
||||
|
||||
def can_compile(self, filename):
|
||||
suffix = filename.split('.')[-1]
|
||||
if suffix in cxx_suffixes:
|
||||
if suffix in cpp_suffixes:
|
||||
return True
|
||||
return False
|
||||
|
||||
def sanity_check(self, work_dir):
|
||||
source_name = os.path.join(work_dir, 'sanitycheckcxx.cpp')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckcxx')
|
||||
source_name = os.path.join(work_dir, 'sanitycheckcpp.cpp')
|
||||
binary_name = os.path.join(work_dir, 'sanitycheckcpp')
|
||||
ofile = open(source_name, 'w')
|
||||
ofile.write('class BreakPlainC;int main(int argc, char **argv) { return 0; }\n')
|
||||
ofile.close()
|
||||
|
@ -353,7 +353,7 @@ class GnuObjCCompiler(ObjCCompiler):
|
|||
def get_pch_suffix(self):
|
||||
return 'gch'
|
||||
|
||||
class GnuObjCXXCompiler(ObjCXXCompiler):
|
||||
class GnuObjCPPCompiler(ObjCPPCompiler):
|
||||
std_warn_flags = ['-Wall', '-Winvalid-pch']
|
||||
std_opt_flags = ['-O2']
|
||||
|
||||
|
@ -362,10 +362,10 @@ class GnuObjCXXCompiler(ObjCXXCompiler):
|
|||
self.id = 'gcc'
|
||||
|
||||
def get_std_warn_flags(self):
|
||||
return GnuObjCXXCompiler.std_warn_flags
|
||||
return GnuObjCPPCompiler.std_warn_flags
|
||||
|
||||
def get_std_opt_flags(self):
|
||||
return GnuObjCXXCompiler.std_opt_flags
|
||||
return GnuObjCPPCompiler.std_opt_flags
|
||||
|
||||
def get_pch_suffix(self):
|
||||
return 'gch'
|
||||
|
@ -387,36 +387,36 @@ class ClangCCompiler(CCompiler):
|
|||
def get_pch_suffix(self):
|
||||
return 'pch'
|
||||
|
||||
class GnuCXXCompiler(CXXCompiler):
|
||||
class GnuCPPCompiler(CPPCompiler):
|
||||
std_warn_flags = ['-Wall', '-Winvalid-pch']
|
||||
std_opt_flags = ['-O2']
|
||||
|
||||
def __init__(self, exelist):
|
||||
CXXCompiler.__init__(self, exelist)
|
||||
CPPCompiler.__init__(self, exelist)
|
||||
self.id = 'gcc'
|
||||
|
||||
def get_std_warn_flags(self):
|
||||
return GnuCXXCompiler.std_warn_flags
|
||||
return GnuCPPCompiler.std_warn_flags
|
||||
|
||||
def get_std_opt_flags(self):
|
||||
return GnuCXXCompiler.std_opt_flags
|
||||
return GnuCPPCompiler.std_opt_flags
|
||||
|
||||
def get_pch_suffix(self):
|
||||
return 'gch'
|
||||
|
||||
class ClangCXXCompiler(CXXCompiler):
|
||||
class ClangCPPCompiler(CPPCompiler):
|
||||
std_warn_flags = ['-Wall', '-Winvalid-pch']
|
||||
std_opt_flags = ['-O2']
|
||||
|
||||
def __init__(self, exelist):
|
||||
CXXCompiler.__init__(self, exelist)
|
||||
CPPCompiler.__init__(self, exelist)
|
||||
self.id = 'clang'
|
||||
|
||||
def get_std_warn_flags(self):
|
||||
return ClangCXXCompiler.std_warn_flags
|
||||
return ClangCPPCompiler.std_warn_flags
|
||||
|
||||
def get_std_opt_flags(self):
|
||||
return ClangCXXCompiler.std_opt_flags
|
||||
return ClangCPPCompiler.std_opt_flags
|
||||
|
||||
def get_pch_suffix(self):
|
||||
return 'pch'
|
||||
|
@ -522,12 +522,12 @@ class Environment():
|
|||
# List of potential compilers.
|
||||
if is_windows():
|
||||
self.default_c = ['cl', 'cc']
|
||||
self.default_cxx = ['cl', 'c++']
|
||||
self.default_cpp = ['cl', 'c++']
|
||||
else:
|
||||
self.default_c = ['cc']
|
||||
self.default_cxx = ['c++']
|
||||
self.default_cpp = ['c++']
|
||||
self.default_objc = ['cc']
|
||||
self.default_objcxx = ['c++']
|
||||
self.default_objcpp = ['c++']
|
||||
self.default_static_linker = 'ar'
|
||||
self.vs_static_linker = 'lib'
|
||||
|
||||
|
@ -608,13 +608,13 @@ class Environment():
|
|||
path = os.path.split(__file__)[0]
|
||||
return os.path.join(path, 'depfixer.py')
|
||||
|
||||
def detect_cxx_compiler(self):
|
||||
def detect_cpp_compiler(self):
|
||||
evar = 'CC'
|
||||
if evar in os.environ:
|
||||
compilers = os.environ[evar].split()
|
||||
ccache = []
|
||||
else:
|
||||
compilers = self.default_cxx
|
||||
compilers = self.default_cpp
|
||||
ccache = self.detect_ccache()
|
||||
for compiler in compilers:
|
||||
basename = os.path.basename(compiler).lower()
|
||||
|
@ -632,13 +632,13 @@ class Environment():
|
|||
out = out.decode()
|
||||
if (out.startswith('c++ ') or out.startswith('g++')) and \
|
||||
'Free Software Foundation' in out:
|
||||
return GnuCXXCompiler(ccache + [compiler])
|
||||
return GnuCPPCompiler(ccache + [compiler])
|
||||
if 'apple' in out and 'Free Software Foundation' in out:
|
||||
return GnuCXXCompiler(ccache + [compiler])
|
||||
return GnuCPPCompiler(ccache + [compiler])
|
||||
if out.startswith('clang'):
|
||||
return ClangCXXCompiler(ccache + [compiler])
|
||||
return ClangCPPCompiler(ccache + [compiler])
|
||||
if 'Microsoft' in out:
|
||||
return VisualStudioCXXCompiler([compiler])
|
||||
return VisualStudioCPPCompiler([compiler])
|
||||
raise EnvironmentException('Unknown compiler(s) "' + ', '.join(compilers) + '"')
|
||||
|
||||
def detect_objc_compiler(self):
|
||||
|
@ -656,8 +656,8 @@ class Environment():
|
|||
return GnuObjCCompiler(exelist)
|
||||
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
|
||||
|
||||
def detect_objcxx_compiler(self):
|
||||
exelist = self.get_objcxx_compiler_exelist()
|
||||
def detect_objcpp_compiler(self):
|
||||
exelist = self.get_objcpp_compiler_exelist()
|
||||
try:
|
||||
p = subprocess.Popen(exelist + ['--version'], stdout=subprocess.PIPE)
|
||||
except OSError:
|
||||
|
@ -666,9 +666,9 @@ class Environment():
|
|||
out = out.decode()
|
||||
if (out.startswith('c++ ') or out.startswith('g++')) and \
|
||||
'Free Software Foundation' in out:
|
||||
return GnuObjCXXCompiler(exelist)
|
||||
return GnuObjCPPCompiler(exelist)
|
||||
if 'apple' in out and 'Free Software Foundation' in out:
|
||||
return GnuObjCXXCompiler(exelist)
|
||||
return GnuObjCPPCompiler(exelist)
|
||||
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
|
||||
|
||||
def detect_static_linker(self, compiler):
|
||||
|
@ -717,12 +717,12 @@ class Environment():
|
|||
return os.environ[evar].split()
|
||||
return ccachelist + self.default_objc
|
||||
|
||||
def get_objcxx_compiler_exelist(self):
|
||||
def get_objcpp_compiler_exelist(self):
|
||||
ccachelist = self.detect_ccache()
|
||||
evar = 'OBJCXX'
|
||||
if evar in os.environ:
|
||||
return os.environ[evar].split()
|
||||
return ccachelist + self.default_objcxx
|
||||
return ccachelist + self.default_objcpp
|
||||
|
||||
def get_source_dir(self):
|
||||
return self.source_dir
|
||||
|
|
|
@ -387,10 +387,10 @@ class BuildTarget(InterpreterObject):
|
|||
if not isinstance(clist, list):
|
||||
clist = [clist]
|
||||
self.add_compiler_args('c', clist)
|
||||
cxxlist = kwargs.get('cxx_args', [])
|
||||
if not isinstance(cxxlist, list):
|
||||
cxxlist = [cxxlist]
|
||||
self.add_compiler_args('cxx', cxxlist)
|
||||
cpplist = kwargs.get('cpp_args', [])
|
||||
if not isinstance(cpplist, list):
|
||||
cpplist = [cpplist]
|
||||
self.add_compiler_args('cpp', cpplist)
|
||||
if 'version' in kwargs:
|
||||
self.set_version(kwargs['version'])
|
||||
if 'soversion' in kwargs:
|
||||
|
@ -767,12 +767,12 @@ class Interpreter():
|
|||
else:
|
||||
if lang.lower() == 'c':
|
||||
comp = self.environment.detect_c_compiler()
|
||||
elif lang.lower() == 'cxx':
|
||||
comp = self.environment.detect_cxx_compiler()
|
||||
elif lang.lower() == 'cpp':
|
||||
comp = self.environment.detect_cpp_compiler()
|
||||
elif lang.lower() == 'objc':
|
||||
comp = self.environment.detect_objc_compiler()
|
||||
elif lang.lower() == 'objcxx':
|
||||
comp = self.environment.detect_objcxx_compiler()
|
||||
elif lang.lower() == 'objcpp':
|
||||
comp = self.environment.detect_objcpp_compiler()
|
||||
else:
|
||||
raise InvalidCode('Tried to use unknown language "%s".' % lang)
|
||||
comp.sanity_check(self.environment.get_scratch_dir())
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
project('c++ pch test', 'cxx')
|
||||
project('c++ pch test', 'cpp')
|
||||
exe = executable('prog', 'prog.cc', pch : 'pch/prog.hh')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('mixed C and C++ pch test', 'cxx', 'c')
|
||||
project('mixed C and C++ pch test', 'cpp', 'c')
|
||||
|
||||
pch = ['pch/main.hh', 'pch/func.h']
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
project('c++ test', 'cxx')
|
||||
project('c++ test', 'cpp')
|
||||
exe = executable('trivialprog', 'trivial.cc')
|
||||
test('runtest', exe)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
project('global arg test', 'cxx', 'c')
|
||||
project('global arg test', 'cpp', 'c')
|
||||
|
||||
add_global_arguments('-DMYTHING', language : 'c')
|
||||
add_global_arguments('-DMYCXXTHING', language : 'cxx')
|
||||
add_global_arguments('-DMYCPPTHING', language : 'cpp')
|
||||
|
||||
exe1 = executable('prog', 'prog.c')
|
||||
exe2 = executable('prog2', 'prog.cc')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#error "Global argument not set"
|
||||
#endif
|
||||
|
||||
#ifdef MYCXXTHING
|
||||
#ifdef MYCPPTHING
|
||||
#error "Wrong global argument set"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#error "Wrong global argument set"
|
||||
#endif
|
||||
|
||||
#ifndef MYCXXTHING
|
||||
#ifndef MYCPPTHING
|
||||
#error "Global argument not set"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#error "Local argument not set"
|
||||
#endif
|
||||
|
||||
#ifdef CXXTHING
|
||||
#ifdef CPPTHING
|
||||
#error "Wrong local argument set"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
project('local arg test', 'cxx', 'c')
|
||||
project('local arg test', 'cpp', 'c')
|
||||
|
||||
exe1 = executable('prog', 'prog.cc', 'func.c', \
|
||||
c_args : '-DCTHING', \
|
||||
cxx_args : '-DCXXTHING')
|
||||
cpp_args : '-DCPPTHING')
|
||||
|
||||
test('prog1', exe1)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#error "Wrong local argument set"
|
||||
#endif
|
||||
|
||||
#ifndef CXXTHING
|
||||
#ifndef CPPTHING
|
||||
#error "Local argument not set"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
project('mixed C and C++', 'c', 'cxx')
|
||||
project('mixed C and C++', 'c', 'cpp')
|
||||
exe = executable('prog', 'main.cc', 'func.c')
|
||||
test('mixtest', exe)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('boosttest', 'cxx')
|
||||
project('boosttest', 'cpp')
|
||||
|
||||
# We want to have multiple separate configurations of Boost
|
||||
# within one project. The need to be independent of each other.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('gtest', 'cxx')
|
||||
project('gtest', 'cpp')
|
||||
|
||||
gtest = dependency('gtest')
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('gmock test', 'cxx')
|
||||
project('gmock test', 'cpp')
|
||||
|
||||
# Using gmock without gtest is a pain so just
|
||||
# don't support that then.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('qt5 build test', 'cxx')
|
||||
project('qt5 build test', 'cpp')
|
||||
|
||||
qt5dep = dependency('qt5', modules : 'Widgets')
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('protocol buffer test', 'cxx')
|
||||
project('protocol buffer test', 'cpp')
|
||||
|
||||
protoc = find_program('protoc')
|
||||
dep = dependency('protobuf')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('Objective C++', 'objcxx')
|
||||
project('Objective C++', 'objcpp')
|
||||
|
||||
exe = executable('objcxxprog', 'prog.mm')
|
||||
test('objcxx', exe)
|
||||
exe = executable('objcppprog', 'prog.mm')
|
||||
test('objcpp', exe)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('wincxx', 'cxx')
|
||||
project('wincpp', 'cpp')
|
||||
|
||||
exe = executable('prog', 'prog.cpp')
|
||||
test('wincxx', exe)
|
||||
test('wincpp', exe)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
project('winmaincpp', 'cxx')
|
||||
project('winmaincpp', 'cpp')
|
||||
|
||||
exe = executable('prog', 'prog.cpp')
|
||||
test('winmaincpp', exe)
|
||||
|
|
Loading…
Reference in New Issue