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.pull/8226/head
parent
2636eebd64
commit
d3ae808742
6 changed files with 74 additions and 0 deletions
@ -0,0 +1,4 @@ |
||||
use main_lib |
||||
implicit none |
||||
call main_hello() |
||||
end program |
@ -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 |
@ -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) |
@ -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) |
@ -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 |
@ -0,0 +1,5 @@ |
||||
{ |
||||
"installed": [ |
||||
{"file": "usr/lib/libmainstatic.a", "type": "file"} |
||||
] |
||||
} |
Loading…
Reference in new issue