Skip to content

Commit 560072f

Browse files
Merged fixes and updated bindings for changes in libraries.
1 parent e47dd33 commit 560072f

File tree

3 files changed

+64
-49
lines changed

3 files changed

+64
-49
lines changed

.github/workflows/build_wheels.yml

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Build wheels
22

3-
on: [push, pull_request]
4-
5-
# Cannot use cibuildwheels because the current images used by cibuildwheels do not support C++17.
3+
on: [push, pull_request]
64

75
jobs:
86
build_wheels_windows:
@@ -11,21 +9,17 @@ jobs:
119
env:
1210
TEMP: C:\Temp
1311
TMP: C:\Temp
14-
12+
1513
strategy:
1614
matrix:
1715
os: [windows-2022]
1816
arch: [x86, x64]
19-
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2018

21-
steps:
19+
steps:
2220
- name: Support longpaths
2321
run: git config --system core.longpaths true
24-
25-
- name: Check LongPathsEnabled
26-
run: |
27-
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
28-
22+
2923
- name: Checkout repository
3024
uses: actions/checkout@v4
3125

@@ -37,28 +31,24 @@ jobs:
3731

3832
- name: Install packages
3933
run: |
40-
pip install wheel
41-
pip install setuptools
42-
pip install build
34+
pip install wheel setuptools build
4335
4436
- name: build
4537
run: python -m build
4638

