]>
git.saurik.com Git - wxWidgets.git/blob - build/bakefiles/wxwin.py
78c0162b00d8652b462d285619cfd3770d9a13a2
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
, name
):
16 utils
.addSubstituteCallback('CFG', __noopSubst
)
17 utils
.addSubstituteCallback('LIBDIRNAME', __noopSubst
)
21 """Creates wxWindows library identifier from bakefile target ID that
22 follows this convention: DLLs end with 'dll', static libraries
23 end with 'lib'. If withPrefix=1, then _wxid is returned instead
25 if id.endswith('dll') or id.endswith('lib'):
32 # All libs that are part of the main library (i.e. non-contrib):
33 MAIN_LIBS
= ['mono', 'base', 'core', 'html', 'xml']
34 # List of library names/ids for categories with different names:
36 LIBS_GUI
= ['core', 'html', 'gl']
39 """Returns string that can be used as library name, including name
40 suffixes, prefixes, version tags etc. This must be kept in sync
41 with variables defined in common.bkl!"""
43 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
45 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
46 if wxid
in LIBS_NOGUI
:
47 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
48 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
51 """Returns string that can be used as DLL name, including name
52 suffixes, prefixes, version tags etc. This must be kept in sync
53 with variables defined in common.bkl!"""
55 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
57 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
58 if wxid
in LIBS_NOGUI
:
59 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
60 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
63 def libToLink(wxlibname
):
64 """Returns string to pass to <sys-lib> when linking against 'wxlibname'.
65 For one of main libraries, libToLink('foo') returns '$(WXLIB_FOO)' which
66 must be defined in common.bkl as either nothing (in monolithic build) or
67 mkLibName('foo') (otherwise).
68 For contrib libraries, it returns mkDllName(wxlibname).
70 if wxlibname
in MAIN_LIBS
:
71 return '$(WXLIB_%s)' % wxlibname
.upper()
73 return mkLibName(wxlibname
)
77 VERSION_FILE
= '../../include/wx/version.h'
80 """Returns wxWindows version as a tuple: (major,minor,release)."""
83 f
= open(VERSION_FILE
, 'rt')
86 major
= minor
= release
= None
88 if not l
.startswith('#define'): continue
89 splitted
= l
.strip().split()
90 if splitted
[0] != '#define': continue
91 if len(splitted
) < 3: continue
94 if value
== None: continue
95 if name
== 'wxMAJOR_VERSION': major
= int(value
)
96 if name
== 'wxMINOR_VERSION': minor
= int(value
)
97 if name
== 'wxRELEASE_NUMBER': release
= int(value
)
98 if major
!= None and minor
!= None and release
!= None:
100 wxVersion
= (major
, minor
, release
)
103 def getVersionMajor():
104 return getVersion()[0]
105 def getVersionMinor():
106 return getVersion()[1]
107 def getVersionRelease():
108 return getVersion()[2]
111 def headersOnly(files
):
112 """Filters 'files' so that only headers are left. Used with
113 <msvc-project-files> to add headers to VC++ projects but not files such
116 def callback(cond
, sources
):
118 if sources
[0].isspace(): prefix
=' '
119 if sources
[-1].isspace(): suffix
=' '
121 for s
in sources
.split():
124 return '%s%s%s' % (prf
, ' '.join(retval
), suf
)
125 return utils
.substitute2(files
, callback
)