Get the C extensions all building on windows

This commit is contained in:
Kovid Goyal 2014-06-07 16:04:45 +05:30
parent 806e343ccd
commit 1a478dd15e
3 changed files with 12 additions and 7 deletions

View File

@ -86,7 +86,8 @@ pyqt = {x:readvar(y) for x, y in (
('inc', 'QT_INSTALL_HEADERS'), ('lib', 'QT_INSTALL_LIBS')
)}
c = sipconfig.Configuration()
pyqt['sip_bin'] = c.sip_bin
pyqt['sip_bin'] = c.sip_bin + ('.exe' if iswindows and not c.sip_bin.endswith('.exe') else '')
from PyQt5.QtCore import PYQT_CONFIGURATION
pyqt['sip_flags'] = PYQT_CONFIGURATION['sip_flags']
def get_sip_dir(q):
@ -137,7 +138,7 @@ if iswindows:
jpg_libs = ['jpeg']
ft_lib_dirs = [sw_lib_dir]
ft_libs = ['freetype']
ft_inc_dirs = [sw_inc_dir]
ft_inc_dirs = [os.path.join(sw_inc_dir, 'freetype2'), sw_inc_dir]
zlib_inc_dirs = [sw_inc_dir]
zlib_lib_dirs = [sw_lib_dir]
zlib_libs = ['zlib']

View File

@ -21,7 +21,7 @@ MT
isunix = islinux or isosx or isbsd
make = 'make' if isunix else NMAKE
py_lib_dir = os.path.join(sys.prefix, 'lib')
py_lib = os.path.join(sys.prefix, 'libs', 'python%d%d.lib' % sys.version_info[:2])
class Extension(object):
@ -579,14 +579,15 @@ class Build(Command):
INCLUDEPATH += {sipinc} {pyinc}
VERSION = {ver}
win32 {{
LIBS += {py_lib_dir}
LIBS += {py_lib}
TARGET_EXT = .dll
}}
macx {{
QMAKE_LFLAGS += "-undefined dynamic_lookup"
}}
''').format(
target=sip['target'], headers=' '.join(sip['headers'] + ext.headers), sources=' '.join(ext.sources + sip['sources']),
sipinc=pyqt['sip_inc_dir'], pyinc=sysconfig.get_python_inc(), py_lib_dir=py_lib_dir,
sipinc=pyqt['sip_inc_dir'], pyinc=sysconfig.get_python_inc(), py_lib=py_lib,
ver=__version__
)
for incdir in ext.inc_dirs:
@ -607,13 +608,16 @@ class Build(Command):
if iswindows:
qmc += ['-spec', 'win32-msvc2008']
fext = 'dll' if iswindows else 'dylib' if isosx else 'so'
name = '%s%s.%s' % ('' if iswindows else 'lib', sip['target'], fext)
name = '%s%s.%s' % ('release/' if iswindows else 'lib', sip['target'], fext)
try:
os.chdir(src_dir)
if self.newer(dest, sip['headers'] + sip['sources'] + ext.sources + ext.headers):
self.check_call([QMAKE] + qmc + [proname])
self.check_call([make]+([] if iswindows else ['-j%d'%(cpu_count() or 1)]))
shutil.copy2(os.path.realpath(name), dest)
if iswindows:
shutil.copy2(name + '.manifest', dest + '.manifest')
finally:
os.chdir(cwd)

View File

@ -102,7 +102,7 @@ class VMInstaller(Command):
BUILD_CMD = 'ssh -t %s bash build-calibre'
BUILD_PREFIX = ['#!/bin/bash', 'export CALIBRE_BUILDBOT=1']
BUILD_RSYNC = [r'cd ~/build/{project}', Rsync.SYNC_CMD]
BUILD_RSYNC = ['mkdir -p ~/build/{project}', r'cd ~/build/{project}', Rsync.SYNC_CMD]
BUILD_CLEAN = ['rm -rf dist/* build/* src/calibre/plugins/*']
BUILD_BUILD = ['python setup.py build',]
FORCE_SHUTDOWN = 0 # number of seconds to wait before doing a forced power off (0 means disabled)