mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Building of calibre extension modules with VS 2015
This commit is contained in:
parent
607268dee1
commit
dc52214b2b
@ -26,7 +26,6 @@ if iswindows:
|
|||||||
if 'SDK' in p:
|
if 'SDK' in p:
|
||||||
MT = os.path.join(os.path.dirname(p), 'bin', 'mt.exe')
|
MT = os.path.join(os.path.dirname(p), 'bin', 'mt.exe')
|
||||||
MT = os.path.join(SDK, 'Bin', 'mt.exe')
|
MT = os.path.join(SDK, 'Bin', 'mt.exe')
|
||||||
os.environ['QMAKESPEC'] = os.environ.get('QMAKESPEC', 'win32-msvc2008')
|
|
||||||
|
|
||||||
QMAKE = 'qmake'
|
QMAKE = 'qmake'
|
||||||
for x in ('qmake-qt5', 'qt5-qmake', 'qmake'):
|
for x in ('qmake-qt5', 'qt5-qmake', 'qmake'):
|
||||||
@ -85,13 +84,14 @@ def consolidate(envvar, default):
|
|||||||
|
|
||||||
qraw = subprocess.check_output([QMAKE, '-query']).decode('utf-8')
|
qraw = subprocess.check_output([QMAKE, '-query']).decode('utf-8')
|
||||||
def readvar(name):
|
def readvar(name):
|
||||||
return re.search('%s:(.+)$' % name, qraw, flags=re.M).group(1).strip()
|
return re.search('^%s:(.+)$' % name, qraw, flags=re.M).group(1).strip()
|
||||||
|
|
||||||
|
|
||||||
pyqt = {x:readvar(y) for x, y in (
|
pyqt = {x:readvar(y) for x, y in (
|
||||||
('inc', 'QT_INSTALL_HEADERS'), ('lib', 'QT_INSTALL_LIBS')
|
('inc', 'QT_INSTALL_HEADERS'), ('lib', 'QT_INSTALL_LIBS')
|
||||||
)}
|
)}
|
||||||
qt = {x:readvar(y) for x, y in {'libs':'QT_INSTALL_LIBS', 'plugins':'QT_INSTALL_PLUGINS'}.iteritems()}
|
qt = {x:readvar(y) for x, y in {'libs':'QT_INSTALL_LIBS', 'plugins':'QT_INSTALL_PLUGINS'}.iteritems()}
|
||||||
|
qmakespec = readvar('QMAKE_SPEC') if iswindows else None
|
||||||
|
|
||||||
pyqt['sip_bin'] = os.environ.get('SIP_BIN', 'sip')
|
pyqt['sip_bin'] = os.environ.get('SIP_BIN', 'sip')
|
||||||
|
|
||||||
@ -173,8 +173,11 @@ if iswindows:
|
|||||||
zlib_libs = ['zlib']
|
zlib_libs = ['zlib']
|
||||||
|
|
||||||
md = glob.glob(os.path.join(prefix, 'build', 'ImageMagick-*'))[-1]
|
md = glob.glob(os.path.join(prefix, 'build', 'ImageMagick-*'))[-1]
|
||||||
|
if os.path.exists(os.path.join(md, 'ImageMagick/wand/MagickWand.h')):
|
||||||
|
magick_inc_dirs = [os.path.join(md, 'ImageMagick')]
|
||||||
|
else:
|
||||||
magick_inc_dirs = [md]
|
magick_inc_dirs = [md]
|
||||||
magick_lib_dirs = [os.path.join(magick_inc_dirs[0], 'VisualMagick', 'lib')]
|
magick_lib_dirs = [os.path.join(md, 'VisualMagick', 'lib')]
|
||||||
magick_libs = ['CORE_RL_wand_', 'CORE_RL_magick_']
|
magick_libs = ['CORE_RL_wand_', 'CORE_RL_magick_']
|
||||||
podofo_inc = os.path.join(sw_inc_dir, 'podofo')
|
podofo_inc = os.path.join(sw_inc_dir, 'podofo')
|
||||||
podofo_lib = sw_lib_dir
|
podofo_lib = sw_lib_dir
|
||||||
|
@ -15,7 +15,8 @@ from setup.build_environment import (
|
|||||||
msvc, win_inc, win_lib, magick_inc_dirs, magick_lib_dirs, magick_libs,
|
msvc, win_inc, win_lib, magick_inc_dirs, magick_lib_dirs, magick_libs,
|
||||||
chmlib_lib_dirs, sqlite_inc_dirs, icu_inc_dirs, icu_lib_dirs, ft_libs,
|
chmlib_lib_dirs, sqlite_inc_dirs, icu_inc_dirs, icu_lib_dirs, ft_libs,
|
||||||
ft_lib_dirs, ft_inc_dirs, cpu_count, is64bit, glib_flags, fontconfig_flags,
|
ft_lib_dirs, ft_inc_dirs, cpu_count, is64bit, glib_flags, fontconfig_flags,
|
||||||
openssl_inc_dirs, openssl_lib_dirs, zlib_inc_dirs, zlib_lib_dirs, zlib_libs)
|
openssl_inc_dirs, openssl_lib_dirs, zlib_inc_dirs, zlib_lib_dirs, zlib_libs,
|
||||||
|
qmakespec)
|
||||||
from setup.parallel_build import create_job, parallel_build
|
from setup.parallel_build import create_job, parallel_build
|
||||||
isunix = islinux or isosx or isbsd
|
isunix = islinux or isosx or isbsd
|
||||||
|
|
||||||
@ -633,7 +634,7 @@ class Build(Command):
|
|||||||
cwd = os.getcwdu()
|
cwd = os.getcwdu()
|
||||||
qmc = []
|
qmc = []
|
||||||
if iswindows:
|
if iswindows:
|
||||||
qmc += ['-spec', 'win32-msvc2008']
|
qmc += ['-spec', qmakespec]
|
||||||
fext = 'dll' if iswindows else 'dylib' if isosx else 'so'
|
fext = 'dll' if iswindows else 'dylib' if isosx else 'so'
|
||||||
name = '%s%s.%s' % ('release/' if iswindows else 'lib', sip['target'], fext)
|
name = '%s%s.%s' % ('release/' if iswindows else 'lib', sip['target'], fext)
|
||||||
try:
|
try:
|
||||||
@ -642,7 +643,7 @@ class Build(Command):
|
|||||||
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:
|
if iswindows and os.path.exists(name + '.manifest'):
|
||||||
shutil.copy2(name + '.manifest', dest + '.manifest')
|
shutil.copy2(name + '.manifest', dest + '.manifest')
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user