Skip to content

Commit 7096014

Browse files
committed
Change GitHub build process and switch to clang on MacOSX
1 parent f7b835b commit 7096014

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

.github/workflows/build_test.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,67 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
12-
include:
13-
- os: macos-15-intel
14-
c_compiler: gcc-15
15-
- os: macos-latest
16-
c_compiler: gcc-15
11+
os:
12+
- ubuntu-latest
13+
- windows-latest
14+
- macos-15-intel
15+
- macos-15
1716

1817
steps:
1918
- uses: actions/checkout@v4
2019

21-
# Used to host cibuildwheel
2220
- uses: actions/setup-python@v5
2321
with:
2422
python-version: "3.11"
2523

26-
- name: Install gcc on macOS
27-
if: runner.os == 'macOS'
28-
run: brew install gcc@15
29-
3024
- name: Install libomp on macOS
3125
if: runner.os == 'macOS'
3226
run: brew install libomp
3327

28+
- name: Export libomp paths on macOS
29+
if: runner.os == 'macOS'
30+
run: |
31+
echo "LIBOMP_PREFIX=$(brew --prefix libomp)" >> "$GITHUB_ENV"
32+
3433
- name: Install cibuildwheel
3534
run: python -m pip install cibuildwheel
3635

3736
- name: Build wheels
3837
env:
39-
CIBW_ENVIRONMENT_MACOS: CC=gcc-15 MACOSX_DEPLOYMENT_TARGET=26.0
38+
CIBW_ENVIRONMENT_LINUX: >-
39+
CFLAGS=-fopenmp
40+
CXXFLAGS=-fopenmp
41+
LDFLAGS=-fopenmp
42+
CIBW_ENVIRONMENT_WINDOWS: >-
43+
CL=/openmp
44+
CIBW_ENVIRONMENT_MACOS: >-
45+
CC=clang
46+
CXX=clang++
47+
MACOSX_DEPLOYMENT_TARGET=15.0
48+
CPPFLAGS=-I${{ env.LIBOMP_PREFIX }}/include
49+
CFLAGS=-Xpreprocessor\ -fopenmp
50+
CXXFLAGS=-Xpreprocessor\ -fopenmp
51+
LDFLAGS=-L${{ env.LIBOMP_PREFIX }}/lib\ -Wl,-rpath,${{ env.LIBOMP_PREFIX }}/lib\ -lomp
4052
run: python -m cibuildwheel --output-dir wheelhouse
4153

42-
- name: Test on all platforms except MacOS
54+
- name: Test on all platforms except macOS
4355
if: runner.os != 'macOS'
4456
run: |
4557
python -m pip install -r REQUIREMENTS.txt
4658
python -m pip install -e .
4759
python -m pip install -r REQUIREMENTS-DEV.txt
4860
pytest -v
4961
50-
- name: Test on MacOS
62+
- name: Test on macOS
5163
if: runner.os == 'macOS'
5264
env:
53-
CC: gcc-15
65+
CC: clang
66+
CXX: clang++
67+
MACOSX_DEPLOYMENT_TARGET: "15.0"
68+
CPPFLAGS: -I${{ env.LIBOMP_PREFIX }}/include
69+
CFLAGS: -Xpreprocessor -fopenmp
70+
CXXFLAGS: -Xpreprocessor -fopenmp
71+
LDFLAGS: -L${{ env.LIBOMP_PREFIX }}/lib -Wl,-rpath,${{ env.LIBOMP_PREFIX }}/lib -lomp
5472
run: |
5573
python -m pip install -r REQUIREMENTS.txt
5674
python -m pip install -e .

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "numpy"]
2+
requires = ["setuptools", "wheel", "numpy"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -45,7 +45,7 @@ find = {}
4545

4646
[tool.setuptools]
4747
ext-modules = [
48-
{name = "epanet", extra-compile-args = ["-fopenmp"], extra-link-args = ["-fopenmp"], include-dirs=["epanet-src/include", "epanet-src/", "epanet-msx-src/include", "epanet-msx-src/",
48+
{name = "epanet", include-dirs=["epanet-src/include", "epanet-src/", "epanet-msx-src/include", "epanet-msx-src/",
4949
"python-extension", "epanet_plus/include", "epanet-src/util"], sources = ["python-extension/pyepanet.c",
5050
"python-extension/pyepanet2.c", "python-extension/pyepanetmsx.c", "python-extension/pyepanet_plus.c",
5151
"python-extension/ext.c", "epanet_plus/epanet_plus.c", "epanet-src/epanet2.c", "epanet-src/hydcoeffs.c",

0 commit comments

Comments
 (0)