aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/fortran/7 generated
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/fortran/7 generated')
-rw-r--r--meson/test cases/fortran/7 generated/meson.build29
-rw-r--r--meson/test cases/fortran/7 generated/mod1.fpp6
-rw-r--r--meson/test cases/fortran/7 generated/mod2.fpp7
-rw-r--r--meson/test cases/fortran/7 generated/mod3.fpp6
-rw-r--r--meson/test cases/fortran/7 generated/prog.f908
5 files changed, 56 insertions, 0 deletions
diff --git a/meson/test cases/fortran/7 generated/meson.build b/meson/test cases/fortran/7 generated/meson.build
new file mode 100644
index 000000000..b555b1744
--- /dev/null
+++ b/meson/test cases/fortran/7 generated/meson.build
@@ -0,0 +1,29 @@
+# Tests whether fortran sources files created during configuration are properly
+# scanned for dependency information
+
+project('generated', 'fortran',
+ default_options : ['default_library=static'])
+
+conf_data = configuration_data()
+conf_data.set('ONE', 1)
+conf_data.set('TWO', 2)
+conf_data.set('THREE', 3)
+
+configure_file(input : 'mod3.fpp', output : 'mod3.f90', configuration : conf_data)
+# Manually build absolute path to source file to test
+# https://github.com/mesonbuild/meson/issues/7265
+three = library('mod3', meson.current_build_dir() / 'mod3.f90')
+
+templates_basenames = ['mod2', 'mod1']
+generated_sources = []
+foreach template_basename : templates_basenames
+ infilename = '@0@.fpp'.format(template_basename)
+ outfilename = '@0@.f90'.format(template_basename)
+ outfile = configure_file(
+ input : infilename, output : outfilename, configuration : conf_data)
+ generated_sources += [outfile]
+endforeach
+
+sources = ['prog.f90'] + generated_sources
+exe = executable('generated', sources, link_with: three)
+test('generated', exe)
diff --git a/meson/test cases/fortran/7 generated/mod1.fpp b/meson/test cases/fortran/7 generated/mod1.fpp
new file mode 100644
index 000000000..c4decf68f
--- /dev/null
+++ b/meson/test cases/fortran/7 generated/mod1.fpp
@@ -0,0 +1,6 @@
+module mod1
+implicit none
+
+integer, parameter :: modval1 = @ONE@
+
+end module mod1
diff --git a/meson/test cases/fortran/7 generated/mod2.fpp b/meson/test cases/fortran/7 generated/mod2.fpp
new file mode 100644
index 000000000..78ceae45d
--- /dev/null
+++ b/meson/test cases/fortran/7 generated/mod2.fpp
@@ -0,0 +1,7 @@
+module mod2
+use mod1, only : modval1
+implicit none
+
+integer, parameter :: modval2 = @TWO@
+
+end module mod2
diff --git a/meson/test cases/fortran/7 generated/mod3.fpp b/meson/test cases/fortran/7 generated/mod3.fpp
new file mode 100644
index 000000000..ab3db6555
--- /dev/null
+++ b/meson/test cases/fortran/7 generated/mod3.fpp
@@ -0,0 +1,6 @@
+module mod3
+implicit none
+
+integer, parameter :: modval3 = @THREE@
+
+end module mod3
diff --git a/meson/test cases/fortran/7 generated/prog.f90 b/meson/test cases/fortran/7 generated/prog.f90
new file mode 100644
index 000000000..6ee0bca15
--- /dev/null
+++ b/meson/test cases/fortran/7 generated/prog.f90
@@ -0,0 +1,8 @@
+program generated
+use mod2, only : modval1, modval2
+use mod3, only : modval3
+implicit none
+
+if (modval1 + modval2 + modval3 /= 6) error stop
+
+end program generated