Fix combining C and Fortran. Closes #8377.
This commit is contained in:
parent
79f7328d6a
commit
72865a2773
|
@ -2513,15 +2513,18 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
|
|||
element.add_item('DEPFILE', dep_file)
|
||||
element.add_item('ARGS', commands)
|
||||
|
||||
self.add_dependency_scanner_entries_to_element(target, compiler, element)
|
||||
self.add_dependency_scanner_entries_to_element(target, compiler, element, src)
|
||||
self.add_build(element)
|
||||
assert(isinstance(rel_obj, str))
|
||||
assert(isinstance(rel_src, str))
|
||||
return (rel_obj, rel_src.replace('\\', '/'))
|
||||
|
||||
def add_dependency_scanner_entries_to_element(self, target, compiler, element):
|
||||
def add_dependency_scanner_entries_to_element(self, target, compiler, element, src):
|
||||
if not self.should_use_dyndeps_for_target(target):
|
||||
return
|
||||
extension = os.path.splitext(src.fname)[1][1:]
|
||||
if not (extension in compilers.lang_suffixes['fortran'] or extension in compilers.lang_suffixes['cpp']):
|
||||
return
|
||||
dep_scan_file = self.get_dep_scan_file_for(target)
|
||||
element.add_item('dyndep', dep_scan_file)
|
||||
element.add_orderdep(dep_scan_file)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
double fortran(void);
|
||||
|
||||
int main(void) {
|
||||
printf("FORTRAN gave us this number: %lf.\n", fortran());
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
project('C++ and FORTRAN', 'cpp', 'fortran')
|
||||
project('C, C++ and Fortran', 'c', 'cpp', 'fortran')
|
||||
|
||||
cpp = meson.get_compiler('cpp')
|
||||
fc = meson.get_compiler('fortran')
|
||||
|
@ -17,9 +17,17 @@ if fc.get_id() == 'intel'
|
|||
endif
|
||||
|
||||
e = executable(
|
||||
'cfort',
|
||||
['main.c', 'fortran.f'],
|
||||
dependencies : link_with,
|
||||
)
|
||||
|
||||
test('C and Fortran', e)
|
||||
|
||||
e2 = executable(
|
||||
'cppfort',
|
||||
['main.cpp', 'fortran.f'],
|
||||
dependencies : link_with,
|
||||
)
|
||||
|
||||
test('C++ FORTRAN', e)
|
||||
test('C++ and Fortran', e2)
|
||||
|
|
Loading…
Reference in New Issue