]>
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 # All libs that are part of the main library (i.e. non-contrib):
32 MAIN_LIBS
= ['mono', 'base', 'core', 'html']
33 # List of library names/ids for categories with different names:
35 LIBS_GUI
= ['core', 'html']
38 """Returns string that can be used as library name, including name
39 suffixes, prefixes, version tags etc. This must be kept in sync
40 with variables defined in common.bkl!"""
42 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXVERSIONTAG)'
44 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)$(WXVERSIONTAG)'
45 if wxid
in LIBS_NOGUI
:
46 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)' % wxid
47 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)' % wxid
50 """Returns string that can be used as DLL name, including name
51 suffixes, prefixes, version tags etc. This must be kept in sync
52 with variables defined in common.bkl!"""
54 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
56 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
57 if wxid
in LIBS_NOGUI
:
58 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
59 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
62 def libToLink(wxlibname
):
63 """Returns string to pass to <sys-lib> when linking against 'wxlibname'.
64 For one of main libraries, libToLink('foo') returns '$(WXLIB_FOO)' which
65 must be defined in common.bkl as either nothing (in monolithic build) or
66 mkLibName('foo') (otherwise).
67 For contrib libraries, it returns mkDllName(wxlibname).
69 if wxlibname
in MAIN_LIBS
:
70 return '$(WXLIB_%s)' % wxlibname
.upper()
72 return mkLibName(wxlibname
)
76 VERSION_FILE
= '../../include/wx/version.h'
79 """Returns wxWindows version as a tuple: (major,minor,release)."""
82 f
= open(VERSION_FILE
, 'rt')
85 major
= minor
= release
= None
87 if not l
.startswith('#define'): continue
88 splitted
= l
.strip().split()
89 if splitted
[0] != '#define': continue
90 if len(splitted
) < 3: continue
93 if value
== None: continue
94 if name
== 'wxMAJOR_VERSION': major
= int(value
)
95 if name
== 'wxMINOR_VERSION': minor
= int(value
)
96 if name
== 'wxRELEASE_NUMBER': release
= int(value
)
97 if major
!= None and minor
!= None and release
!= None:
99 wxVersion
= (major
, minor
, release
)
102 def getVersionMajor():
103 return getVersion()[0]
104 def getVersionMinor():
105 return getVersion()[1]
106 def getVersionRelease():
107 return getVersion()[2]