]>
git.saurik.com Git - wxWidgets.git/blob - build/bakefiles/wxwin.py
2 # Helper functions for wxWindows bakefiles
10 # We use 'CFG' option in places where bakefile doesn't like it, so we must
11 # register a substitution function for it that provides additional knowledge
12 # about the option (in this case that it does not contain dir separators and
13 # so utils.nativePaths() doesn't have to do anything with it):
14 def __noopSubst(func
, opt
):
15 return '$(%s)' % opt
.name
16 utils
.addSubstituteCallback('CFG', __noopSubst
)
20 """Creates wxWindows library identifier from bakefile target ID that
21 follows this convention: DLLs end with 'dll', static libraries
22 end with 'lib'. If withPrefix=1, then _wxid is returned instead
24 if id.endswith('dll') or id.endswith('lib'):
31 # List of library names/ids for categories with different names:
33 LIBS_GUI
= ['core', 'html']
36 """Returns string that can be used as library name, including name
37 suffixes, prefixes, version tags etc. This must be kept in sync
38 with variables defined in common.bkl!"""
40 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXVERSIONTAG)'
42 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)' % wxid
43 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)' % wxid
46 """Returns string that can be used as DLL name, including name
47 suffixes, prefixes, version tags etc. This must be kept in sync
48 with variables defined in common.bkl!"""
50 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
52 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
53 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
56 def libToLink(wxlibname
):
57 """Returns string to pass to <sys-lib> when linking against 'wxlibname'.
58 libToLink('foo') returns '$(WXLIB_FOO)' which must be defined in
59 common.bkl as either nothing (in monolithic build) or mkLibName('foo')
61 return '$(WXLIB_%s)' % wxlibname
.upper()
65 VERSION_FILE
= '../../include/wx/version.h'
68 """Returns wxWindows version as a tuple: (major,minor,release)."""
71 f
= open(VERSION_FILE
, 'rt')
74 major
= minor
= release
= None
76 if not l
.startswith('#define'): continue
77 splitted
= l
.strip().split()
78 if splitted
[0] != '#define': continue
79 if len(splitted
) < 3: continue
82 if value
== None: continue
83 if name
== 'wxMAJOR_VERSION': major
= int(value
)
84 if name
== 'wxMINOR_VERSION': minor
= int(value
)
85 if name
== 'wxRELEASE_NUMBER': release
= int(value
)
86 if major
!= None and minor
!= None and release
!= None:
88 wxVersion
= (major
, minor
, release
)
91 def getVersionMajor():
92 return getVersion()[0]
93 def getVersionMinor():
94 return getVersion()[1]
95 def getVersionRelease():
96 return getVersion()[2]