Skip to content

Commit e7102ce

Browse files
Try another approach.
1 parent 4d1193c commit e7102ce

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/py_binding.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,22 @@ jobs:
146146
CXX_VERSION=$(
147147
$CXX -dM -E -x c++ - <<<'#include <vector>' 2>/dev/null | \
148148
grep -E '__GLIBCXX__|_LIBCPP_VERSION' | \
149-
awk '
150-
/__GLIBCXX__/ {
151-
printf("libstdcxx%s.%s.%s\n", substr($2,1,4), substr($2,5,2), substr($2,7,2))
152-
}
153-
/_LIBCPP_VERSION/ {
154-
printf("libcxx%d.%d.%d\n", substr($2,1,2)+0, substr($2,3,2)+0, substr($2,5,2)+0)
155-
}'
149+
while read -r line; do
150+
if [[ "$line" == *'__GLIBCXX__'* ]]; then
151+
val=$(echo "$line" | cut -d' ' -f3)
152+
printf "libstdcxx%s.%s.%s\n" "${val:0:4}" "${val:4:2}" "${val:6:2}"
153+
elif [[ "$line" == *'_LIBCPP_VERSION'* ]]; then
154+
val=$(echo "$line" | cut -d' ' -f3)
155+
major=$((10#${val:0:2}))
156+
minor=$((10#${val:2:2}))
157+
patch=$((10#${val:4:2}))
158+
printf "libcxx%d.%d.%d\n" "$major" "$minor" "$patch"
159+
fi
160+
done
156161
)
157162
163+
echo "Detected STL version: $CXX_VERSION"
164+
158165
echo "CXX_VERSION=$CXX_VERSION" >> $GITHUB_ENV
159166
160167
- name: Define version

0 commit comments

Comments
 (0)