Open GoogleCodeExporter opened 9 years ago
Original comment by gli...@chromium.org
on 26 Feb 2014 at 3:26
I find it inconvenient that GYP by design intermixes two different types of a
dependency of a target on a static/shared library:
- target is an executable or a shared library, and it must be linked to that shared library
- target is a 'none' target, and it must be built only after the shared library dependency is built
The above example only needs the dependency to be added to executable and
shared_library targets, but that's impossible in GYP right now. That's why the
dependency is being added to every target which confuses the generator (I still
think there's a bug in the generator). We can introduce a 'link_dependency'
attribute for a static/shared library that doesn't allow 'none' targets to
depend on this target:
{
'target_name': 'malloc',
'type': 'shared_library',
'variables': {
'prune_self_dependency': 1,
'link_dependency': 1,
},
'sources': [ 'mymalloc.c' ],
},
A trivial patch supporting link_dependency in input.py lets me work around the
problem described in #0.
Original comment by gli...@chromium.org
on 27 Feb 2014 at 9:00
The above example is actually equal to the following one:
{
'targets': [
{
'target_name': 'main',
'type': 'none',
'dependencies': [ 'main_initial', 'malloc'],
},
{
'target_name': 'main_initial',
'type': 'executable',
'product_name': 'main',
'sources': [ 'main.c' ],
},
{
'target_name': 'malloc',
'type': 'shared_library',
'sources': [ 'mymalloc.c' ],
},
],
}
, which IIUC isn't valid GYP, because there's a target called 'main' and a
binary with the same name.
Thus this isn't a bug in the Ninja generator, and we just need some knob to
prevent GYP from generating invalid configs.
Original comment by gli...@chromium.org
on 4 Mar 2014 at 12:10
Mark has committed GYP r1860, which implements the link_dependency attribute.
Original comment by gli...@chromium.org
on 5 Mar 2014 at 11:06
Original issue reported on code.google.com by
gli...@chromium.org
on 26 Feb 2014 at 3:25Attachments: