diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2023-07-13 10:26:14 -0700 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-10-09 17:33:48 -0400 |
| commit | 013536fcb45dc40c4f592f5c5821ee6d38d331ed (patch) | |
| tree | ee7cddf43778f63a5f102de1225ce62e1ff5f419 /test cases/common/3 static | |
| parent | e24f43051255d3978002f39d08149c3088cb67f9 (diff) | |
| download | meson-013536fcb45dc40c4f592f5c5821ee6d38d331ed.tar.gz | |
interpreter: add <lang>_(static|shared)_args
Which allow passing arguments specifically to the static or shared
libraries.
For design, this is all handled in the interpreter, by the build layer
the arguments are combined into the existing fields. This limits changes
required in the mid and backend layers
Diffstat (limited to 'test cases/common/3 static')
| -rw-r--r-- | test cases/common/3 static/lib3.c | 11 | ||||
| -rw-r--r-- | test cases/common/3 static/meson.build | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/test cases/common/3 static/lib3.c b/test cases/common/3 static/lib3.c new file mode 100644 index 000000000..f834cf8b8 --- /dev/null +++ b/test cases/common/3 static/lib3.c @@ -0,0 +1,11 @@ +int func3(const int x) { + return x + 1; +} + +#ifndef WORK +# error "did not get static only C args" +#endif + +#ifdef BREAK +# error "got shared only C args, but shouldn't have" +#endif diff --git a/test cases/common/3 static/meson.build b/test cases/common/3 static/meson.build index 04ff2f6f3..1127ecb44 100644 --- a/test cases/common/3 static/meson.build +++ b/test cases/common/3 static/meson.build @@ -1,4 +1,4 @@ -project('static library test', 'c') +project('static library test', 'c', default_options : ['default_library=static']) lib = static_library('mylib', get_option('source'), link_args : '-THISMUSTNOBEUSED') # Static linker needs to ignore all link args. @@ -12,3 +12,8 @@ endif assert(has_not_changed, 'Static library has changed.') assert(not is_disabler(lib), 'Static library is a disabler.') + +if get_option('default_library') == 'static' + library('lib2', 'lib3.c', c_static_args : ['-DWORK'], c_shared_args : ['-DBREAK']) +endif +build_target('lib4', 'lib3.c', c_static_args : ['-DWORK'], target_type : 'static_library') |
