diff options
author | Jonas Lundholm Bertelsen <drixi.b@gmail.com> | 2021-01-20 18:22:01 +0100 |
---|---|---|
committer | Jonas Lundholm Bertelsen <drixi.b@gmail.com> | 2021-01-21 14:46:20 +0100 |
commit | d3ae808742d56f298ef480ae54cc0c64af35a34e (patch) | |
tree | d30b345c07e0b723b2f40e33f7c401e8ed7a9f17 /test cases/fortran | |
parent | 2636eebd64221909157d93509ac72a5990f85060 (diff) | |
download | meson-d3ae808742d56f298ef480ae54cc0c64af35a34e.zip meson-d3ae808742d56f298ef480ae54cc0c64af35a34e.tar.gz meson-d3ae808742d56f298ef480ae54cc0c64af35a34e.tar.bz2 |
Add fortran test with an install:yes static library
This adds a test which makes use of an install:yes static library that
depends on another static library. This triggers a promotion to
link_whole_target inside meson which takes different code paths in
certain places.
Also makes use of .F90 source (capital F) to test for case
(in)sensitivity.
Diffstat (limited to 'test cases/fortran')
6 files changed, 74 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..c83a6a0 --- /dev/null +++ b/test cases/fortran/21 install static/main.f90 @@ -0,0 +1,4 @@ +use main_lib +implicit none +call main_hello() +end program
\ No newline at end of file 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..5f3cb45 --- /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..a91613f --- /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', default_options: ['default_library=static']) + +static_dep = dependency('static_hello', fallback: ['static_hello', 'static_hello_dep']) + +mainsrc = 'main_lib.f90' +mainsrc = configure_file( + command: [find_program('cp'), '@INPUT@', '@OUTPUT@'], + 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..7edca39 --- /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( + command: [find_program('cp'), '@INPUT@', '@OUTPUT@'], + 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..b31e91d --- /dev/null +++ b/test cases/fortran/21 install static/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"file": "usr/lib/libmainstatic.a", "type": "file"} + ] +}
\ No newline at end of file |