Merge pull request #469 from RobinD42/fix-issue431

Set gtk3 to be the default port option on *nix builds
This commit is contained in:
Robin Dunn
2017-08-15 21:16:02 -07:00
committed by GitHub
6 changed files with 46 additions and 21 deletions

View File

@@ -10,18 +10,10 @@ matrix:
dist: trusty
sudo: required
python: 2.7
- os: linux
dist: precise
sudo: required
python: 2.7
- os: linux
dist: trusty
sudo: required
python: 3.4
- os: linux
dist: precise
sudo: required
python: 3.4
# redundant specification of `sudo` and `python` because of travis-ci.org's way of parsing `.travis.yml`
# Available build steps:
@@ -49,6 +41,9 @@ addons:
- freeglut3
- freeglut3-dev
- libnotify-dev
- libsm-dev
- libgtk-3-dev
- libwebkitgtk-3.0-dev
install:

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
@@ -487,7 +491,10 @@ class pushDir(object):
def getBuildDir(options):
BUILD_DIR = opj(phoenixDir(), 'build', 'wxbld')
if not isDarwin and not isWindows:
BUILD_DIR = opj(phoenixDir(), 'build', 'wxbld', 'gtk3' if options.gtk3 else 'gtk2')
else:
BUILD_DIR = opj(phoenixDir(), 'build', 'wxbld')
if options.build_dir:
BUILD_DIR = os.path.abspath(options.build_dir)
return BUILD_DIR
@@ -1248,6 +1255,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,8 +1404,13 @@ def cmd_build_py(options, args):
build_options.append('--jobs=%s' % options.jobs)
if options.relwithdebug:
build_options.append('--msvc_relwithdebug')
if options.gtk3:
build_options.append('--gtk3')
if not isDarwin and not isWindows:
if options.gtk2:
build_options.append('--gtk2')
wafBuildDir = posixjoin(wafBuildBase, 'gtk2')
if options.gtk3:
build_options.append('--gtk3')
wafBuildDir = posixjoin(wafBuildBase, 'gtk3')
build_options.append('--python="%s"' % PYTHON)
build_options.append('--out=%s' % wafBuildDir) # this needs to be the last option

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",

View File

@@ -50,7 +50,7 @@ class Configuration(object):
# wx-config command will be assembled based on version, port,
# etc. and it will be looked for on the default $PATH.
WXPORT = 'gtk2'
WXPORT = 'gtk3'
# On Linux/Unix there are several ports of wxWidgets available.
# Setting this value lets you select which will be used for the
# wxPython build. Possibilities are 'gtk', 'gtk2', 'gtk3' and 'x11'.
@@ -351,6 +351,8 @@ class Configuration(object):
def parseCmdLine(self):
self.debug = '--debug' in sys.argv or '-g' in sys.argv
if '--gtk2' in sys.argv:
self.WXPORT = 'gtk2'
if '--gtk3' in sys.argv:
self.WXPORT = 'gtk3'

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()