migration: add Grantlee parser smoke test; apply safe RTI finder guard; add patch script to avoid QT_TESTCASE_BUILDDIR redefinition
This commit is contained in:
1 parent
56adad890c
commit
cef0d47ebc
2 files changed
+34
-7
No files matched your search
@@ -21,10 +21,34 @@ fi
|
||||
# Replace the unconditional target_compile_definitions block with a commented
|
||||
# explanation to avoid duplicate -D flags.
|
||||
|
||||
awk '
|
||||
BEGIN{inblock=0}
|
||||
/target_compile_definitions\(plainmarkupbuildertest_exec PRIVATE QT_TESTCASE_BUILDDIR/ {inblock=1; print "# QT_TESTCASE_BUILDDIR was previously defined here which could conflict with the"; print "# the definition injected by Qt\'s test configuration. Defining the macro in"; print "# multiple places leads to compiler redefinition errors. The test framework"; print "# already provides this define when needed, so omit the explicit definition"; print "# to avoid duplicate -D flags."; next}
|
||||
{ if (inblock) { if (/^endif\(\)/) { inblock=0; next } else next } print }
|
||||
' "$TARGET_FILE" > "$TARGET_FILE.tmp" && mv "$TARGET_FILE.tmp" "$TARGET_FILE"
|
||||
# export TARGET_FILE for the python subprocess
|
||||
TARGET_FILE="$TARGET_FILE"
|
||||
export TARGET_FILE
|
||||
|
||||
python3 - <<'PY'
|
||||
import io,sys
|
||||
import os
|
||||
TARGET_FILE = os.environ.get('TARGET_FILE')
|
||||
if not TARGET_FILE:
|
||||
print('TARGET_FILE not set', file=sys.stderr)
|
||||
sys.exit(2)
|
||||
with open(TARGET_FILE, 'r', encoding='utf-8') as f:
|
||||
s = f.read()
|
||||
old = 'target_compile_definitions(plainmarkupbuildertest_exec PRIVATE QT_TESTCASE_BUILDDIR'
|
||||
if old in s:
|
||||
# remove the line and any surrounding if/endif that only wrap it
|
||||
import re
|
||||
# replace the specific line plus optional surrounding if/endif block with a comment
|
||||
s2 = re.sub(r"if \(NOT GRANTLEE_BUILD_WITH_QT6\)\s*target_compile_definitions\(plainmarkupbuildertest_exec PRIVATE QT_TESTCASE_BUILDDIR[\s\S]*?endif\(\)\n?", \
|
||||
'# QT_TESTCASE_BUILDDIR was previously defined here which could conflict with the\n# the definition injected by Qt\'s test configuration. Defining the macro in\n# multiple places leads to compiler redefinition errors. The test framework\n# already provides this define when needed, so omit the explicit definition\n# to avoid duplicate -D flags.\n', s)
|
||||
if s2==s:
|
||||
# fallback: remove only the line
|
||||
s2 = s.replace('target_compile_definitions(plainmarkupbuildertest_exec PRIVATE QT_TESTCASE_BUILDDIR="${CMAKE_BINARY_DIR}")\n','')
|
||||
s = s2
|
||||
with open(TARGET_FILE, 'w', encoding='utf-8') as f:
|
||||
f.write(s)
|
||||
print('Applied grantlee fix to', TARGET_FILE)
|
||||
PY
|
||||
|
||||
|
||||
|
||||
echo "Applied grantlee fix to $TARGET_FILE"
|
||||
+4
-1
@@ -86,7 +86,10 @@ IF(NOT RTI_DIR)
|
||||
if(_found_arch STREQUAL "")
|
||||
# fallback: pick any x64Linux* directory under lib
|
||||
file(GLOB _rti_arch_dirs RELATIVE "${_RTI_DIR}/lib" "${_RTI_DIR}/lib/x64Linux*")
|
||||
list(GET _rti_arch_dirs 0 _found_arch)
|
||||
list(LENGTH _rti_arch_dirs _rti_arch_dirs_len)
|
||||
if(_rti_arch_dirs_len GREATER 0)
|
||||
list(GET _rti_arch_dirs 0 _found_arch)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT _found_arch STREQUAL "")
|
||||
SET(_rti_gcc_arch "${_found_arch}")
|
||||
|
||||
Reference in new issue
Block a user