|
37 | 37 | modules=(core gui analysis server 3d) |
38 | 38 | fi |
39 | 39 | sources=(HDRS MOC_HDRS SRCS) |
| 40 | +root_dir=python/PyQt6 |
40 | 41 |
|
41 | | -for root_dir in python python/PyQt6; do |
42 | | - for module in "${modules[@]}"; do |
43 | | - file=${DIR}/$root_dir/${module}/${module}_auto.sip |
44 | | - echo "Creating $root_dir/${module}/${module}_auto.sip" |
45 | | - echo "// Include auto-generated SIP files" > $file |
| 42 | +for module in "${modules[@]}"; do |
| 43 | + file=${DIR}/$root_dir/${module}/${module}_auto.sip |
| 44 | + echo "Creating $root_dir/${module}/${module}_auto.sip" |
| 45 | + echo "// Include auto-generated SIP files" > $file |
46 | 46 |
|
47 | | - headers=$( |
48 | | - for source in "${sources[@]}"; do |
49 | | - echo "QGIS_${module^^}_${source}" |
50 | | - ${GP}sed -r -n -e "/^\s*set\s*\(QGIS_${module^^}_${source}/,/\)\$/{ /^\s*set\s*\(QGIS_${module^^}_${source}/d; /\)\$/d; p; }" src/${module}/CMakeLists.txt | \ |
51 | | - ${GP}sed -r -e '/\.cc?$/d' `# remove c and cc extensions` \ |
52 | | - -e 's/\.cpp$/.h/' `# rename cpp file as headers` \ |
53 | | - -e '/^\s*\$\{CMAKE_(CURRENT_)?BINARY_DIR\}/d' \ |
54 | | - -e '/^\s*#/d' `# remove commented lines` \ |
55 | | - -e 's/\$\{.*\}//g' `# remove CMake variable append` \ |
56 | | - -e 's/^\s+//' `# remove leading spaces` \ |
57 | | - -e '/^\s*$/d' `# remove blank lines` |
58 | | - done | cat -n | sort -uk2 | sort -nk1 | cut -f2- # remove duplicated lines without sorting |
59 | | - ) |
60 | | - for header in ${headers}; do |
61 | | - if [ ! -f src/${module}/$header ]; then |
62 | | - # if no header, no sip file! |
63 | | - #echo "src/${module}/$header not found" |
64 | | - continue |
| 47 | + headers=$( |
| 48 | + for source in "${sources[@]}"; do |
| 49 | + echo "QGIS_${module^^}_${source}" |
| 50 | + ${GP}sed -r -n -e "/^\s*set\s*\(QGIS_${module^^}_${source}/,/\)\$/{ /^\s*set\s*\(QGIS_${module^^}_${source}/d; /\)\$/d; p; }" src/${module}/CMakeLists.txt | \ |
| 51 | + ${GP}sed -r -e '/\.cc?$/d' `# remove c and cc extensions` \ |
| 52 | + -e 's/\.cpp$/.h/' `# rename cpp file as headers` \ |
| 53 | + -e '/^\s*\$\{CMAKE_(CURRENT_)?BINARY_DIR\}/d' \ |
| 54 | + -e '/^\s*#/d' `# remove commented lines` \ |
| 55 | + -e 's/\$\{.*\}//g' `# remove CMake variable append` \ |
| 56 | + -e 's/^\s+//' `# remove leading spaces` \ |
| 57 | + -e '/^\s*$/d' `# remove blank lines` |
| 58 | + done | cat -n | sort -uk2 | sort -nk1 | cut -f2- # remove duplicated lines without sorting |
| 59 | + ) |
| 60 | + for header in ${headers}; do |
| 61 | + if [ ! -f src/${module}/$header ]; then |
| 62 | + # if no header, no sip file! |
| 63 | + #echo "src/${module}/$header not found" |
| 64 | + continue |
| 65 | + fi |
| 66 | + if ! grep -xq -E '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then |
| 67 | + sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header}) |
| 68 | + if_cond=$(grep -x -E '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \ |
| 69 | + ${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/') |
| 70 | + if [[ -n $if_cond ]]; then |
| 71 | + echo "$if_cond" >> $file |
65 | 72 | fi |
66 | | - if ! grep -xq -E '^(#define +)?SIP_NO_FILE' src/${module}/${header}; then |
67 | | - sip=$(${GP}sed -r 's/(.*)\.h$/\1.sip/' <<< ${header}) |
68 | | - if_cond=$(grep -x -E '^(#define +)?SIP_IF_MODULE\((.*)\)$' src/${module}/${header} | \ |
69 | | - ${GP}sed -r -e 's/(#define +)?SIP_IF_MODULE\((.*)\)/%If (\2)/') |
70 | | - if [[ -n $if_cond ]]; then |
71 | | - echo "$if_cond" >> $file |
72 | | - fi |
73 | | - if [[ "$sip" == [0-9]* ]]; then |
74 | | - # unfortunately SIP parser does not accept relative paths starting with a number |
75 | | - # so "%Include 3d/xxxx.sip" is a syntax error but everything works with "%Include ./3d/xxxx.sip" |
76 | | - sip="./$sip" |
77 | | - fi |
78 | | - echo "%Include auto_generated/$sip" >> $file |
79 | | - if [[ -n $if_cond ]]; then |
80 | | - echo "%End" >> $file |
81 | | - fi |
| 73 | + if [[ "$sip" == [0-9]* ]]; then |
| 74 | + # unfortunately SIP parser does not accept relative paths starting with a number |
| 75 | + # so "%Include 3d/xxxx.sip" is a syntax error but everything works with "%Include ./3d/xxxx.sip" |
| 76 | + sip="./$sip" |
82 | 77 | fi |
83 | | - done |
| 78 | + echo "%Include auto_generated/$sip" >> $file |
| 79 | + if [[ -n $if_cond ]]; then |
| 80 | + echo "%End" >> $file |
| 81 | + fi |
| 82 | + fi |
84 | 83 | done |
85 | 84 | done |
86 | 85 |
|
|
0 commit comments