diff options
-rw-r--r-- | environment.py | 9 | ||||
-rw-r--r-- | test cases/common/6 linkshared/cpplib.cpp | 3 | ||||
-rw-r--r-- | test cases/common/6 linkshared/cppmain.cpp | 5 | ||||
-rw-r--r-- | test cases/common/6 linkshared/meson.build | 7 |
4 files changed, 19 insertions, 5 deletions
diff --git a/environment.py b/environment.py index 3b0078a..55a2273 100644 --- a/environment.py +++ b/environment.py @@ -753,9 +753,10 @@ class GnuCPPCompiler(CPPCompiler): # may need to separate the latter to extra_debug_flags or something std_debug_flags = ['-g'] - def __init__(self, exelist, version, is_cross, exe_wrap): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrap): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap) self.id = 'gcc' + self.gcc_type = gcc_type def get_always_flags(self): return ['-pipe'] @@ -1120,11 +1121,11 @@ class Environment(): version = vmatch.group(0) else: version = 'unknown version' + if 'apple' in out and 'Free Software Foundation' in out: + return GnuCPPCompiler(ccache + [compiler], version, GCC_OSX, is_cross, exe_wrap) if (out.startswith('c++ ') or 'g++' in out or 'GCC' in out) and \ 'Free Software Foundation' in out: - return GnuCPPCompiler(ccache + [compiler], version, is_cross, exe_wrap) - if 'apple' in out and 'Free Software Foundation' in out: - return GnuCPPCompiler(ccache + [compiler], version, is_cross, exe_wrap) + return GnuCPPCompiler(ccache + [compiler], version, GCC_STANDARD, is_cross, exe_wrap) if 'clang' in out: return ClangCPPCompiler(ccache + [compiler], version, is_cross, exe_wrap) if 'Microsoft' in out: diff --git a/test cases/common/6 linkshared/cpplib.cpp b/test cases/common/6 linkshared/cpplib.cpp new file mode 100644 index 0000000..b997405 --- /dev/null +++ b/test cases/common/6 linkshared/cpplib.cpp @@ -0,0 +1,3 @@ +int cppfunc() { + return 42; +} diff --git a/test cases/common/6 linkshared/cppmain.cpp b/test cases/common/6 linkshared/cppmain.cpp new file mode 100644 index 0000000..b2e4025 --- /dev/null +++ b/test cases/common/6 linkshared/cppmain.cpp @@ -0,0 +1,5 @@ +int cppfunc(); + +int main(int argc, char **argv) { + return cppfunc() != 42; +} diff --git a/test cases/common/6 linkshared/meson.build b/test cases/common/6 linkshared/meson.build index 8e10295..1ecb052 100644 --- a/test cases/common/6 linkshared/meson.build +++ b/test cases/common/6 linkshared/meson.build @@ -1,7 +1,12 @@ -project('shared library linking test', 'c') +project('shared library linking test', 'c', 'cpp') + lib = shared_library('mylib', 'libfile.c' # Split to different lines before and after the comma to test parser. , install : true) exe = executable('prog', 'main.c', link_with : lib, install : true) test('runtest', exe) + +cpplib = shared_library('mycpplib', 'cpplib.cpp') +cppexe = executable('cppprog', 'cppmain.cpp', link_with : cpplib) +test('cpptest', cppexe) |