mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get the C extensions all building on windows
This commit is contained in:
parent
806e343ccd
commit
1a478dd15e
@ -86,7 +86,8 @@ pyqt = {x:readvar(y) for x, y in (
|
|||||||
('inc', 'QT_INSTALL_HEADERS'), ('lib', 'QT_INSTALL_LIBS')
|
('inc', 'QT_INSTALL_HEADERS'), ('lib', 'QT_INSTALL_LIBS')
|
||||||
)}
|
)}
|
||||||
c = sipconfig.Configuration()
|
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
|
from PyQt5.QtCore import PYQT_CONFIGURATION
|
||||||
pyqt['sip_flags'] = PYQT_CONFIGURATION['sip_flags']
|
pyqt['sip_flags'] = PYQT_CONFIGURATION['sip_flags']
|
||||||
def get_sip_dir(q):
|
def get_sip_dir(q):
|
||||||
@ -137,7 +138,7 @@ if iswindows:
|
|||||||
jpg_libs = ['jpeg']
|
jpg_libs = ['jpeg']
|
||||||
ft_lib_dirs = [sw_lib_dir]
|
ft_lib_dirs = [sw_lib_dir]
|
||||||
ft_libs = ['freetype']
|
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_inc_dirs = [sw_inc_dir]
|
||||||
zlib_lib_dirs = [sw_lib_dir]
|
zlib_lib_dirs = [sw_lib_dir]
|
||||||
zlib_libs = ['zlib']
|
zlib_libs = ['zlib']
|
||||||
|
@ -21,7 +21,7 @@ MT
|
|||||||
isunix = islinux or isosx or isbsd
|
isunix = islinux or isosx or isbsd
|
||||||
|
|
||||||
make = 'make' if isunix else NMAKE
|
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):
|
class Extension(object):
|
||||||
|
|
||||||
@ -579,14 +579,15 @@ class Build(Command):
|
|||||||
INCLUDEPATH += {sipinc} {pyinc}
|
INCLUDEPATH += {sipinc} {pyinc}
|
||||||
VERSION = {ver}
|
VERSION = {ver}
|
||||||
win32 {{
|
win32 {{
|
||||||
LIBS += {py_lib_dir}
|
LIBS += {py_lib}
|
||||||
|
TARGET_EXT = .dll
|
||||||
}}
|
}}
|
||||||
macx {{
|
macx {{
|
||||||
QMAKE_LFLAGS += "-undefined dynamic_lookup"
|
QMAKE_LFLAGS += "-undefined dynamic_lookup"
|
||||||
}}
|
}}
|
||||||
''').format(
|
''').format(
|
||||||
target=sip['target'], headers=' '.join(sip['headers'] + ext.headers), sources=' '.join(ext.sources + sip['sources']),
|
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__
|
ver=__version__
|
||||||
)
|
)
|
||||||
for incdir in ext.inc_dirs:
|
for incdir in ext.inc_dirs:
|
||||||
@ -607,13 +608,16 @@ class Build(Command):
|
|||||||
if iswindows:
|
if iswindows:
|
||||||
qmc += ['-spec', 'win32-msvc2008']
|
qmc += ['-spec', 'win32-msvc2008']
|
||||||
fext = 'dll' if iswindows else 'dylib' if isosx else 'so'
|
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:
|
try:
|
||||||
os.chdir(src_dir)
|
os.chdir(src_dir)
|
||||||
if self.newer(dest, sip['headers'] + sip['sources'] + ext.sources + ext.headers):
|
if self.newer(dest, sip['headers'] + sip['sources'] + ext.sources + ext.headers):
|
||||||
self.check_call([QMAKE] + qmc + [proname])
|
self.check_call([QMAKE] + qmc + [proname])
|
||||||
self.check_call([make]+([] if iswindows else ['-j%d'%(cpu_count() or 1)]))
|
self.check_call([make]+([] if iswindows else ['-j%d'%(cpu_count() or 1)]))
|
||||||
shutil.copy2(os.path.realpath(name), dest)
|
shutil.copy2(os.path.realpath(name), dest)
|
||||||
|
if iswindows:
|
||||||
|
shutil.copy2(name + '.manifest', dest + '.manifest')
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class VMInstaller(Command):
|
|||||||
|
|
||||||
BUILD_CMD = 'ssh -t %s bash build-calibre'
|
BUILD_CMD = 'ssh -t %s bash build-calibre'
|
||||||
BUILD_PREFIX = ['#!/bin/bash', 'export CALIBRE_BUILDBOT=1']
|
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_CLEAN = ['rm -rf dist/* build/* src/calibre/plugins/*']
|
||||||
BUILD_BUILD = ['python setup.py build',]
|
BUILD_BUILD = ['python setup.py build',]
|
||||||
FORCE_SHUTDOWN = 0 # number of seconds to wait before doing a forced power off (0 means disabled)
|
FORCE_SHUTDOWN = 0 # number of seconds to wait before doing a forced power off (0 means disabled)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user