Skip to content

Commit

Permalink
Fixes to building the library and clean the build script up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
poizan42 committed Nov 17, 2016
1 parent fcff271 commit 77d12d1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
31 changes: 23 additions & 8 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
'common' : [
'-opensource',
'-confirm-license',
'-release',
'-force-debug-info',
'-static',
'-system-zlib',
Expand Down Expand Up @@ -95,6 +94,14 @@
'-D QT_NO_STYLE_PLASTIQUE',
'-D QT_NO_PRINTPREVIEWDIALOG'
],
'common-release': [
'-release',
'-ltcg'
],
'common-debug': [
'remove:-release',
'-debug'
],

'msvc': [
'-no-angle',
Expand Down Expand Up @@ -639,7 +646,8 @@ def qt_config(key, *opts):
if not arg.startswith('remove:-'):
output.append(arg)
elif arg[1+arg.index(':'):] in output:
output.remove(arg[1+arg.index(':'):])
cfg_name = arg[1+arg.index(':'):]
output.remove(cfg_name)
return ' '.join(output)

def fpm_params(cfg, ver):
Expand Down Expand Up @@ -1020,6 +1028,7 @@ def build_msvc(config, basedir):
msvc, arch = rchop(config, '-dbg').split('-')
generate_vcprojs = True
make_package = False
debug = config.endswith('-dbg')

vcdir = os.path.join(os.environ[MSVC_LOCATION[msvc]], '..', '..', 'VC')
vcarg = 'x86'
Expand All @@ -1046,8 +1055,8 @@ def build_msvc(config, basedir):
cygwin = get_registry_value(r'SOFTWARE\Cygwin\setup', 'rootdir')
cygdest = get_output(os.path.join(cygwin, 'bin', 'cygpath.exe'), '-ua', libdir)
cflags = '/Zi'
cflags += config.endswith('-dbg') and ' /MDd' or ' /MD'
icu_dbg = config.endswith('-dbg') and '--enable-debug --disable-release' or ''
cflags += debug and ' /MDd' or ' /MD /GL'
icu_dbg = debug and '--enable-debug --disable-release' or ''
_, ruby_bin_dir = windows_find_ruby()
if ruby_bin_dir:
path = r'%s;%s' % (path, ruby_bin_dir)
Expand Down Expand Up @@ -1132,10 +1141,14 @@ def build_msvc(config, basedir):

os.environ['WKHTMLTOX_VERSION'] = version

shell('%s %s\\..\\wkhtmltopdf.pro CONFIG+=force_debug_info' % (qmake, basedir))
opts = "CONFIG+=force_debug_info"
if not debug:
opts += " CONFIG+=ltcg CONFIG-=debug"

shell('%s %s\\..\\wkhtmltopdf.pro %s' % (qmake, basedir, opts))
shell(jom_builder)
if generate_vcprojs and not exists(os.path.join(appdir, 'wkhtmltopdf.sln')):
shell('%s -r -tp vc %s\\..\\wkhtmltopdf.pro CONFIG+=force_debug_info' % (qmake, basedir))
if generate_vcprojs :
shell('%s -r -tp vc %s\\..\\wkhtmltopdf.pro %s' % (qmake, basedir, opts))

if make_package:
makensis = os.path.join(get_registry_value(r'SOFTWARE\NSIS'), 'makensis.exe')
Expand Down Expand Up @@ -1476,7 +1489,9 @@ def main():
final_config = config
if '-debug' in sys.argv[2:]:
final_config += '-dbg'
QT_CONFIG['common'].extend(['remove:-release', '-debug'])
QT_CONFIG['common'].extend(QT_CONFIG['common-debug'])
else:
QT_CONFIG['common'].extend(QT_CONFIG['common-release'])

if '-clean' in sys.argv[2:]:
rmdir(os.path.join(basedir, final_config))
Expand Down
7 changes: 7 additions & 0 deletions src/lib/lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

TEMPLATE = lib
CONFIG += dll
QT += gui

include(../../common.pri)
include(lib.pri)
Expand All @@ -35,6 +36,12 @@ unix {

windows {
TARGET_EXT=.dll
QT_PLUGIN += qwindows
QT_PLUGIN.platforms += qwindows
# https://bugzilla.redhat.com/show_bug.cgi?id=1257630
LIBS += -L$$[QT_INSTALL_PLUGINS]/platforms
debug:LIBS += -lqwindowsd
release:LIBS += -lqwindows
}

TARGET=wkhtmltox
Expand Down
7 changes: 7 additions & 0 deletions src/lib/pdf_c_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@

#include <QHash>

// https://bugzilla.redhat.com/show_bug.cgi?id=1257630
#ifdef Q_OS_WIN
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
//Q_IMPORT_PLUGIN(qwindows)
#endif

#include "dllbegin.inc"
/**
* \page pagesettings Setting
Expand Down

0 comments on commit 77d12d1

Please sign in to comment.