diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-25 22:46:39 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-05-02 22:58:07 +0300 |
commit | a2fdaa9ea081304dda70557755f5895194227668 (patch) | |
tree | 7e4d12dbaec11242a2a6c764cf16ddc16df9f495 /test cases | |
parent | 1918c0d231f0c04b1a57c2fdf057b50c8aa7312b (diff) | |
download | meson-a2fdaa9ea081304dda70557755f5895194227668.zip meson-a2fdaa9ea081304dda70557755f5895194227668.tar.gz meson-a2fdaa9ea081304dda70557755f5895194227668.tar.bz2 |
Can use C++ and FORTRAN in a single target. Closes #2685.
Diffstat (limited to 'test cases')
-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 |
3 files changed, 23 insertions, 0 deletions
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) |