- Wrap FIND_PACKAGE(RTI) in IF(NOT TARGET RTI::nddsc) condition - Prevents placeholder targets from overwriting manually configured RTI:: targets - Manual configuration creates RTI:: targets when BUILD_RTI=ON and RTI found - FIND_PACKAGE only called as fallback when manual config doesn't create targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1CT3XSQXCX9RQR6WM9DG3GH
69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Fix QtGui includes for geometry classes - they belong to QtCore in Qt6
|
|
"""
|
|
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
# Geometry classes that belong to QtCore, NOT QtGui
|
|
GEOMETRY_CLASSES = [
|
|
'QPointF', 'QPoint', 'QRect', 'QRectF', 'QSize', 'QSizeF',
|
|
'QLine', 'QLineF', 'QPolygon', 'QPolygonF', 'QRegion', 'QTransform',
|
|
'QMatrix', 'QPainterPath', 'QPainterPathStroker'
|
|
]
|
|
|
|
def fix_qtgui_geometry_includes(filepath):
|
|
"""Replace QtGui/geometry with QtCore/geometry"""
|
|
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
content = f.read()
|
|
|
|
original = content
|
|
fixes = []
|
|
|
|
for cls in GEOMETRY_CLASSES:
|
|
pattern = r'#include\s*<QtGui/' + cls + r'>'
|
|
replacement = f'#include <QtCore/{cls}>'
|
|
|
|
if re.search(pattern, content):
|
|
content = re.sub(pattern, replacement, content)
|
|
fixes.append(cls)
|
|
|
|
if fixes:
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
return fixes
|
|
return []
|
|
|
|
def main():
|
|
base_dir = '/home/torsten/swy/sandbox/qt-migration-legatus/qt6-after/qt6-migrated-legatus'
|
|
|
|
total_files = 0
|
|
total_fixes = 0
|
|
all_fixes = {}
|
|
|
|
for root, dirs, files in os.walk(base_dir):
|
|
# Skip build directories
|
|
if 'build' in root or '.git' in root:
|
|
continue
|
|
|
|
for file in files:
|
|
if file.endswith(('.h', '.cpp', '.hpp', '.cc', '.cxx')):
|
|
filepath = os.path.join(root, file)
|
|
fixes = fix_qtgui_geometry_includes(filepath)
|
|
if fixes:
|
|
total_files += 1
|
|
total_fixes += len(fixes)
|
|
all_fixes[filepath] = fixes
|
|
print(f"Fixed {len(fixes)}: {filepath}")
|
|
for fix in fixes:
|
|
print(f" - QtGui/{fix} → QtCore/{fix}")
|
|
|
|
print(f"\n{'='*80}")
|
|
print(f"Total files fixed: {total_files}")
|
|
print(f"Total fixes: {total_fixes}")
|
|
print(f"{'='*80}")
|
|
|
|
if __name__ == '__main__':
|
|
main() |