summaryrefslogtreecommitdiffstats
path: root/test cases/fortran/21 install static
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/fortran/21 install static')
-rw-r--r--test cases/fortran/21 install static/main.f905
-rw-r--r--test cases/fortran/21 install static/main_lib.f9016
-rw-r--r--test cases/fortran/21 install static/meson.build20
-rw-r--r--test cases/fortran/21 install static/subprojects/static_hello/meson.build12
-rw-r--r--test cases/fortran/21 install static/subprojects/static_hello/static_hello.f9017
-rw-r--r--test cases/fortran/21 install static/test.json10
6 files changed, 80 insertions, 0 deletions
diff --git a/test cases/fortran/21 install static/main.f90 b/test cases/fortran/21 install static/main.f90
new file mode 100644
index 0000000..d0c67fe
--- /dev/null
+++ b/test cases/fortran/21 install static/main.f90
@@ -0,0 +1,5 @@
+program main
+use main_lib
+implicit none
+call main_hello()
+end program
diff --git a/test cases/fortran/21 install static/main_lib.f90 b/test cases/fortran/21 install static/main_lib.f90
new file mode 100644
index 0000000..874584d
--- /dev/null
+++ b/test cases/fortran/21 install static/main_lib.f90
@@ -0,0 +1,16 @@
+module main_lib
+
+ use static_hello
+ implicit none
+
+ private
+ public :: main_hello
+
+ contains
+
+ subroutine main_hello
+ call static_say_hello()
+ print *, "Main hello routine finished."
+ end subroutine main_hello
+
+end module main_lib
diff --git a/test cases/fortran/21 install static/meson.build b/test cases/fortran/21 install static/meson.build
new file mode 100644
index 0000000..b4d3e40
--- /dev/null
+++ b/test cases/fortran/21 install static/meson.build
@@ -0,0 +1,20 @@
+# Based on 'fortran/5 static', but:
+# - Uses a subproject dependency
+# - Is an install:true static library to trigger certain codepath (promotion to link_whole)
+# - Does fortran code 'generation' with configure_file
+# - Uses .F90 ext (capital F typically denotes a dependence on preprocessor treatment, which however is not used)
+project('try-static-subproject-dependency', 'fortran')
+
+static_dep = dependency('static_hello', fallback: ['static_hello', 'static_hello_dep'])
+
+mainsrc = 'main_lib.f90'
+mainsrc = configure_file(
+ copy: true,
+ input: mainsrc,
+ output: 'main_lib_output.F90'
+)
+main_lib = library('mainstatic', mainsrc, dependencies: static_dep, install: true)
+main_dep = declare_dependency(link_with: main_lib)
+
+main_exe = executable('main_exe', 'main.f90', dependencies: main_dep)
+test('static_subproject_test', main_exe)
diff --git a/test cases/fortran/21 install static/subprojects/static_hello/meson.build b/test cases/fortran/21 install static/subprojects/static_hello/meson.build
new file mode 100644
index 0000000..5e13bae
--- /dev/null
+++ b/test cases/fortran/21 install static/subprojects/static_hello/meson.build
@@ -0,0 +1,12 @@
+project('static-hello', 'fortran')
+
+# staticlibsource = 'static_hello.f90'
+staticlibsource = configure_file(
+ copy: true,
+ input: 'static_hello.f90',
+ output: 'static_hello_output.F90'
+)
+
+static_hello_lib = static_library('static_hello', staticlibsource, install: false)
+
+static_hello_dep = declare_dependency(link_with: static_hello_lib)
diff --git a/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90 b/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90
new file mode 100644
index 0000000..5407560
--- /dev/null
+++ b/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90
@@ -0,0 +1,17 @@
+module static_hello
+implicit none
+
+private
+public :: static_say_hello
+
+interface static_say_hello
+ module procedure say_hello
+end interface static_say_hello
+
+contains
+
+subroutine say_hello
+ print *, "Static library called."
+end subroutine say_hello
+
+end module static_hello
diff --git a/test cases/fortran/21 install static/test.json b/test cases/fortran/21 install static/test.json
new file mode 100644
index 0000000..aff7147
--- /dev/null
+++ b/test cases/fortran/21 install static/test.json
@@ -0,0 +1,10 @@
+{
+ "installed": [
+ {"file": "usr/lib/libmainstatic.a", "type": "file"}
+ ],
+ "matrix": {
+ "options": {
+ "default_library": [ { "val": "static" } ]
+ }
+ }
+}