]>
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
, name
):
16 utils
.addSubstituteCallback('CFG', __noopSubst
)
17 utils
.addSubstituteCallback('LIBDIRNAME', __noopSubst
)
18 utils
.addSubstituteCallback('OBJS', __noopSubst
)
22 """Creates wxWindows library identifier from bakefile target ID that
23 follows this convention: DLLs end with 'dll', static libraries
24 end with 'lib'. If withPrefix=1, then _wxid is returned instead
26 if id.endswith('dll') or id.endswith('lib'):
33 # All libs that are part of the main library (i.e. non-contrib):
34 MAIN_LIBS
= ['mono', 'base', 'core', 'adv', 'html', 'xml', 'net',
36 # List of library names/ids for categories with different names:
37 LIBS_NOGUI
= ['xml', 'net', 'odbc']
38 LIBS_GUI
= ['core', 'adv', 'html', 'gl', 'dbgrid']
41 """Returns string that can be used as library name, including name
42 suffixes, prefixes, version tags etc. This must be kept in sync
43 with variables defined in common.bkl!"""
45 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
47 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)$(WXVERSIONTAG)$(HOST_SUFFIX)'
48 if wxid
in LIBS_NOGUI
:
49 return '$(WXNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
50 return '$(WXNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXVERSIONTAG)$(HOST_SUFFIX)' % wxid
53 """Returns string that can be used as DLL name, including name
54 suffixes, prefixes, version tags etc. This must be kept in sync
55 with variables defined in common.bkl!"""
57 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
59 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)'
60 if wxid
in LIBS_NOGUI
:
61 return '$(WXDLLNAMEPREFIX)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
62 return '$(WXDLLNAMEPREFIXGUI)$(WXNAMESUFFIX)_%s$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)' % wxid
65 def libToLink(wxlibname
):
66 """Returns string to pass to <sys-lib> when linking against 'wxlibname'.
67 For one of main libraries, libToLink('foo') returns '$(WXLIB_FOO)' which
68 must be defined in common.bkl as either nothing (in monolithic build) or
69 mkLibName('foo') (otherwise).
70 For contrib libraries, it returns mkDllName(wxlibname).
72 if wxlibname
in MAIN_LIBS
:
73 return '$(WXLIB_%s)' % wxlibname
.upper()
75 return mkLibName(wxlibname
)
79 VERSION_FILE
= '../../include/wx/version.h'
82 """Returns wxWindows version as a tuple: (major,minor,release)."""
85 f
= open(VERSION_FILE
, 'rt')
88 major
= minor
= release
= None
90 if not l
.startswith('#define'): continue
91 splitted
= l
.strip().split()
92 if splitted
[0] != '#define': continue
93 if len(splitted
) < 3: continue
96 if value
== None: continue
97 if name
== 'wxMAJOR_VERSION': major
= int(value
)
98 if name
== 'wxMINOR_VERSION': minor
= int(value
)
99 if name
== 'wxRELEASE_NUMBER': release
= int(value
)
100 if major
!= None and minor
!= None and release
!= None:
102 wxVersion
= (major
, minor
, release
)
105 def getVersionMajor():
106 return getVersion()[0]
107 def getVersionMinor():
108 return getVersion()[1]
109 def getVersionRelease():
110 return getVersion()[2]
113 def headersOnly(files
):
114 """Filters 'files' so that only headers are left. Used with
115 <msvc-project-files> to add headers to VC++ projects but not files such
118 def callback(cond
, sources
):
120 if sources
[0].isspace(): prefix
=' '
121 if sources
[-1].isspace(): suffix
=' '
123 for s
in sources
.split():
126 return '%s%s%s' % (prf
, ' '.join(retval
), suf
)
127 return utils
.substitute2(files
, callback
)
130 def makeDspDependency(lib
):
131 """Returns suitable entry for <depends-on-dsp> for main libs."""
142 if lib
in DEPS_TABLE
:
143 deps
= ':%s' % DEPS_TABLE
[lib
]
146 return '%s:$(nativePaths(WXTOPDIR))build\msw\wx_%s.dsp%s' % (lib
,lib
,deps
)