Move pdf backend integration logic to seperate .pri file

This commit is contained in:
Felix Kauselmann 2017-04-15 18:40:39 +02:00
parent 7ac9860e60
commit c537583365
4 changed files with 70 additions and 171 deletions

View File

@ -11,6 +11,7 @@ QMAKE_MAC_SDK = macosx10.12
#load default build flags
include (../config.pri)
include (../dependencies/pdf_backend.pri)
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
@ -27,7 +28,7 @@ CONFIG(force_angle) {
SOURCES += main.cpp
INCLUDEPATH += ../common \
../custom_widgets
../custom_widgets
!CONFIG(no_opengl):CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
@ -39,63 +40,24 @@ INCLUDEPATH += ../common \
win32 {
CONFIG(force_angle) {
message("using ANGLE")
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
#linking extra libs are necesary for a successful compilation, a better approach should be
#to remove any OpenGL (desktop) dependencies
#the OpenGL stuff should be migrated to OpenGL ES
DEFINES += FORCE_ANGLE
} else {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lpdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
!CONFIG(no_opengl) {
unix:!macx:!CONFIG(no_opengl) {
LIBS += -lGLU
}
}
macx{
#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include"
#isEqual(QT_MAJOR_VERSION, 5) {
@ -107,20 +69,11 @@ macx{
#LIBS += -L/usr/local/lib -lpoppler-qt4
#}
#TODO: pdfium support
!CONFIG(no_pdf) {
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
}
CONFIG += objective_c
QT += macextras gui-private
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += ../common/pdf_comic.mm
}
QT += network widgets core
@ -167,7 +120,7 @@ HEADERS += ../common/comic.h \
../common/exit_check.h \
../common/scroll_management.h \
../common/opengl_checker.h \
../common/pdf_comic.h
../common/pdf_comic.h
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
@ -214,10 +167,6 @@ SOURCES += ../common/comic.cpp \
../common/scroll_management.cpp \
../common/opengl_checker.cpp
CONFIG(pdfium) {
SOURCES+= ../common/pdf_comic.cpp
}
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")
@ -310,4 +259,4 @@ manpage.files = ../YACReader.1
#remove leftover doc files when 'make clean' is invoked
QMAKE_CLEAN += "../changelog" "../README"
}
}

View File

@ -17,6 +17,7 @@ DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
QMAKE_MAC_SDK = macosx10.12
#load default build flags
include (../config.pri)
include (../dependencies/pdf_backend.pri)
CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
@ -28,30 +29,13 @@ CONFIG(legacy_gl_widget) {
win32 {
CONFIG(force_angle) {
message("using ANGLE")
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
#linking extra libs are necesary for a successful compilation, a better approach should be
#to remove any OpenGL (desktop) dependencies
#the OpenGL stuff should be migrated to OpenGL ES
DEFINES += FORCE_ANGLE
} else {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
@ -60,27 +44,9 @@ win32 {
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
!CONFIG(no_opengl) {
LIBS += -lGLU
LIBS += -lGLU
}
}
@ -96,16 +62,8 @@ macx{
#}
#QT += macextras
!CONFIG(no_pdf){
#TODO:support for pdfium on mac
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
}
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
CONFIG += objective_c
QT += macextras gui-private
}
@ -261,11 +219,6 @@ SOURCES += comic_flow.cpp \
yacreader_comics_selection_helper.cpp \
yacreader_comic_info_helper.cpp
CONFIG(pdfium) {
SOURCES += ../common/pdf_comic.cpp
}
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")

View File

@ -16,69 +16,22 @@ QMAKE_MAC_SDK = macosx10.12
#load default build flags
#do a basic dependency check
include(headless_config.pri)
include(../dependencies/pdf_backend.pri)
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
}
LIBS += -loleaut32 -lole32 -lshell32 -luser32
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
#static pdfium libraries have to be included *before* dynamic libraries
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
}
macx{
#TODO:support for pdfium on mac
!CONFIG(no_pdf) {
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
macx {
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
CONFIG += objective_c
}
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
CONFIG += objective_c
}
unix{
CONFIG += c++11
unix {
CONFIG += c++11
}
#CONFIG += release
@ -95,7 +48,7 @@ HEADERS += ../YACReaderLibrary/library_creator.h \
../common/folder.h \
../common/library_item.h \
../common/comic.h \
../common/pdf_comic.h \
../common/pdf_comic.h \
../common/bookmarks.h \
../common/qnaturalsorting.h \
../common/yacreader_global.h \
@ -127,11 +80,6 @@ SOURCES += ../YACReaderLibrary/library_creator.cpp \
console_ui_library_creator.cpp \
main.cpp
CONFIG(pdfium) {
SOURCES += ../common/pdf_comic.cpp
}
include(../YACReaderLibrary/server/server.pri)
CONFIG(7zip){
include(../compressed_archive/wrapper.pri)
@ -182,7 +130,7 @@ else:CONFIG(server_bundled) {
else {
INSTALLS += bin server translation
message("No build type specified. Defaulting to standalone server build (CONFIG+=server_standalone).")
message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary, please specify CONFIG+=server_bundled as an option when running qmake.")
message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary, please specify CONFIG+=server_bundled as an option when running qmake.")
}
bin.path = $$BINDIR
@ -200,4 +148,4 @@ translation.files = ../release/languages/yacreaderlibrary_*
#manpage.path = $$DATADIR/man/man1
#manpage.files = ../YACReaderLibrary.1
}
}

49
dependencies/pdf_backend.pri vendored Normal file
View File

@ -0,0 +1,49 @@
CONFIG(no_pdf) {
DEFINES += "NO_PDF"
}
CONFIG(pdfium) {
DEFINES += "USE_PDFIUM"
SOURCES += ../common/pdf_comic.cpp
win32 {
INCLUDEPATH += ../dependencies/pdfium/public
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
}
unix {
macx {
LIBS += -L$$PWD/../dependencies/pdfium/macx/bin -lpdfium
INCLUDEPATH += $$PWD/../dependencies/pdfium/macx/include
}
!macx {
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lpdfium -lfreetype
}
}
}
CONFIG(pdfkit) {
!macx {
error (Pdfkit is macOS only)
} else {
DEFINES += "USE_PDFKIT"
OBJECTIVE_SOURCES += ../common/pdf_comic.mm
}
}
CONFIG(poppler) {
win32 {
LIBS += -Lpoppler/lib -lpoppler-qt5
INCLUDEPATH += poppler/include/qt5
}
unix:!macx {
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
}
unix:macx {
error (Poppler backend is currently not supported on macOS)
}
}