mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enable building of extensions that need the DDK on windows
This commit is contained in:
parent
a6635dfb55
commit
487588bb75
@ -17,7 +17,7 @@ OSX_SDK = '/Developer/SDKs/MacOSX10.4u.sdk'
|
|||||||
|
|
||||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
|
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
|
||||||
|
|
||||||
NMAKE = RC = msvc = MT = win_inc = win_lib = None
|
NMAKE = RC = msvc = MT = win_inc = win_lib = win_ddk = None
|
||||||
if iswindows:
|
if iswindows:
|
||||||
from distutils import msvc9compiler
|
from distutils import msvc9compiler
|
||||||
msvc = msvc9compiler.MSVCCompiler()
|
msvc = msvc9compiler.MSVCCompiler()
|
||||||
@ -25,6 +25,8 @@ if iswindows:
|
|||||||
NMAKE = msvc.find_exe('nmake.exe')
|
NMAKE = msvc.find_exe('nmake.exe')
|
||||||
RC = msvc.find_exe('rc.exe')
|
RC = msvc.find_exe('rc.exe')
|
||||||
SDK = os.environ.get('WINSDK', r'C:\Program Files\Microsoft SDKs\Windows\v6.0A')
|
SDK = os.environ.get('WINSDK', r'C:\Program Files\Microsoft SDKs\Windows\v6.0A')
|
||||||
|
DDK = os.environ.get('WINDDK', r'Q:\WinDDK\7600.16385.0')
|
||||||
|
win_ddk = [DDK+'\\inc\\'+x for x in ('api',)]
|
||||||
win_inc = os.environ['include'].split(';')
|
win_inc = os.environ['include'].split(';')
|
||||||
win_lib = os.environ['lib'].split(';')
|
win_lib = os.environ['lib'].split(';')
|
||||||
for p in win_inc:
|
for p in win_inc:
|
||||||
|
@ -15,7 +15,7 @@ from setup import Command, islinux, isosx, SRC, iswindows
|
|||||||
from setup.build_environment import fc_inc, fc_lib, \
|
from setup.build_environment import fc_inc, fc_lib, \
|
||||||
fc_error, poppler_libs, poppler_lib_dirs, poppler_inc_dirs, podofo_inc, \
|
fc_error, poppler_libs, poppler_lib_dirs, poppler_inc_dirs, podofo_inc, \
|
||||||
podofo_lib, podofo_error, poppler_error, pyqt, OSX_SDK, NMAKE, \
|
podofo_lib, podofo_error, poppler_error, pyqt, OSX_SDK, NMAKE, \
|
||||||
QMAKE, msvc, MT, win_inc, win_lib, png_inc_dirs, \
|
QMAKE, msvc, MT, win_inc, win_lib, png_inc_dirs, win_ddk, \
|
||||||
magick_inc_dirs, magick_lib_dirs, png_lib_dirs, png_libs, \
|
magick_inc_dirs, magick_lib_dirs, png_lib_dirs, png_libs, \
|
||||||
magick_error, magick_libs, ft_lib_dirs, ft_libs, jpg_libs, jpg_lib_dirs
|
magick_error, magick_libs, ft_lib_dirs, ft_libs, jpg_libs, jpg_lib_dirs
|
||||||
MT
|
MT
|
||||||
@ -45,6 +45,7 @@ class Extension(object):
|
|||||||
self.cflags = kwargs.get('cflags', [])
|
self.cflags = kwargs.get('cflags', [])
|
||||||
self.ldflags = kwargs.get('ldflags', [])
|
self.ldflags = kwargs.get('ldflags', [])
|
||||||
self.optional = kwargs.get('optional', False)
|
self.optional = kwargs.get('optional', False)
|
||||||
|
self.needs_ddk = kwargs.get('needs_ddk', False)
|
||||||
|
|
||||||
reflow_sources = glob.glob(os.path.join(SRC, 'calibre', 'ebooks', 'pdf', '*.cpp'))
|
reflow_sources = glob.glob(os.path.join(SRC, 'calibre', 'ebooks', 'pdf', '*.cpp'))
|
||||||
reflow_headers = glob.glob(os.path.join(SRC, 'calibre', 'ebooks', 'pdf', '*.h'))
|
reflow_headers = glob.glob(os.path.join(SRC, 'calibre', 'ebooks', 'pdf', '*.h'))
|
||||||
@ -126,11 +127,9 @@ if iswindows:
|
|||||||
extensions.append(Extension('winutil',
|
extensions.append(Extension('winutil',
|
||||||
['calibre/utils/windows/winutil.c'],
|
['calibre/utils/windows/winutil.c'],
|
||||||
libraries=['shell32', 'setupapi'],
|
libraries=['shell32', 'setupapi'],
|
||||||
include_dirs=os.environ.get('INCLUDE',
|
|
||||||
'C:/WinDDK/6001.18001/inc/api/;'
|
|
||||||
'C:/WinDDK/6001.18001/inc/crt/').split(';'),
|
|
||||||
cflags=['/X']
|
cflags=['/X']
|
||||||
))
|
))
|
||||||
|
|
||||||
if isosx:
|
if isosx:
|
||||||
extensions.append(Extension('usbobserver',
|
extensions.append(Extension('usbobserver',
|
||||||
['calibre/devices/usbobserver/usbobserver.c'],
|
['calibre/devices/usbobserver/usbobserver.c'],
|
||||||
@ -264,6 +263,10 @@ class Build(Command):
|
|||||||
objects = []
|
objects = []
|
||||||
einc = self.inc_dirs_to_cflags(ext.inc_dirs)
|
einc = self.inc_dirs_to_cflags(ext.inc_dirs)
|
||||||
obj_dir = self.j(self.obj_dir, ext.name)
|
obj_dir = self.j(self.obj_dir, ext.name)
|
||||||
|
ddk_flags = ['-I'+x for x in win_ddk]
|
||||||
|
if ext.needs_ddk:
|
||||||
|
i = [i for i in range(len(cflags)) if 'VC\\INCLUDE' in cflags[i]][0]
|
||||||
|
cflags[i+1:i+2] = ddk_flags
|
||||||
if not os.path.exists(obj_dir):
|
if not os.path.exists(obj_dir):
|
||||||
os.makedirs(obj_dir)
|
os.makedirs(obj_dir)
|
||||||
for src in ext.sources:
|
for src in ext.sources:
|
||||||
|
@ -13,7 +13,7 @@ from setup import Command, modules, functions, basenames, __version__, \
|
|||||||
from setup.build_environment import msvc, MT, RC
|
from setup.build_environment import msvc, MT, RC
|
||||||
from setup.installer.windows.wix import WixMixIn
|
from setup.installer.windows.wix import WixMixIn
|
||||||
|
|
||||||
QT_DIR = 'C:\\Qt\\4.6.0'
|
QT_DIR = 'Q:\\Qt\\4.6.0'
|
||||||
QT_DLLS = ['Core', 'Gui', 'Network', 'Svg', 'WebKit', 'Xml', 'XmlPatterns']
|
QT_DLLS = ['Core', 'Gui', 'Network', 'Svg', 'WebKit', 'Xml', 'XmlPatterns']
|
||||||
LIBUSB_DIR = 'C:\\libusb'
|
LIBUSB_DIR = 'C:\\libusb'
|
||||||
LIBUNRAR = 'C:\\Program Files\\UnrarDLL\\unrar.dll'
|
LIBUNRAR = 'C:\\Program Files\\UnrarDLL\\unrar.dll'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user