vcpkg/ports/qt5/fixcmake.py
Robert Schumacher dd6d1aa560 [qt5] Exercise full control over build configuration.
Bumps version to 5.7.1-2

This fixes several issues:
- Prevents a hang for user input during the build.
- Moves the tools into a subdirectory so their DLLs do not interfere with other packages.
- Adds the currently installed DLLs to the path so that tools compiled during the build can be run.
- Uses our system's copy of double-conversion.
- No longer uses looped builds; I haven't seen issues since the update to JOM 1.1.2
- Works around an issue with Qt5Bootstrap (QTBUG-55499)

Regressions to fix:
- Disables many subcomponents
2017-02-23 03:34:21 -08:00

44 lines
1.9 KiB
Python

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 = ""
exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe")
for line in openedfile:
if "_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}/lib/qtmaind.lib" in line:
builder += line.replace("/lib/", "/debug/lib/")
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 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()