]> git.saurik.com Git - wxWidgets.git/blame - build/bakefiles/wxwin.py
don't build _gl by default
[wxWidgets.git] / build / bakefiles / wxwin.py
CommitLineData
ddf98968
VS
1#
2# Helper functions for wxWindows bakefiles
3#
4# $Id$
5#
6
7
cff5df9f
VS
8import utils
9
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):
14def __noopSubst(func, opt):
15 return '$(%s)' % opt.name
16utils.addSubstituteCallback('CFG', __noopSubst)
17
18
ddf98968
VS
19def mk_wxid(id):
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
23 of wxid."""
24 if id.endswith('dll') or id.endswith('lib'):
25 wxid = id[:-3]
26 else:
27 wxid = id
28 return wxid
29
30
3560dc76
VS
31# All libs that are part of the main library (i.e. non-contrib):
32MAIN_LIBS = ['mono', 'base', 'core', 'html']
ddf98968 33# List of library names/ids for categories with different names:
e6978d5b
VS
34LIBS_NOGUI = ['']
35LIBS_GUI = ['core', 'html']
ddf98968
VS
36
37def mkLibName(wxid):
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!"""
41 if wxid == 'mono':
ea66c762 42 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
e6978d5b 43 if wxid == 'base':
ea66c762 44 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
e6978d5b 45 if wxid in LIBS_NOGUI:
ea66c762
VS
46 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
47 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
ddf98968
VS
48
49def mkDllName(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!"""
53 if wxid == 'mono':
4fc5f509 54 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
e6978d5b
VS
55 if wxid == 'base':
56 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
57 if wxid in LIBS_NOGUI:
4fc5f509
VS
58 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
59 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
ddf98968
VS
60
61
62def libToLink(wxlibname):
63 """Returns string to pass to <sys-lib> when linking against 'wxlibname'.
3560dc76
VS
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).
68 """
69 if wxlibname in MAIN_LIBS:
70 return '$(WXLIB_%s)' % wxlibname.upper()
71 else:
72 return mkLibName(wxlibname)
ddf98968
VS
73
74
75wxVersion = None
76VERSION_FILE = '../../include/wx/version.h'
77
78def getVersion():
79 """Returns wxWindows version as a tuple: (major,minor,release)."""
80 global wxVersion
81 if wxVersion == None:
82 f = open(VERSION_FILE, 'rt')
83 lines = f.readlines()
84 f.close()
85 major = minor = release = None
86 for l in lines:
87 if not l.startswith('#define'): continue
88 splitted = l.strip().split()
89 if splitted[0] != '#define': continue
90 if len(splitted) < 3: continue
91 name = splitted[1]
92 value = splitted[2]
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:
98 break
99 wxVersion = (major, minor, release)
100 return wxVersion
101
102def getVersionMajor():
103 return getVersion()[0]
104def getVersionMinor():
105 return getVersion()[1]
106def getVersionRelease():
107 return getVersion()[2]