Skip to content

Commit d3fbc68

Browse files
author
Bot
committed
Test cibuildwheel Github workflow
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent 15fada7 commit d3fbc68

4 files changed

Lines changed: 47 additions & 17 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
#os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]
12+
os: [ubuntu-latest]
13+
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
# Used to host cibuildwheel
18+
- uses: actions/setup-python@v5
19+
20+
- name: Install cibuildwheel
21+
run: python -m pip install cibuildwheel
22+
23+
- name: Build wheels
24+
run: python -m cibuildwheel --output-dir wheelhouse
25+
env:
26+
CIBW_BUILD: cp314-manylinux_x86_64
27+
CIBW_BUILD_VERBOSITY: 3
28+
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ include(FetchContent)
6464
########################################
6565
# python
6666

67-
find_package(Python ${PY_VERSION} EXACT REQUIRED COMPONENTS Development)
67+
find_package(Python ${PY_VERSION} EXACT COMPONENTS Interpreter Development.Module REQUIRED)
6868

6969
# Some of our files are partially generated from CPython source, and they
7070
# expect to be able to include files relative to Include/internal.

cinderx/Jit/perf_jitdump.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ const size_t kJitdumpMmapSize = 1;
6161
// C++-friendly wrapper around strerror_r().
6262
std::string string_error(int errnum) {
6363
char buf[1024];
64-
// There's two forms of strerror_r(), one that returns a string and one that
65-
// returns an int.
66-
#if __APPLE__
67-
strerror_r(errnum, buf, sizeof(buf));
68-
return std::string{buf};
69-
#else
70-
return strerror_r(errnum, buf, sizeof(buf));
71-
#endif
64+
// This template trick detects the return type of strerror_r at compile time.
65+
// If it returns char*, we're using GNU version. If it returns int, POSIX.
66+
if constexpr (std::is_same_v<decltype(strerror_r(0, buf, 0)), char*>) {
67+
// GNU version: returns char* (possibly pointing to a static string)
68+
return strerror_r(errnum, buf, sizeof(buf));
69+
} else {
70+
// POSIX version: returns int, writes to buffer
71+
strerror_r(errnum, buf, sizeof(buf));
72+
return std::string{buf};
73+
}
7274
}
7375

7476
class FileLock {

setup.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ def _run_cmake(self, extension: CMakeExtension) -> None:
119119
extension_dir = os.path.abspath(self.get_ext_fullpath(extension.name))
120120
os.makedirs(extension_dir, exist_ok=True)
121121

122-
cc = self._find_binary("clang")
123-
cxx = self._find_binary("clang++")
122+
# Prefer Clang because that's what we develop against but some systems
123+
# including the manylinux build environment only have GCC.
124+
cc = shutil.which("clang") or shutil.which("gcc")
125+
cxx = shutil.which("clang++") or shutil.which("g++")
124126

125127
build_type = os.environ.get("CMAKE_BUILD_TYPE", "RelWithDebInfo")
126128
cmake_args = [
@@ -184,12 +186,6 @@ def set_option(var: str, default: object) -> None:
184186
self.spawn(["cmake"] + cmake_args + ["-B", build_dir, CHECKOUT_ROOT_DIR])
185187
self.spawn(["cmake", "--build", build_dir] + build_args)
186188

187-
def _find_binary(self, name: str) -> str:
188-
result = shutil.which(name)
189-
if result is None:
190-
raise RuntimeError(f"Cannot find `{name}` binary")
191-
return result
192-
193189
def _find_python(self) -> str:
194190
# Normally this would use "data", but that goes to a temporary build directory
195191
# under uv. Work off of the include directory instead.

0 commit comments

Comments
 (0)