summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-04 06:53:08 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-04 06:53:08 +0100
commita3441d8326ad7722bee649486bb2358121eebbf4 (patch)
tree7c3737332e84bbd3633fe63f8202450767aa0f2c
Initial import of QPDF
-rw-r--r--.gitmodules3
-rw-r--r--gyp2pri.py94
m---------src/3rdparty/pdfium0
3 files changed, 97 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..ed0f842
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/3rdparty/pdfium"]
+ path = src/3rdparty/pdfium
+ url = https://pdfium.googlesource.com/pdfium
diff --git a/gyp2pri.py b/gyp2pri.py
new file mode 100644
index 0000000..3e3407b
--- /dev/null
+++ b/gyp2pri.py
@@ -0,0 +1,94 @@
+import sys, ast, os
+
+class Gyp(object):
+ def __init__(self, fileName):
+ 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;
+ return None
+
+ def target_defaults(self):
+ return self.variables["target_defaults"]
+
+class ProFile(object):
+ sourceExtensions = [ ".cpp", ".cc", ".c" ]
+ headerExtensions = [ ".h", ".hh" ]
+ skippingExtensions = [ ".rc" ]
+ skippingFiles = [ "makefile" ]
+
+ def __init__(self):
+ self.sources = []
+ self.headers = []
+ self.defines = []
+ self.config = []
+
+ 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):
+ for source in sources:
+ self.addSource(source)
+
+ 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 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"
+ result += "SOURCES += \\\n "
+ result += " \\\n ".join(self.sources)
+ result += "\n\n"
+ result += "HEADERS += \\\n "
+ result += " \\\n ".join(self.headers)
+ return result
+
+gyp = Gyp(sys.argv[1])
+
+mainTarget = gyp.target(sys.argv[2])
+
+pro = ProFile()
+
+pro.addSources(mainTarget["sources"])
+
+for dep in mainTarget["dependencies"]:
+ if gyp.target(dep)["target_name"] == "javascript":
+ continue
+ if gyp.target(dep)["target_name"] == "jsapi":
+ continue
+ pro.addSources(gyp.target(dep)["sources"])
+
+pro.addDefines(gyp.target_defaults()["defines"])
+pro.addConfig("c++11")
+pro.addConfig("warn_off")
+
+with open(sys.argv[3], "w") as f:
+ f.write(pro.generate())
diff --git a/src/3rdparty/pdfium b/src/3rdparty/pdfium
new file mode 160000
+Subproject 4b87f7b5f8fe26ee4869a21a8b0b4697cba51a9