The linkers currently do not support ninja compatible output of dependencies used while linking. Try to guess which files will be used while linking in python code and generate conservative dependencies to ensure changes in linked libraries are detected. This generates dependencies on the best match for static and shared linking, but this should not be a problem, except for spurious rebuilding when only one of them changes, which should not be a problem. Also makes sure to ignore any libraries generated inside the build, to keep the optimisation working where changes in a shared library only cause relink if the symbols have changed as well.pull/3414/head
parent
642e17aa6b
commit
aff597fb99
8 changed files with 174 additions and 4 deletions
@ -0,0 +1,6 @@ |
||||
void liba_func(); |
||||
|
||||
int main() { |
||||
liba_func(); |
||||
return 0; |
||||
} |
@ -0,0 +1,7 @@ |
||||
project('exe', ['c']) |
||||
|
||||
executable('app', |
||||
'app.c', |
||||
# Use uninterpreted strings to avoid path finding by dependency or compiler.find_library |
||||
link_args: ['-ltest-lib'] |
||||
) |
@ -0,0 +1,20 @@ |
||||
#if defined _WIN32 |
||||
#define DLL_PUBLIC __declspec(dllexport) |
||||
#else |
||||
#if defined __GNUC__ |
||||
#define DLL_PUBLIC __attribute__ ((visibility("default"))) |
||||
#else |
||||
#pragma message ("Compiler does not support symbol visibility.") |
||||
#define DLL_PUBLIC |
||||
#endif |
||||
#endif |
||||
|
||||
void DLL_PUBLIC liba_func() { |
||||
} |
||||
|
||||
#ifdef MORE_EXPORTS |
||||
|
||||
void DLL_PUBLIC libb_func() { |
||||
} |
||||
|
||||
#endif |
@ -0,0 +1,11 @@ |
||||
project('lib1', ['c']) |
||||
|
||||
c_args = [] |
||||
|
||||
# Microsoft's compiler is quite smart about touching import libs on changes, |
||||
# so ensure that there is actually a change in symbols. |
||||
if get_option('more_exports') |
||||
c_args += '-DMORE_EXPORTS' |
||||
endif |
||||
|
||||
a = library('test-lib', 'lib.c', c_args: c_args, install: true) |
@ -0,0 +1 @@ |
||||
option('more_exports', type : 'boolean', value : false) |
Loading…
Reference in new issue