Compiler internal libs should always be de-duplicated, no matter what. Closes https://github.com/mesonbuild/meson/issues/2150 Test case is by Bruce Richardson in the issue.pull/5085/head
parent
5f00c30200
commit
07818dac6a
12 changed files with 99 additions and 6 deletions
@ -0,0 +1,13 @@ |
||||
#include <stdio.h> |
||||
#include <liba.h> |
||||
#include <libb.h> |
||||
|
||||
int |
||||
main(void) |
||||
{ |
||||
printf("start value = %d\n", liba_get()); |
||||
liba_add(2); |
||||
libb_mul(5); |
||||
printf("end value = %d\n", liba_get()); |
||||
return 0; |
||||
} |
@ -0,0 +1,2 @@ |
||||
executable('app', 'app.c', |
||||
dependencies: [liba_dep, libb_dep]) |
@ -0,0 +1,18 @@ |
||||
#include "liba.h" |
||||
|
||||
static int val; |
||||
|
||||
void liba_add(int x) |
||||
{ |
||||
val += x; |
||||
} |
||||
|
||||
void liba_sub(int x) |
||||
{ |
||||
val -= x; |
||||
} |
||||
|
||||
int liba_get(void) |
||||
{ |
||||
return val; |
||||
} |
@ -0,0 +1,8 @@ |
||||
#ifndef LIBA_H_ |
||||
#define LIBA_H_ |
||||
|
||||
void liba_add(int x); |
||||
void liba_sub(int x); |
||||
int liba_get(void); |
||||
|
||||
#endif |
@ -0,0 +1,8 @@ |
||||
deps = [dependency('threads'), cc.find_library('dl'), cc.find_library('m')] |
||||
|
||||
liba = library('a', 'liba.c', |
||||
dependencies: deps) |
||||
|
||||
liba_dep = declare_dependency(link_with: liba, |
||||
include_directories: include_directories('.'), |
||||
dependencies: deps) |
@ -0,0 +1,7 @@ |
||||
#include <liba.h> |
||||
#include "libb.h" |
||||
|
||||
void libb_mul(int x) |
||||
{ |
||||
liba_add(liba_get() * (x - 1)); |
||||
} |
@ -0,0 +1,6 @@ |
||||
#ifndef _LIBB_H_ |
||||
#define _LIBB_H_ |
||||
|
||||
void libb_mul(int x); |
||||
|
||||
#endif |
@ -0,0 +1,6 @@ |
||||
libb = library('b', 'libb.c', |
||||
dependencies: liba_dep) |
||||
|
||||
libb_dep = declare_dependency(link_with: libb, |
||||
include_directories: include_directories('.'), |
||||
dependencies: liba_dep) |
@ -0,0 +1,7 @@ |
||||
project('temp', 'c') |
||||
|
||||
cc = meson.get_compiler('c') |
||||
|
||||
subdir('liba') |
||||
subdir('libb') |
||||
subdir('app') |
Loading…
Reference in new issue