diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-15 21:24:05 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-15 21:24:05 +0100 |
commit | b0ed0620f69475ef4d10af0057966fa55cfabad7 (patch) | |
tree | be64e12a036bdf6b70814482db8e5eb40a2030a0 | |
parent | 7647cdae97b66c5d8c4e77cc3b54acccd42da725 (diff) |
Fix build on Windows
* Need to link against some win32 dlls
* Make sure to include OS="win" sources properly scoped in the .pri file
-rw-r--r-- | src/3rdparty/gyp2pri.py | 35 | ||||
-rw-r--r-- | src/lib/lib.pro | 2 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/3rdparty/gyp2pri.py b/src/3rdparty/gyp2pri.py index af3f523..492ee6c 100644 --- a/src/3rdparty/gyp2pri.py +++ b/src/3rdparty/gyp2pri.py @@ -14,17 +14,18 @@ class Gyp(object): def target_defaults(self): return self.variables["target_defaults"] -class ProFile(object): +class ProFileSection(object): sourceExtensions = [ ".cpp", ".cc", ".c" ] headerExtensions = [ ".h", ".hh" ] skippingExtensions = [ ".rc" ] skippingFiles = [ "makefile" ] - def __init__(self): + def __init__(self, scope): self.sources = [] self.headers = [] self.defines = [] self.config = [] + self.scope = scope def addSource(self, fileName): extension = os.path.splitext(fileName)[1] @@ -55,7 +56,7 @@ class ProFile(object): self.config.append(cfg) def generate(self): - result = "# This is a generated file, do not edit!\n" + result = "" if self.defines: result += "DEFINES += \\\n " result += " \\\n ".join(self.defines) @@ -69,6 +70,24 @@ class ProFile(object): 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 gyp = Gyp(sys.argv[1]) @@ -84,7 +103,15 @@ for dep in mainTarget["dependencies"]: continue if gyp.target(dep)["target_name"] == "jsapi": continue - pro.addSources(gyp.target(dep)["sources"]) + t = gyp.target(dep) + pro.addSources(t["sources"]) + + if "conditions" in t: + for condition in t["conditions"]: + if condition[0] == "OS==\"win\"": + scope = ProFileSection("win32") + scope.addSources(condition[1]["sources"]) + pro.addScope(scope) pro.addDefines(gyp.target_defaults()["defines"]) diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 5350bee..3180ca8 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -8,3 +8,5 @@ load(qt_helper_lib) VPATH += ../3rdparty/pdfium include(../3rdparty/pdfium.pri) + +win32: LIBS_PRIVATE += -ladvapi32 -lgdi32 -luser32 |