Skip to content

Commit 48842e3

Browse files
Try adding C++ STL version to the wheel names.
1 parent 180c333 commit 48842e3

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

.github/workflows/py_binding.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
110110
- name: CMake Arguments (Windows)
111111
if: matrix.os == 'windows-latest'
112+
shell: powershell
112113
run: |
113114
echo "CMAKE_CXX_FLAGS=-march=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
114115
@@ -121,6 +122,36 @@ jobs:
121122
if: matrix.os != 'windows-latest'
122123
run: |
123124
echo "ARCHITECTURE=${{ matrix.arch }}" >> $GITHUB_ENV
125+
126+
- name: Extract C++ Standard Library Version (Windows)
127+
if: matrix.os == 'windows-latest'
128+
shell: powershell
129+
run: |
130+
$cxx_version = & $env:CXX -dM -E -x c++ NUL 2>$null | Select-String '_MSC_VER' | ForEach-Object {
131+
if ($_ -match '_MSC_VER\s+(\d+)') {
132+
"msvc$($matches[1])"
133+
}
134+
}
135+
136+
echo "CXX_VERSION=$cxx_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
137+
138+
- name: Extract C++ Standard Library Version (Linux & MacOS)
139+
if: matrix.os != 'windows-latest'
140+
shell: bash
141+
run: |
142+
cxx_version = $(
143+
$CXX -dM -E -x c++ /dev/null 2>/dev/null | \
144+
grep -E '__GLIBCXX__|_LIBCPP_VERSION' | \
145+
awk '
146+
/__GLIBCXX__/ {
147+
printf("libstdcxx%s.%s.%s\n", substr($2,1,4), substr($2,5,2), substr($2,7,2))
148+
}
149+
/_LIBCPP_VERSION/ {
150+
printf("libcxx%d.%d.%d\n", substr($2,1,2)+0, substr($2,3,2)+0, substr($2,5,2)+0)
151+
}`
152+
)
153+
154+
echo "CXX_VERSION=$cxx_version" >> $GITHUB_ENV
124155
125156
- name: Define version
126157
shell: python
@@ -129,11 +160,12 @@ jobs:
129160
import tomlkit
130161
131162
architecture = os.environ.get("ARCHITECTURE", "").replace("-", "_")
163+
cxx_version = os.environ.get("CXX_VERSION", "")
132164

133165
with open("pyproject.toml", "r", encoding="utf-8") as f:
134166
doc = tomlkit.parse(f.read())
135167

136-
doc["project"]["version"] = f"{doc['project']['version']}.arch.{architecture}"
168+
doc["project"]["version"] = f"{doc['project']['version']}.{cxx_version}.arch.{architecture}"
137169

138170
with open("pyproject.toml", "w", encoding="utf-8") as f:
139171
f.write(tomlkit.dumps(doc))
@@ -151,6 +183,7 @@ jobs:
151183
path: ./dist/*.whl
152184

153185
publish:
186+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
154187
needs: build
155188
runs-on: ubuntu-latest
156189

0 commit comments

Comments
 (0)