Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 10749020: Adds support for the library_dirs key, which appears in the documentation but was never actually im… (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: library_dirs Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import hashlib 6 import hashlib
7 import multiprocessing 7 import multiprocessing
8 import os.path 8 import os.path
9 import re 9 import re
10 import signal 10 import signal
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 761
762 include_dirs = config.get('include_dirs', []) 762 include_dirs = config.get('include_dirs', [])
763 if self.flavor == 'win': 763 if self.flavor == 'win':
764 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, 764 include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs,
765 config_name) 765 config_name)
766 env = self.GetSortedXcodeEnv() 766 env = self.GetSortedXcodeEnv()
767 self.WriteVariableList('includes', 767 self.WriteVariableList('includes',
768 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) 768 [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor)
769 for i in include_dirs]) 769 for i in include_dirs])
770 770
771 library_dirs = config.get('library_dirs', [])
772 if self.flavor == 'win':
773 library_dirs = [
774 self.msvs_settings.ConvertVSMacros(library_dir, config_name)
775 for library_dir in library_dirs]
776 self.WriteVariableList('libdirs',
777 [QuoteShellArgument('-LIBPATH:' + self.GypPathToNinja(l), self.flavor )
Mark Mentovai 2013/05/29 21:40:35 Watch the 80-column limit.
Dimi Shahbaz 2013/05/29 21:45:16 Done.
778 for l in library_dirs])
779 else:
780 self.WriteVariableList('libdirs',
781 [QuoteShellArgument('-L' + self.GypPathToNinja(l), self.flavor)
782 for l in library_dirs])
783
771 pch_commands = precompiled_header.GetPchBuildCommands() 784 pch_commands = precompiled_header.GetPchBuildCommands()
772 if self.flavor == 'mac': 785 if self.flavor == 'mac':
773 self.WriteVariableList('cflags_pch_c', 786 self.WriteVariableList('cflags_pch_c',
774 [precompiled_header.GetInclude('c')]) 787 [precompiled_header.GetInclude('c')])
775 self.WriteVariableList('cflags_pch_cc', 788 self.WriteVariableList('cflags_pch_cc',
776 [precompiled_header.GetInclude('cc')]) 789 [precompiled_header.GetInclude('cc')])
777 self.WriteVariableList('cflags_pch_objc', 790 self.WriteVariableList('cflags_pch_objc',
778 [precompiled_header.GetInclude('m')]) 791 [precompiled_header.GetInclude('m')])
779 self.WriteVariableList('cflags_pch_objcc', 792 self.WriteVariableList('cflags_pch_objcc',
780 [precompiled_header.GetInclude('mm')]) 793 [precompiled_header.GetInclude('mm')])
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 'extract_toc': 1589 'extract_toc':
1577 ('{ readelf -d ${lib} | grep SONAME ; ' 1590 ('{ readelf -d ${lib} | grep SONAME ; '
1578 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) 1591 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')})
1579 1592
1580 master_ninja.rule( 1593 master_ninja.rule(
1581 'solink', 1594 'solink',
1582 description='SOLINK $lib', 1595 description='SOLINK $lib',
1583 restat=True, 1596 restat=True,
1584 command=(mtime_preserving_solink_base % { 1597 command=(mtime_preserving_solink_base % {
1585 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' 1598 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive '
1586 '$libs'})) 1599 '$libdirs $libs'}))
1587 master_ninja.rule( 1600 master_ninja.rule(
1588 'solink_module', 1601 'solink_module',
1589 description='SOLINK(module) $lib', 1602 description='SOLINK(module) $lib',
1590 restat=True, 1603 restat=True,
1591 command=(mtime_preserving_solink_base % { 1604 command=(mtime_preserving_solink_base % {
1592 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group $libs'})) 1605 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group '
1606 '$libdirs $libs'}))
1593 master_ninja.rule( 1607 master_ninja.rule(
1594 'link', 1608 'link',
1595 description='LINK $out', 1609 description='LINK $out',
1596 command=('$ld $ldflags -o $out ' 1610 command=('$ld $ldflags -o $out '
1597 '-Wl,--start-group $in $solibs -Wl,--end-group $libs')) 1611 '-Wl,--start-group $in $solibs -Wl,--end-group $libdirs $libs'))
1598 elif flavor == 'win': 1612 elif flavor == 'win':
1599 master_ninja.rule( 1613 master_ninja.rule(
1600 'alink', 1614 'alink',
1601 description='LIB $out', 1615 description='LIB $out',
1602 command=('%s gyp-win-tool link-wrapper $arch ' 1616 command=('%s gyp-win-tool link-wrapper $arch '
1603 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' % 1617 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' %
1604 sys.executable), 1618 sys.executable),
1605 rspfile='$out.rsp', 1619 rspfile='$out.rsp',
1606 rspfile_content='$in_newline $libflags') 1620 rspfile_content='$in_newline $libflags')
1607 dlldesc = 'LINK(DLL) $dll' 1621 dlldesc = 'LINK(DLL) $dll'
1608 dllcmd = ('%s gyp-win-tool link-wrapper $arch ' 1622 dllcmd = ('%s gyp-win-tool link-wrapper $arch '
1609 '$ld /nologo $implibflag /DLL /OUT:$dll ' 1623 '$ld /nologo $implibflag /DLL /OUT:$dll '
1610 '/PDB:$dll.pdb @$dll.rsp' % sys.executable) 1624 '/PDB:$dll.pdb @$dll.rsp' % sys.executable)
1611 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' 1625 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch '
1612 'cmd /c if exist $dll.manifest del $dll.manifest' % 1626 'cmd /c if exist $dll.manifest del $dll.manifest' %
1613 sys.executable) 1627 sys.executable)
1614 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch ' 1628 dllcmd += (' && %s gyp-win-tool manifest-wrapper $arch '
1615 '$mt -nologo -manifest $manifests -out:$dll.manifest' % 1629 '$mt -nologo -manifest $manifests -out:$dll.manifest' %
1616 sys.executable) 1630 sys.executable)
1617 master_ninja.rule('solink', description=dlldesc, command=dllcmd, 1631 master_ninja.rule('solink', description=dlldesc, command=dllcmd,
1618 rspfile='$dll.rsp', 1632 rspfile='$dll.rsp',
1619 rspfile_content='$libs $in_newline $ldflags', 1633 rspfile_content='$libdirs $libs $in_newline $ldflags',
1620 restat=True) 1634 restat=True)
1621 master_ninja.rule('solink_module', description=dlldesc, command=dllcmd, 1635 master_ninja.rule('solink_module', description=dlldesc, command=dllcmd,
1622 rspfile='$dll.rsp', 1636 rspfile='$dll.rsp',
1623 rspfile_content='$libs $in_newline $ldflags', 1637 rspfile_content='$libdirs $libs $in_newline $ldflags',
1624 restat=True) 1638 restat=True)
1625 # Note that ldflags goes at the end so that it has the option of 1639 # Note that ldflags goes at the end so that it has the option of
1626 # overriding default settings earlier in the command line. 1640 # overriding default settings earlier in the command line.
1627 master_ninja.rule( 1641 master_ninja.rule(
1628 'link', 1642 'link',
1629 description='LINK $out', 1643 description='LINK $out',
1630 command=('%s gyp-win-tool link-wrapper $arch ' 1644 command=('%s gyp-win-tool link-wrapper $arch '
1631 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp && ' 1645 '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp && '
1632 '%s gyp-win-tool manifest-wrapper $arch ' 1646 '%s gyp-win-tool manifest-wrapper $arch '
1633 'cmd /c if exist $out.manifest del $out.manifest && ' 1647 'cmd /c if exist $out.manifest del $out.manifest && '
1634 '%s gyp-win-tool manifest-wrapper $arch ' 1648 '%s gyp-win-tool manifest-wrapper $arch '
1635 '$mt -nologo -manifest $manifests -out:$out.manifest' % 1649 '$mt -nologo -manifest $manifests -out:$out.manifest' %
1636 (sys.executable, sys.executable, sys.executable)), 1650 (sys.executable, sys.executable, sys.executable)),
1637 rspfile='$out.rsp', 1651 rspfile='$out.rsp',
1638 rspfile_content='$in_newline $libs $ldflags') 1652 rspfile_content='$in_newline $libdirs $libs $ldflags')
1639 else: 1653 else:
1640 master_ninja.rule( 1654 master_ninja.rule(
1641 'objc', 1655 'objc',
1642 description='OBJC $out', 1656 description='OBJC $out',
1643 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' 1657 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc '
1644 '$cflags_pch_objc -c $in -o $out'), 1658 '$cflags_pch_objc -c $in -o $out'),
1645 depfile='$out.d', 1659 depfile='$out.d',
1646 deps=deps) 1660 deps=deps)
1647 master_ninja.rule( 1661 master_ninja.rule(
1648 'objcxx', 1662 'objcxx',
(...skipping 30 matching lines...) Expand all
1679 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' 1693 '{ otool -l $lib | grep LC_ID_DYLIB -A 5; '
1680 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) 1694 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'})
1681 1695
1682 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass 1696 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
1683 # -bundle -single_module here (for osmesa.so). 1697 # -bundle -single_module here (for osmesa.so).
1684 master_ninja.rule( 1698 master_ninja.rule(
1685 'solink', 1699 'solink',
1686 description='SOLINK $lib, POSTBUILDS', 1700 description='SOLINK $lib, POSTBUILDS',
1687 restat=True, 1701 restat=True,
1688 command=(mtime_preserving_solink_base % { 1702 command=(mtime_preserving_solink_base % {
1689 'suffix': '$in $solibs $libs$postbuilds'})) 1703 'suffix': '$in $solibs $libdirs $libs$postbuilds'}))
1690 master_ninja.rule( 1704 master_ninja.rule(
1691 'solink_module', 1705 'solink_module',
1692 description='SOLINK(module) $lib, POSTBUILDS', 1706 description='SOLINK(module) $lib, POSTBUILDS',
1693 restat=True, 1707 restat=True,
1694 command=(mtime_preserving_solink_base % { 1708 command=(mtime_preserving_solink_base % {
1695 'suffix': '$in $solibs $libs$postbuilds'})) 1709 'suffix': '$in $solibs $libdirs $libs$postbuilds'}))
1696 1710
1697 master_ninja.rule( 1711 master_ninja.rule(
1698 'link', 1712 'link',
1699 description='LINK $out, POSTBUILDS', 1713 description='LINK $out, POSTBUILDS',
1700 command=('$ld $ldflags -o $out ' 1714 command=('$ld $ldflags -o $out '
1701 '$in $solibs $libs$postbuilds')) 1715 '$in $solibs $libdirs $libs$postbuilds'))
1702 master_ninja.rule( 1716 master_ninja.rule(
1703 'infoplist', 1717 'infoplist',
1704 description='INFOPLIST $out', 1718 description='INFOPLIST $out',
1705 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' 1719 command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && '
1706 'plutil -convert xml1 $out $out')) 1720 'plutil -convert xml1 $out $out'))
1707 master_ninja.rule( 1721 master_ninja.rule(
1708 'mac_tool', 1722 'mac_tool',
1709 description='MACTOOL $mactool_cmd $in', 1723 description='MACTOOL $mactool_cmd $in',
1710 command='$env ./gyp-mac-tool $mactool_cmd $in $out') 1724 command='$env ./gyp-mac-tool $mactool_cmd $in $out')
1711 master_ninja.rule( 1725 master_ninja.rule(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 arglists.append( 1850 arglists.append(
1837 (target_list, target_dicts, data, params, config_name)) 1851 (target_list, target_dicts, data, params, config_name))
1838 pool.map(CallGenerateOutputForConfig, arglists) 1852 pool.map(CallGenerateOutputForConfig, arglists)
1839 except KeyboardInterrupt, e: 1853 except KeyboardInterrupt, e:
1840 pool.terminate() 1854 pool.terminate()
1841 raise e 1855 raise e
1842 else: 1856 else:
1843 for config_name in config_names: 1857 for config_name in config_names:
1844 GenerateOutputForConfig(target_list, target_dicts, data, params, 1858 GenerateOutputForConfig(target_list, target_dicts, data, params,
1845 config_name) 1859 config_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698