Add --gtk2 option.

Default to building for gtk3.
Keep --gtk3 flag for compatibility.
This commit is contained in:
Robin Dunn
2017-08-14 15:31:17 -07:00
parent 845617119c
commit 34630a5707
4 changed files with 31 additions and 9 deletions

View File

@@ -392,7 +392,8 @@ def makeOptionParser():
("relwithdebug", (False, "Turn on the generation of debug info for release builds on MSW.")),
("release", (False, "Turn off some development options for a release build.")),
("keep_hash_lines",(False, "Don't remove the '#line N' lines from the SIP generated code")),
("gtk3", (False, "On Linux build for gtk3 (default gtk2)")),
("gtk2", (False, "On Linux build for gtk2 (default gtk3)")),
("gtk3", (True, "On Linux build for gtk3")),
("osx_cocoa", (True, "Build the OSX Cocoa port on Mac (default)")),
("osx_carbon", (False, "Build the OSX Carbon port on Mac (unsupported)")),
("mac_framework", (False, "Build wxWidgets as a Mac framework.")),
@@ -473,6 +474,9 @@ def parseArgs(args):
if os.path.exists('REV.txt'):
os.unlink('REV.txt')
if options.gtk2:
options.gtk3 = False
return options, args
@@ -1248,6 +1252,8 @@ def cmd_build_wx(options, args):
if options.extra_make:
build_options.append('--extra_make="%s"' % options.extra_make)
if options.gtk2:
build_options.append('--gtk2')
if options.gtk3:
build_options.append('--gtk3')
@@ -1395,6 +1401,8 @@ def cmd_build_py(options, args):
build_options.append('--jobs=%s' % options.jobs)
if options.relwithdebug:
build_options.append('--msvc_relwithdebug')
if options.gtk2:
build_options.append('--gtk2')
if options.gtk3:
build_options.append('--gtk3')

View File

@@ -274,6 +274,8 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'):
else:
# Build both architectures for the distribution builders
cmd += ' --mac_arch=i386,x86_64'
if port == 'gtk2':
cmd += ' --gtk2'
if port == 'gtk3':
cmd += ' --gtk3'
if port in ['win32', 'win64']:
@@ -334,11 +336,11 @@ c['builders'] = [
BuilderConfig(name="build-gtk-py27",
slavenames=["ubuntu-x64_86-py27"],
factory=makeFactory('gtk')),
factory=makeFactory('gtk2')),
BuilderConfig(name="build-gtk-py35",
slavenames=["ubuntu-x64_86-py27"],
factory=makeFactory('gtk', pyVer='3.5')),
factory=makeFactory('gtk2', pyVer='3.5')),
BuilderConfig(name="build-gtk3-py27",
slavenames=["ubuntu-x64_86-py27"],

View File

@@ -205,7 +205,8 @@ def main(wxDir, args):
"jobs" : (defJobs, "Number of jobs to run at one time in make. Default: %s" % defJobs),
"install" : (False, "Install the toolkit to the installdir directory, or the default dir."),
"installdir" : ("", "Directory where built wxWidgets will be installed"),
"gtk3" : (False, "On Linux build for gtk3 (default gtk2)"),
"gtk2" : (False, "On Linux build for gtk2 (default gtk3"),
"gtk3" : (True, "On Linux build for gtk3"),
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
"mac_universal_binary"
: ("", "Comma separated list of architectures to include in the Mac universal binary"),
@@ -268,9 +269,15 @@ def main(wxDir, args):
elif options.osx_carbon:
configure_opts.append("--with-osx_carbon")
if options.gtk2:
options.gtk3 = False
if options.gtk3:
configure_opts.append("--with-gtk=3")
if options.gtk2:
configure_opts.append("--with-gtk=2")
wxpy_configure_opts = [
"--with-opengl",
"--enable-sound",

15
wscript
View File

@@ -46,8 +46,10 @@ def options(opt):
help='One or more comma separated architecture names to be used for '
'the Mac builds. Should be at least a subset of the architectures '
'used by wxWidgets and Python')
opt.add_option('--gtk3', dest='gtk3', action='store_true', default=False,
help='On Linux build for gtk3 (default gtk2)')
opt.add_option('--gtk2', dest='gtk2', action='store_true', default=False,
help='On Linux build for gtk2 (default gtk3)')
opt.add_option('--gtk3', dest='gtk3', action='store_true', default=True,
help='On Linux build for gtk3')
opt.add_option('--msvc_arch', dest='msvc_arch', default='x86', action='store',
help='The architecture to target for MSVC builds. Supported values '
'are: "x86" or "x64"')
@@ -251,10 +253,13 @@ def configure(conf):
# wxWidgets. If we ever support other ports then this code will need
# to be adjusted.
if not isDarwin:
if conf.options.gtk3:
gtkflags = os.popen('pkg-config gtk+-3.0 --cflags', 'r').read()[:-1]
else:
if conf.options.gtk2:
conf.options.gtk3 = False
if conf.options.gtk2:
gtkflags = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
else:
gtkflags = os.popen('pkg-config gtk+-3.0 --cflags', 'r').read()[:-1]
conf.env.CFLAGS_WX += gtkflags.split()
conf.env.CXXFLAGS_WX += gtkflags.split()