mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
Use MSVCinfo in the waf script to help set up the compiler for the wxPython build
This commit is contained in:
4
build.py
4
build.py
@@ -1662,8 +1662,6 @@ def cmd_build_py(options, args):
|
|||||||
build_options.append('--msvc_arch=x86')
|
build_options.append('--msvc_arch=x86')
|
||||||
if not isWindows:
|
if not isWindows:
|
||||||
build_options.append('--wx_config=%s' % WX_CONFIG)
|
build_options.append('--wx_config=%s' % WX_CONFIG)
|
||||||
if options.verbose:
|
|
||||||
build_options.append('--verbose')
|
|
||||||
if options.jobs:
|
if options.jobs:
|
||||||
build_options.append('--jobs=%s' % options.jobs)
|
build_options.append('--jobs=%s' % options.jobs)
|
||||||
if options.relwithdebug:
|
if options.relwithdebug:
|
||||||
@@ -1714,7 +1712,7 @@ def cmd_build_py(options, args):
|
|||||||
wafBuildDir = posixjoin(wafBuildBase, 'release')
|
wafBuildDir = posixjoin(wafBuildBase, 'release')
|
||||||
build_options.append('--out=%s' % wafBuildDir)
|
build_options.append('--out=%s' % wafBuildDir)
|
||||||
cmd = '"%s" %s %s configure build %s' % (PYTHON, waf, ' '.join(build_options), options.extra_waf)
|
cmd = '"%s" %s %s configure build %s' % (PYTHON, waf, ' '.join(build_options), options.extra_waf)
|
||||||
runcmd(cmd)
|
runcmd(cmd, onError=_onWafError)
|
||||||
|
|
||||||
copyWxDlls(options)
|
copyWxDlls(options)
|
||||||
cmd_build_others(options, args)
|
cmd_build_others(options, args)
|
||||||
|
|||||||
39
wscript
39
wscript
@@ -16,7 +16,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from buildtools.backports.textwrap3 import indent
|
from buildtools.backports.textwrap3 import indent
|
||||||
|
|
||||||
from buildtools.config import Config, runcmd, msg
|
from buildtools.config import Config, runcmd, msg, getMSVCInfo
|
||||||
cfg = Config(True)
|
cfg = Config(True)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@@ -66,43 +66,28 @@ def options(opt):
|
|||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
if isWindows:
|
if isWindows:
|
||||||
# For now simply choose the compiler version based on the Python
|
# Set up the MSVC compiler info for wxPython's build
|
||||||
# version. We have a chicken-egg problem here. The compiler needs to
|
|
||||||
# be selected before the Python stuff can be configured, but we need
|
|
||||||
# Python to know what version of the compiler to use.
|
|
||||||
import distutils.msvc9compiler
|
|
||||||
msvc_version = str( distutils.msvc9compiler.get_build_version() )
|
|
||||||
|
|
||||||
# When building for Python 3.7 the msvc_version returned will be
|
PYTHON = conf.options.python if conf.options.python else sys.executable
|
||||||
# "14.1" as that is the version of the BasePlatformToolkit that stock
|
info = getMSVCInfo(PYTHON, conf.options.msvc_arch, set_env=True)
|
||||||
# Python 3.7 was built with, a.k.a v141, which is the default in
|
|
||||||
# Visual Studio 2017. However, waf is using "msvc 15.0" to designate
|
|
||||||
# that version rather than "14.1" so we'll need to catch that case and
|
|
||||||
# fix up the msvc_version accordingly.
|
|
||||||
if msvc_version in ["14.1", "14.2"] and sys.version_info >= (3,7):
|
|
||||||
##msvc_version = '15.0'
|
|
||||||
|
|
||||||
# On the other hand, microsoft says that v141 and v140 (Visual
|
# WAF uses the VisualStudio version to select the compiler, rather than
|
||||||
# Studio 2015) are binary compatible, so for now let's just drop
|
# the compiler version like we see elsewhere. Luckily we've got that
|
||||||
# it back to "14.0" until I get all the details worked out for
|
# value in the MSVC info.
|
||||||
# using VS 2017+ everywhere for Python 3.7+.
|
msvc_version = f"msvc {info.vs_ver}"
|
||||||
msvc_version = '14.0'
|
|
||||||
|
|
||||||
# In some cases (Azure DevOps at least) we're getting "14.1" for Python
|
conf.env['MSVC_VERSIONS'] = [msvc_version]
|
||||||
# 3.6 too. Smash it down to '14.0'
|
|
||||||
if msvc_version == "14.1" and sys.version_info[:2] == (3,6):
|
|
||||||
msvc_version = '14.0'
|
|
||||||
|
|
||||||
conf.env['MSVC_VERSIONS'] = ['msvc ' + msvc_version]
|
|
||||||
conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch]
|
conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch]
|
||||||
conf.load('msvc')
|
conf.load('msvc')
|
||||||
else:
|
else:
|
||||||
|
# Otherwise, use WAF's default setup for the C and C++ compiler
|
||||||
conf.load('compiler_c compiler_cxx')
|
conf.load('compiler_c compiler_cxx')
|
||||||
|
|
||||||
|
# Set up Python
|
||||||
if conf.options.python:
|
if conf.options.python:
|
||||||
conf.env.PYTHON = conf.options.python
|
conf.env.PYTHON = conf.options.python
|
||||||
conf.load('python')
|
conf.load('python')
|
||||||
conf.check_python_version(minver=(3,6,0))
|
conf.check_python_version(minver=(3,7,0))
|
||||||
if isWindows:
|
if isWindows:
|
||||||
# Search for the Python headers without doing some stuff that could
|
# Search for the Python headers without doing some stuff that could
|
||||||
# incorrectly fail on Windows. See my_check_python_headers below.
|
# incorrectly fail on Windows. See my_check_python_headers below.
|
||||||
|
|||||||
Reference in New Issue
Block a user