Chromium Code Reviews| Index: pylib/gyp/generator/ninja.py |
| =================================================================== |
| --- pylib/gyp/generator/ninja.py (revision 1217) |
| +++ pylib/gyp/generator/ninja.py (working copy) |
| @@ -118,6 +118,9 @@ |
| self.actions_stamp = None |
| # Path to the output of the link step, if any. |
| self.binary = None |
| + # Path to the import library (output by the link step), if any. Used for |
| + # Windows DLLs. |
| + self.import_library = None |
| # Path to the file representing the completion of building the bundle, |
| # if any. |
| self.bundle = None |
| @@ -663,7 +666,7 @@ |
| def WriteLink(self, spec, config_name, config, link_deps): |
| - """Write out a link step. Returns the path to the output.""" |
| + """Write out a link step. Returns the path to the output(s).""" |
| command = { |
| 'executable': 'link', |
| @@ -685,7 +688,7 @@ |
| continue |
| linkable = target.Linkable() |
| if linkable: |
| - extra_link_deps.add(target.binary) |
| + extra_link_deps.add(target.import_library or target.binary) |
|
Evan Martin
2012/02/21 18:10:47
Would it make more sense for target.Linkable() to
Nico
2012/02/21 18:20:54
Why is this needed? It looks like the build step w
Evan Martin
2012/02/21 18:23:45
extra_link_deps are specifically the files that ne
Nico
2012/02/21 18:27:40
I see. Is it possible to make target.binary the im
|
| final_output = target.FinalOutput() |
| if not linkable or final_output != target.binary: |
| @@ -719,6 +722,11 @@ |
| if command in ('solink', 'solink_module'): |
| extra_bindings.append(('soname', os.path.split(output)[1])) |
| + if self.flavor == 'win': |
| + import_lib = output + '.lib' |
| + extra_bindings.append(('dll', output)) |
| + extra_bindings.append(('implib', import_lib)) |
| + output = [output, import_lib] |
| self.ninja.build(output, command, link_deps, |
| implicit=list(implicit_deps), |
| @@ -737,7 +745,11 @@ |
| variables=[('postbuilds', self.GetPostbuildCommand( |
| spec, self.target.binary, self.target.binary))]) |
| else: |
| - self.target.binary = self.WriteLink(spec, config_name, config, link_deps) |
| + output = self.WriteLink(spec, config_name, config, link_deps) |
| + if isinstance(output, list): |
| + self.target.binary, self.target.import_library = output |
|
Evan Martin
2012/02/21 18:10:47
This makes me feel a little funny. I wonder if it'
scottmg
2012/02/21 18:45:46
Yeah, that would be a little tidier.
But, I have
|
| + else: |
| + self.target.binary = output |
| return self.target.binary |
| def WriteMacBundle(self, spec, mac_bundle_depends): |
| @@ -903,6 +915,8 @@ |
| type_in_output_root = ['executable', 'loadable_module'] |
| if self.flavor == 'mac' and self.toolset == 'target': |
| type_in_output_root += ['shared_library', 'static_library'] |
| + elif self.flavor == 'win' and self.toolset == 'target': |
| + type_in_output_root += ['shared_library'] |
|
Nico
2012/02/21 18:20:54
Is there a test for this?
scottmg
2012/02/21 18:45:46
test/library/gyptest-shared.py
|
| if type in type_in_output_root: |
| return filename |
| @@ -1118,16 +1132,16 @@ |
| elif flavor == 'win': |
| master_ninja.rule( |
| 'alink', |
| - description='AR $out', |
| + description='LIB $out', |
| command='lib /nologo /OUT:$out $in') |
| master_ninja.rule( |
| 'solink', |
| - description='SOLINK $out', |
| - command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) |
| + description='LINK_DLL $dll', |
|
Evan Martin
2012/02/21 18:10:47
FWIW, the description is free text. So you can us
scottmg
2012/02/21 18:45:46
Done.
|
| + command=('$ld /nologo /IMPLIB:$implib /DLL $ldflags /OUT:$dll $in $libs')) |
| master_ninja.rule( |
| 'solink_module', |
| - description='SOLINK(module) $out', |
| - command=('$ld /nologo /DLL $ldflags /OUT:$out $in $libs')) |
| + description='LINK_DLL $dll', |
| + command=('$ld /nologo /IMPLIB:$implib /DLL $ldflags /OUT:$dll $in $libs')) |
| master_ninja.rule( |
| 'link', |
| description='LINK $out', |