summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2019-08-09 11:37:32 +0200
committerMichal Klocek <michal.klocek@qt.io>2019-11-25 12:01:39 +0100
commit71663751e74c814e516e22d8a5e5532381e015e6 (patch)
tree7d9e3dcde5d1e64bb89b4df45d4c9b349bcbcb66
parentf2d267d5a62c0cfe5aae7a52ae179662177fe932 (diff)
Initial import of qtpdf source code
Code has been imported from git://code.qt.io/qt-labs/qtpdf to src/pdf, src/pdfwidgets, examples/pdfwidgets and tests/auto/pdf. Some git revision history was rewritten to remove conflicting files like src.pro, examples.pro, tests.pro, .gitingnore, .gitmodules, sync.profile, .qmake.conf, 3rdparty Removed unneeded leftovers after import. Change-Id: Ifc1e02828adfefe8db68d596cd2cb238de22408b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--qpdf.pro3
-rw-r--r--src/gyp/gyp2pri.py179
-rw-r--r--src/lib/lib.pro23
-rw-r--r--tests/auto/pdf/cmake/cmake.pro0
4 files changed, 0 insertions, 205 deletions
diff --git a/qpdf.pro b/qpdf.pro
deleted file mode 100644
index cd1d5c427..000000000
--- a/qpdf.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-load(qt_parts)
-# Upstream PDFium has not been ported to various platforms yet.
-requires(!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity)
diff --git a/src/gyp/gyp2pri.py b/src/gyp/gyp2pri.py
deleted file mode 100644
index c8bd8653c..000000000
--- a/src/gyp/gyp2pri.py
+++ /dev/null
@@ -1,179 +0,0 @@
-import sys, ast, os, argparse
-
-class Gyp(object):
- def __init__(self, fileName, gypVariables):
- self.fileName = fileName
- self.gypVariables = gypVariables
- with open(fileName, "r") as f:
- self.variables = ast.literal_eval(f.read())
-
- def target(self, name):
- for t in self.variables["targets"]:
- if t["target_name"] == name:
- return t;
-
- for condition in self.variables["conditions"] or []:
- check = condition[0]
- vars = condition[1]
- try:
- if eval(check, None, self.gypVariables):
- for t in vars["targets"] or []:
- if t["target_name"] == name:
- return t;
- except: pass
- return None
-
- def target_defaults(self):
- return self.variables["target_defaults"]
-
-class ProFileSection(object):
- sourceExtensions = [ ".cpp", ".cc", ".c" ]
- headerExtensions = [ ".h", ".hh" ]
- skippingExtensions = [ ".rc" ]
- skippingFiles = [ "makefile" ]
-
- def __init__(self, scope):
- self.sources = []
- self.headers = []
- self.defines = []
- self.includes = []
- self.config = []
- self.scope = scope
-
- def addSource(self, fileName):
- extension = os.path.splitext(fileName)[1]
- baseName = os.path.basename(fileName)
- if extension in ProFile.headerExtensions:
- self.headers.append(fileName)
- elif extension in ProFile.sourceExtensions:
- self.sources.append(fileName)
- elif baseName in ProFile.skippingFiles:
- return
- elif extension in ProFile.skippingExtensions:
- return
- else:
- raise Exception("Unknown source %s" % fileName)
-
- def addSources(self, sources, baseDirectory = None):
- for source in sources:
- path = source
- if baseDirectory:
- path = baseDirectory + "/" + path
- self.addSource(path)
-
- def addDefine(self, define):
- self.defines.append(define)
-
- def addDefines(self, defines):
- for macro in defines:
- self.addDefine(macro)
-
- def addConfig(self, cfg):
- self.config.append(cfg)
-
- def addInclude(self, path):
- path = path.replace("<(DEPTH)", "")
- self.includes.append("$$PWD/" + path)
-
- def generate(self):
- result = ""
- if self.defines:
- result += "DEFINES += \\\n "
- result += " \\\n ".join(self.defines)
- result += "\n\n"
- if self.config:
- result += "CONFIG += \\\n "
- result += " \\\n ".join(self.config)
- result += "\n\n"
- if self.includes:
- result += "INCLUDEPATH += \\\n "
- result += " \\\n ".join(self.includes)
- result += "\n\n"
- result += "SOURCES += \\\n "
- result += " \\\n ".join(self.sources)
- result += "\n\n"
- result += "HEADERS += \\\n "
- result += " \\\n ".join(self.headers)
- result += "\n\n"
- return result
-
-class ProFile(ProFileSection):
- def __init__(self):
- ProFileSection.__init__(self, "")
- self.scopes = []
-
- def addScope(self, section):
- self.scopes.append(section)
-
- def generate(self):
- result = "# This is a generated file, do not edit!\n"
- result += ProFileSection.generate(self)
- for section in self.scopes:
- result += section.scope + " {\n"
- result += section.generate()
- result += "\n}\n"
- return result
-
-def addDependencies(gyp, proFile, gypTarget, variables):
- for dep in gypTarget.get("dependencies") or []:
- target = None
- baseDir = None
- for key, value in variables.iteritems():
- name = "<(" + key + ")"
- replacement = value
- dep = dep.replace(name, replacement)
- if ".gyp:" in dep:
- targetFileName = dep[:dep.index(":")]
- fileName = os.path.dirname(gyp.fileName) + "/" + targetFileName
- subDep = dep[dep.index(":") + 1:]
- target = Gyp(fileName, variables).target(subDep)
- baseDir = os.path.relpath(os.path.dirname(fileName), os.path.dirname(gyp.fileName))
- else:
- target = gyp.target(dep)
- if not target:
- return
- if target["target_name"] == "javascript":
- continue
- if target["target_name"] == "jsapi":
- continue
- pro.addSources(target["sources"], baseDir)
-
- if "conditions" in target:
- for condition in target["conditions"]:
- if condition[0] == "OS==\"win\"":
- scope = ProFileSection("win32")
- scope.addSources(condition[1]["sources"])
- pro.addScope(scope)
-
- addDependencies(gyp, proFile, target, variables)
-
-optionParser = argparse.ArgumentParser()
-optionParser.add_argument("--gyp-var", action="append")
-optionParser.add_argument("input")
-optionParser.add_argument("mainTarget")
-optionParser.add_argument("output")
-config = optionParser.parse_args()
-
-variables = {}
-for var in config.gyp_var or []:
- key, value = var.split("=")
- variables[key] = value
-
-gyp = Gyp(config.input, variables)
-
-mainTarget = gyp.target(config.mainTarget)
-
-pro = ProFile()
-
-pro.addSources(mainTarget["sources"])
-
-addDependencies(gyp, pro, mainTarget, variables)
-
-target_defaults = gyp.target_defaults()
-pro.addDefines(target_defaults["defines"])
-if "include_dirs" in target_defaults:
- for path in target_defaults["include_dirs"]:
- pro.addInclude(os.path.relpath(os.path.dirname(gyp.fileName) + "/" + path, os.path.dirname(config.output)))
-
-with open(config.output, "w") as f:
- f.write(pro.generate())
diff --git a/src/lib/lib.pro b/src/lib/lib.pro
deleted file mode 100644
index 8535a315e..000000000
--- a/src/lib/lib.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGET = qtpdfium
-
-CONFIG += staticlib hide_symbols warn_off rtti_off exceptions_off c++11
-
-DEFINES += NOMINMAX
-
-load(qt_helper_lib)
-
-unix:!mac: CONFIG -= debug_and_release
-
-VPATH += $$QTPDF_ROOT/src/3rdparty/pdfium
-VPATH += $$QTPDF_ROOT/src/3rdparty/pdfium/third_party
-
-system(python $$QTPDF_ROOT/src/3rdparty/gyp2pri.py --gyp-var libjpeg_gyp_path=third_party/third_party.gyp --gyp-var pdf_use_skia=0 $$QTPDF_ROOT/src/3rdparty/pdfium/pdfium.gyp pdfium $$OUT_PWD/pdfium.pri)
-system(python $$QTPDF_ROOT/src/3rdparty/gyp2pri.py $$QTPDF_ROOT/src/3rdparty/pdfium/third_party/third_party.gyp fx_freetype $$OUT_PWD/freetype.pri)
-
-include($$OUT_PWD/pdfium.pri)
-
-DEFINES += FT2_BUILD_LIBRARY
-include($$OUT_PWD/freetype.pri)
-
-win32: LIBS_PRIVATE += -ladvapi32 -lgdi32 -luser32
-mac: LIBS_PRIVATE += -framework AppKit -framework CoreFoundation
diff --git a/tests/auto/pdf/cmake/cmake.pro b/tests/auto/pdf/cmake/cmake.pro
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/auto/pdf/cmake/cmake.pro
+++ /dev/null