diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-05-03 00:44:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-03 00:44:37 +0300 |
commit | 6c115f1626f9f1f945b3de75ca38f5bc2ac4aad3 (patch) | |
tree | 66f687ed20229ff8e2515d2df0ec9ed27997faea /test cases | |
parent | 8d5598227ecc9be346919532fd1ee0cf71a82312 (diff) | |
parent | a2fdaa9ea081304dda70557755f5895194227668 (diff) | |
download | meson-6c115f1626f9f1f945b3de75ca38f5bc2ac4aad3.zip meson-6c115f1626f9f1f945b3de75ca38f5bc2ac4aad3.tar.gz meson-6c115f1626f9f1f945b3de75ca38f5bc2ac4aad3.tar.bz2 |
Merge pull request #3474 from mesonbuild/dcpp
Can combine D and C++ in a single target.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/d/10 d cpp/cppmain.cpp | 6 | ||||
-rw-r--r-- | test cases/d/10 d cpp/dmain.d | 5 | ||||
-rw-r--r-- | test cases/d/10 d cpp/libfile.cpp | 5 | ||||
-rw-r--r-- | test cases/d/10 d cpp/libfile.d | 5 | ||||
-rw-r--r-- | test cases/d/10 d cpp/meson.build | 13 | ||||
-rw-r--r-- | test cases/fortran/9 cpp/fortran.f | 5 | ||||
-rw-r--r-- | test cases/fortran/9 cpp/main.cpp | 8 | ||||
-rw-r--r-- | test cases/fortran/9 cpp/meson.build | 10 |
8 files changed, 57 insertions, 0 deletions
diff --git a/test cases/d/10 d cpp/cppmain.cpp b/test cases/d/10 d cpp/cppmain.cpp new file mode 100644 index 0000000..aeddf56 --- /dev/null +++ b/test cases/d/10 d cpp/cppmain.cpp @@ -0,0 +1,6 @@ +extern void print_hello(int i); + +int main(int, char**) { + print_hello(1); + return 0; +} diff --git a/test cases/d/10 d cpp/dmain.d b/test cases/d/10 d cpp/dmain.d new file mode 100644 index 0000000..bece25f --- /dev/null +++ b/test cases/d/10 d cpp/dmain.d @@ -0,0 +1,5 @@ +extern (C++) void print_hello(int i); + +void main() { + print_hello(1); +} diff --git a/test cases/d/10 d cpp/libfile.cpp b/test cases/d/10 d cpp/libfile.cpp new file mode 100644 index 0000000..2ea67fc --- /dev/null +++ b/test cases/d/10 d cpp/libfile.cpp @@ -0,0 +1,5 @@ +#include<iostream> + +void print_hello(int i) { + std::cout << "Hello. Here is a number printed with C++: " << i << ".\n"; +} diff --git a/test cases/d/10 d cpp/libfile.d b/test cases/d/10 d cpp/libfile.d new file mode 100644 index 0000000..88cb53e --- /dev/null +++ b/test cases/d/10 d cpp/libfile.d @@ -0,0 +1,5 @@ +import std.stdio; + +extern (C++) void print_hello(int i) { + writefln("Hello. Here is a number printed with D: %d", i); +} diff --git a/test cases/d/10 d cpp/meson.build b/test cases/d/10 d cpp/meson.build new file mode 100644 index 0000000..eecb151 --- /dev/null +++ b/test cases/d/10 d cpp/meson.build @@ -0,0 +1,13 @@ +project('d and c++', 'd', 'cpp') + +cpp = meson.get_compiler('cpp') + +if cpp.get_id() == 'clang' + error('MESON_SKIP_TEST combining Clang C++ with GDC produces broken executables.') +endif + +e1 = executable('dcpp', 'dmain.d', 'libfile.cpp') +test('dcpp', e1) + +e2 = executable('cppd', 'cppmain.cpp', 'libfile.d') +test('cppd', e2) diff --git a/test cases/fortran/9 cpp/fortran.f b/test cases/fortran/9 cpp/fortran.f new file mode 100644 index 0000000..e694669 --- /dev/null +++ b/test cases/fortran/9 cpp/fortran.f @@ -0,0 +1,5 @@ + function fortran() bind(C) + use, intrinsic :: iso_c_binding + real(kind=c_double) :: fortran + fortran = 2.0**rand(1) + end function fortran diff --git a/test cases/fortran/9 cpp/main.cpp b/test cases/fortran/9 cpp/main.cpp new file mode 100644 index 0000000..f5828f4 --- /dev/null +++ b/test cases/fortran/9 cpp/main.cpp @@ -0,0 +1,8 @@ +#include <iostream> + +extern "C" double fortran(); + +int main(int, char**) { + std::cout << "FORTRAN gave us this number: " << fortran() << '\n'; + return 0; +} diff --git a/test cases/fortran/9 cpp/meson.build b/test cases/fortran/9 cpp/meson.build new file mode 100644 index 0000000..49497c0 --- /dev/null +++ b/test cases/fortran/9 cpp/meson.build @@ -0,0 +1,10 @@ +project('C++ and FORTRAN', 'cpp', 'fortran') + +cpp = meson.get_compiler('cpp') + +if cpp.get_id() == 'clang' + error('MESON_SKIP_TEST Clang C++ does not find -lgfortran for some reason.') +endif + +e = executable('cppfort', 'main.cpp', 'fortran.f') +test('C++ FORTRAN', e) |