aboutsummaryrefslogtreecommitdiff
path: root/ports/qt5-modularscripts/fixcmake.py
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-01-18 10:51:18 -0800
committerGitHub <noreply@github.com>2018-01-18 10:51:18 -0800
commitd35866018a43c108b2fa04587917c8d53740d4e6 (patch)
treec0f4ea145071bc6da23a99862b5004e2b6ed6af0 /ports/qt5-modularscripts/fixcmake.py
parentb4c041df93663f1abc82d0cfb79420fc02d4546e (diff)
parentb47b4346f8c5b09cfb9826a083fc2d034a2ea9b4 (diff)
downloadvcpkg-d35866018a43c108b2fa04587917c8d53740d4e6.tar.gz
vcpkg-d35866018a43c108b2fa04587917c8d53740d4e6.zip
Merge pull request #1993 from Barath-Kannan/qt5_modular
Qt5 modular
Diffstat (limited to 'ports/qt5-modularscripts/fixcmake.py')
-rw-r--r--ports/qt5-modularscripts/fixcmake.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/ports/qt5-modularscripts/fixcmake.py b/ports/qt5-modularscripts/fixcmake.py
new file mode 100644
index 000000000..923e600bc
--- /dev/null
+++ b/ports/qt5-modularscripts/fixcmake.py
@@ -0,0 +1,57 @@
+import os
+import re
+from glob import glob
+
+files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))]
+
+for f in files:
+ openedfile = open(f, "r")
+ builder = ""
+ dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll")
+ libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib")
+ exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe")
+ tooldllpattern = re.compile("_install_prefix}/tools/qt5/Qt5.*d.dll")
+ for line in openedfile:
+ if "_install_prefix}/tools/qt5/${LIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line.replace("/tools/qt5/", "/bin/")
+ builder += " else()"
+ builder += "\n " + line.replace("/tools/qt5/", "/debug/bin/")
+ builder += " endif()\n"
+ elif "_install_prefix}/bin/${LIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/bin/", "/debug/bin/")
+ builder += " endif()\n"
+ elif "_install_prefix}/lib/${LIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/lib/", "/debug/lib/")
+ builder += " endif()\n"
+ elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/lib/", "/debug/lib/")
+ builder += " endif()\n"
+ elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/plugins/", "/debug/plugins/")
+ builder += " endif()\n"
+ elif dllpattern.search(line) != None:
+ builder += line.replace("/bin/", "/debug/bin/")
+ elif libpattern.search(line) != None:
+ builder += line.replace("/lib/", "/debug/lib/")
+ elif tooldllpattern.search(line) != None:
+ builder += line.replace("/tools/qt5/", "/debug/bin/")
+ elif exepattern.search(line) != None:
+ builder += line.replace("/bin/", "/tools/qt5/")
+ else:
+ builder += line
+ new_file = open(f, "w")
+ new_file.write(builder)
+ new_file.close() \ No newline at end of file