4739
- name: upload wheels
48-
uses: actions/upload-artifact@v3
40+
uses: actions/upload-artifact@v4
4941
with:
42+
name: wheels-windows-${{ matrix.python-version }}-${{ matrix.arch }}-${{ github.run_id }}
5043
path: ./dist/*.whl
51-
44+
5245
build_wheels_mac:
5346
name: ${{ matrix.os }} ${{ matrix.python-version }} wheels
5447
runs-on: ${{ matrix.os }}
5548
strategy:
5649
matrix:
57-
# Trying to use cibuildwheels to build mac wheels fails because the version of XCode is not high enough.
58-
# There is documentation here https://github.com/pypa/cibuildwheel/blob/main/docs/cpp_standards.md on how to
59-
# set it but I could not get it to work while using the standard images provided by github actions does work.
6050
os: [macos-latest, macos-13]
61-
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
51+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
6252
env:
6353
SYSTEM_VERSION_COMPAT: 0
6454

@@ -73,25 +63,25 @@ jobs:
7363

7464
- name: Install packages
7565
run: |
76-
pip install wheel
77-
pip install setuptools
78-
pip install build
66+
pip install wheel setuptools build
7967
8068
- name: build
8169
run: python -m build
8270

8371
- name: upload wheels
84-
uses: actions/upload-artifact@v3
72+
uses: actions/upload-artifact@v4
8573
with:
74+
name: wheels-macos-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_id }}
8675
path: ./dist/*.whl
87-
76+
77+
8878
build_wheels_manylinux_x86_64:
89-
name: Build manylinux wheels
79+
name: Build manylinux wheels (x86_64)
9080
runs-on: ubuntu-24.04
9181
steps:
9282
- name: Checkout repository
9383
uses: actions/checkout@v4
94-
84+
9585
- name: Install cibuildwheel
9686
run: |
9787
python -m pip install --upgrade pip
@@ -102,44 +92,59 @@ jobs:
10292
CIBW_PLATFORM: "linux"
10393
CIBW_SKIP: "cp36-* cp37-* cp38-*"
10494
CIBW_ARCHS_LINUX: "x86_64"
95+
CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_28_x86_64"
96+
CIBW_BUILD_VERBOSITY: 3 # Enable detailed logging
10597
run: |
10698
cibuildwheel --output-dir wheelhouse
107-
99+
108100
- name: upload wheels
109-
uses: actions/upload-artifact@v3
101+
uses: actions/upload-artifact@v4
110102
with:
103+
name: wheels-linux-x86_64-${{ github.run_id }}
111104
path: wheelhouse/*.whl
112-
105+
113106
build_wheels_manylinux_arm64:
114-
name: Build manylinux wheels ${{ matrix.python-version }} (arm64)
107+
name: Build manylinux wheels (ARM64)
115108
runs-on: ubuntu-24.04
116109
strategy:
117110
matrix:
118111
python-version: ["cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"]
119112
steps:
120113
- name: Checkout repository
121114
uses: actions/checkout@v4
122-
115+
123116
# Register QEMU for cross-architecture emulation
124117
- name: Set up QEMU for cross-compilation
125118
uses: docker/setup-qemu-action@v2
126119
with:
127-
platforms: arm64
128-
120+
platforms: all # Ensures ARM64 is fully supported
121+
122+
- name: Debug - Test ManyLinux Container
123+
run: |
124+
echo "Testing uname -a inside the container..."
125+
docker run --rm --platform linux/aarch64 quay.io/pypa/manylinux_2_28_aarch64 uname -a
126+
127+
echo "Testing Python inside the container..."
128+
docker run --rm --platform linux/aarch64 quay.io/pypa/manylinux_2_28_aarch64 python3 --version
129+
129130
- name: Install cibuildwheel
130131
run: |
131132
python -m pip install --upgrade pip
132133
pip install cibuildwheel
133-
134+
134135
- name: Build wheels with cibuildwheel
135136
env:
136137
CIBW_PLATFORM: "linux"
137138
CIBW_BUILD: ${{ matrix.python-version }}
138139
CIBW_ARCHS_LINUX: "aarch64"
140+
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_28_aarch64"
141+
CIBW_ENVIRONMENT: "CXXFLAGS='-g -O2 -fno-omit-frame-pointer'"
142+
CIBW_BUILD_VERBOSITY: 3
139143
run: |
140144
cibuildwheel --output-dir wheelhouse
141-
145+
142146
- name: upload wheels
143-
uses: actions/upload-artifact@v3
147+
uses: actions/upload-artifact@v4
144148
with:
145-
path: wheelhouse/*.whl
149+
name: wheels-linux-arm64-${{ matrix.python-version }}-${{ github.run_id }}
150+
path: wheelhouse/*.whl

pywincalc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import deprecation
33

44
from wincalcbindings import (
5-
AirHorizontalDirection, BSDF, BSDFBasisType, BSDFDirection, BSDFDirections, BSDFHemisphere,
5+
AirHorizontalDirection, BSDF, BSDFBasisType, BSDFDirection, BSDFDirections, BSDFDefinition, BSDFHemisphere,
66
BSDFIntegrator, BoundaryConditionsCoefficientModelType, CMABestWorstUFactors, CMAResult, CMAWindow,
77
CMAWindowDualVisionHorizontal, CMAWindowDualVisionVertical, CMAWindowSingleVision, Layers, CellSpacingType, PolygonType, pillar_cell_area,
88
PillarData, CylindricalPillar, SphericalPillar, RectangularPillar, TriangularPillar, PentagonPillar, HexagonPillar, LinearBearingPillar, TruncatedConePillar, Glass, PillarMeasurement,

src/wincalcbindings.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,17 +1099,27 @@ PYBIND11_MODULE(wincalcbindings, m) {
10991099
.value("HALF", SingleLayerOptics::BSDFBasis::Half)
11001100
.value("FULL", SingleLayerOptics::BSDFBasis::Full);
11011101

1102+
py::class_<SingleLayerOptics::BSDFDefinition>(m, "BSDFDefinition")
1103+
.def(py::init<double, size_t>(),
1104+
py::arg("theta"), py::arg("number_of_phis"))
1105+
.def("theta", &SingleLayerOptics::BSDFDefinition::theta)
1106+
.def("num_of_phis", &SingleLayerOptics::BSDFDefinition::numOfPhis);
1107+
11021108
py::class_<SingleLayerOptics::BSDFHemisphere>(m, "BSDFHemisphere")
11031109
.def_static("create",
11041110
py::overload_cast<SingleLayerOptics::BSDFBasis>(
11051111
&SingleLayerOptics::BSDFHemisphere::create),
11061112
py::arg("bsdf_basis"))
1113+
.def_static("create",
1114+
py::overload_cast<std::vector<SingleLayerOptics::BSDFDefinition> const &>(
1115+
&SingleLayerOptics::BSDFHemisphere::create),
1116+
py::arg("bsdf_definitions"))
11071117
.def("get_directions", &SingleLayerOptics::BSDFHemisphere::getDirections);
11081118

11091119
py::enum_<Tarcog::ISO15099::System>(m, "TarcogSystemType", py::arithmetic())
11101120
.value("U", Tarcog::ISO15099::System::Uvalue)
11111121
.value("SHGC", Tarcog::ISO15099::System::SHGC);
1112-
1122+
11131123
py::enum_<Tarcog::ISO15099::Environment>(m, "TarcogEnvironmentType", py::arithmetic())
11141124
.value("Indoor", Tarcog::ISO15099::Environment::Indoor)
11151125
.value("Outdoor", Tarcog::ISO15099::Environment::Outdoor);
@@ -1228,15 +1238,15 @@ PYBIND11_MODULE(wincalcbindings, m) {
12281238
py::arg("system_type"), py::arg("theta") = 0, py::arg("phi") = 0)
12291239
.def("relative_heat_gain", &wincalc::Glazing_System::relative_heat_gain,
12301240
py::arg("theta") = 0, py::arg("phi") = 0)
1231-
.def("heat_flow",
1232-
&wincalc::Glazing_System::heat_flow,
1233-
py::arg("system_type"), py::arg("environment_type"), py::arg("theta") = 0, py::arg("phi") = 0)
1234-
.def("h",
1235-
&wincalc::Glazing_System::h,
1236-
py::arg("system_type"), py::arg("environment_type"), py::arg("theta") = 0, py::arg("phi") = 0)
1237-
.def("radiosities",
1238-
&wincalc::Glazing_System::radiosities,
1239-
py::arg("system_type"), py::arg("theta") = 0, py::arg("phi") = 0)
1241+
.def("heat_flow",
1242+
&wincalc::Glazing_System::heat_flow,
1243+
py::arg("system_type"), py::arg("environment_type"), py::arg("theta") = 0, py::arg("phi") = 0)
1244+
.def("h",
1245+
&wincalc::Glazing_System::h,
1246+
py::arg("system_type"), py::arg("environment_type"), py::arg("theta") = 0, py::arg("phi") = 0)
1247+
.def("radiosities",
1248+
&wincalc::Glazing_System::radiosities,
1249+
py::arg("system_type"), py::arg("theta") = 0, py::arg("phi") = 0)
12401250
.def("environments",
12411251
py::overload_cast<wincalc::Environments const &>(
12421252
&wincalc::Glazing_System::environments),

0 commit comments

Comments
 (0)