vcpkg/ports/qt5-base/fixcmake.py

89 lines
4.8 KiB
Python
Raw Normal View History

2017-10-15 19:22:17 +08:00
import os
import re
import sys
2017-10-15 19:22:17 +08:00
from glob import glob
port="qt5"
if len(sys.argv) > 1:
port=sys.argv[1]
2017-10-15 19:22:17 +08:00
files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))]
tooldir="/tools/"+port+"/bin/"
2017-10-15 19:22:17 +08:00
for f in files:
openedfile = open(f, "r")
builder = ""
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
dllpatterndebug = re.compile("_install_prefix}/bin/Qt5.*d+(.dll|.so)")
libpatterndebug = re.compile("_install_prefix}/lib/Qt5.*d+(.lib|.a)")
exepattern = re.compile("_install_prefix}/bin/[a-z]+(.exe|)")
toolexepattern = re.compile("_install_prefix}/tools/qt5/bin/[a-z]+(.exe|)")
tooldllpattern = re.compile("_install_prefix}/tools/qt5/bin/Qt5.*d+(.dll|.so)")
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
populatepluginpattern = re.compile("_populate_[^_]+_plugin_properties\([^ ]+ RELEASE")
populatetargetpattern = re.compile("_populate_[^_]+_target_properties\(RELEASE ")
2017-10-15 19:22:17 +08:00
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", "/bin/")
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
builder += " else()" #This requires a release and debug build since Qt will check that the file exists!
#It would be better to use an elseif here with a EXISTS check but that requires a more complicated regex to build the complete filepath since each module uses its own _(qtmodule)_install_prefix
#so single configuration builds of Qt are currently not supported. Thus =>
#TODO: Make single configuration builds of Qt work correctly!
builder += "\n " + line.replace("/tools/qt5/debug/bin", "/debug/bin/")
builder += " endif()\n"
elif "_install_prefix}/bin/${LIB_LOCATION}" in line:
2017-10-15 19:22:17 +08:00
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
builder += " else()" #This requires a release and debug build!
builder += "\n " + line.replace("/bin/", "/debug/bin/")
2017-10-15 19:22:17 +08:00
builder += " endif()\n"
elif "_install_prefix}/lib/${LIB_LOCATION}" in line:
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
builder += " else()" #This requires a release and debug build!
2017-10-15 19:22:17 +08:00
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
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
builder += " else()" #This requires a release and debug build!
2017-10-15 19:22:17 +08:00
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
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
builder += " else()" #This requires a release and debug build!
2017-10-15 19:22:17 +08:00
builder += "\n " + line.replace("/plugins/", "/debug/plugins/")
builder += " endif()\n"
elif "_install_prefix}/lib/qtmaind.lib" in line:
# qtmaind.lib has been moved to manual-link:
builder += line.replace("/lib/", "/debug/lib/manual-link/")
elif "_install_prefix}/lib/qtmain.lib" in line:
# qtmain(d).lib has been moved to manual-link:
builder += line.replace("/lib/", "/lib/manual-link/")
builder += " set(imported_location_debug \"${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib\")\n"
builder += "\n"
builder += " set_target_properties(Qt5::WinMain PROPERTIES\n"
builder += " IMPORTED_LOCATION_DEBUG ${imported_location_debug}\n"
builder += " )\n"
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
elif populatepluginpattern.search(line) != None:
builder += line
builder += line.replace("RELEASE", "DEBUG").replace(".dll", "d.dll").replace(".lib", "d.lib")
elif populatetargetpattern.search(line) != None:
builder += line
builder += line.replace("RELEASE", "DEBUG").replace(".dll", "d.dll").replace(".lib", "d.lib")
elif dllpatterndebug.search(line) != None:
2017-10-15 19:22:17 +08:00
builder += line.replace("/bin/", "/debug/bin/")
[qt5-base] Fix Qt5 linux build and be a bit less flaky in CI (#9260) * Fix static qt5 builds and ignore system qmake closes #9234 and #9239 * fix angle conflict and icu dependency * add egl-registry as a dependency * remove space * adding spaces resolved the problem * move files only if they exist * Update the Wrapper to use the Postgres target fixes some observed linkage issues * update baseline * add fontconfig on linux so CI is less flaky in a full rebuild * fix linkage dependent qt5-imageformats libs * Fix Wrapper for Linux and add other platform libs to Qt5::Core * fix plugin properties in cmake files * fix cmake files. * fix missing plugin qminimal deployment into tools dir * change wrapper slightly * UNIX also means APPLE so it needs to be excluded * fix the static windows build * mark the parts of fixcmake which require further work to work with single configuration builds * Update ci.baseline.txt make qt5-tools pass for CI testing * fix last regression * break auto fontconfig in configure script to fix qt5-tools * update baseline * enable verbose to debug ci * try to help it instead of breaking it * completly link icu * try to fix fontconfig configure * fix configure call. cannot be called with a list! * remove invalid line from patch * force icu and reduce the required icu libs according to the configure script * fix icu linkage * add more icu dependencies and names for windows * add more icu libs. Seems like all are needed * fix typo * print icu libs in debug * check releasenames * try again * change link order * add icu to wrapper * fix typo * patch icu configure for static windows builds * add other icu libraries to the icu patch * fix icu in x64-windows-static * update baseline. VTK builds in local WSL so it should work in CI * update VTK control to force rebuild * remove qt5-tools=pass from baseline * remove qcustomplot:x64-linux=fail from baseline Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2020-01-07 04:36:51 +08:00
elif libpatterndebug.search(line) != None:
2017-10-15 19:22:17 +08:00
builder += line.replace("/lib/", "/debug/lib/")
elif tooldllpattern.search(line) != None:
builder += line.replace("/tools/qt5/bin", "/debug/bin/")
2017-10-15 19:22:17 +08:00
elif exepattern.search(line) != None:
builder += line.replace("/bin/", tooldir)
elif toolexepattern.search(line) != None:
builder += line.replace("/tools/qt5/bin/",tooldir)
2017-10-15 19:22:17 +08:00
else:
builder += line
new_file = open(f, "w")
new_file.write(builder)
new_file.close()