Skip to content

Commit 2081885

Browse files
committedMay 1, 2024·
should do better with pypi
1 parent 0cf7ddf commit 2081885

File tree

4 files changed

+69
-41
lines changed

4 files changed

+69
-41
lines changed
 

‎.github/workflows/Publish_pyFrame3DD.yml

+29-16
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,50 @@
11
name: Build and upload to PyPI
2+
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
3+
# Best comparable example: https://github.com/pdfo/pdfo
24

3-
# Build on every branch push, tag push, and pull request change:
4-
#on: [push, pull_request]
5-
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
6-
on:
7-
release:
8-
types:
9-
- published
5+
# Build on every pull request (no need for every push) and release change:
6+
on: [pull_request, release]
107

118
jobs:
129
build_wheels:
1310
name: Build wheels on ${{ matrix.os }}
1411
runs-on: ${{ matrix.os }}
1512
strategy:
13+
fail-fast: false
1614
matrix:
17-
os: [ubuntu-latest, windows-latest, macos-latest]
15+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
1816

1917
steps:
20-
- name: Setup C/C++ Compiler
18+
- name: Install compiler
19+
if: false == contains( matrix.os, 'windows')
2120
id: install_cc
22-
uses: rlalik/setup-cpp-compiler@v1.2
21+
uses: rlalik/setup-cpp-compiler@master
2322
with:
24-
compiler: gcc #clang
23+
compiler: clang
24+
25+
- name: Install mingw-w64 on Windows
26+
if: contains( matrix.os, 'windows')
27+
uses: msys2/setup-msys2@v2
28+
with:
29+
path-type: inherit
30+
install: |
31+
mingw-w64-x86_64-gcc
32+
mingw-w64-x86_64-gcc-fortran
2533
2634
- name: Checkout
2735
uses: actions/checkout@v4
2836

29-
- name: Build wheels
37+
- name: Build wheels mac and linux
38+
if: false == contains( matrix.os, 'windows')
39+
uses: pypa/cibuildwheel@v2.17.0
3040
env:
31-
CC: '${{ steps.install_cc.outputs.cc }}'
32-
CXX: '${{ steps.install_cc.outputs.cxx }}'
33-
uses: pypa/cibuildwheel@v2.16.2
41+
CC: ${{ steps.install_cc.outputs.cc }}
42+
CXX: ${{ steps.install_cc.outputs.cxx }}
3443

44+
- name: Build wheels windows
45+
if: contains( matrix.os, 'windows')
46+
uses: pypa/cibuildwheel@v2.17.0
47+
3548
- uses: actions/upload-artifact@v4
3649
with:
3750
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
@@ -41,7 +54,7 @@ jobs:
4154
name: Build source distribution
4255
runs-on: ubuntu-latest
4356
steps:
44-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
4558

4659
- name: Build sdist
4760
run: pipx run build --sdist

‎pyframe3dd/meson.build

+26-21
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,33 @@ py3.install_sources(
88
subdir: 'pyframe3dd',
99
)
1010

11-
sources = ['src/py_main.c',
12-
'src/py_structs.h',
13-
'src/py_io.c',
14-
'src/py_io.h',
15-
'src/py_frame3dd.c',
16-
'src/py_frame3dd.h',
17-
'src/py_eig.c',
18-
'src/py_eig.h',
19-
'src/py_HPGmatrix.c',
20-
'src/py_HPGmatrix.h',
21-
'src/coordtrans.c',
22-
'src/coordtrans.h',
23-
'src/HPGutil.c',
24-
'src/HPGutil.h',
25-
'src/NRutil.c',
26-
'src/NRutil.h']
11+
sources = [
12+
'src/HPGutil.h',
13+
'src/HPGutil.c',
14+
'src/coordtrans.h',
15+
'src/coordtrans.c',
16+
'src/NRutil.h',
17+
'src/NRutil.c',
18+
'src/py_io.h',
19+
'src/py_io.c',
20+
'src/py_eig.h',
21+
'src/py_eig.c',
22+
'src/py_structs.h',
23+
'src/py_HPGmatrix.h',
24+
'src/py_HPGmatrix.c',
25+
'src/py_frame3dd.h',
26+
'src/py_frame3dd.c',
27+
'src/py_main.c',
28+
]
2729

2830
# We need to build a shared library NOT A PYTHON EXTENSION
2931
# The ctypes wrapper handles the extension part.
3032
# If the interface was done purely in C, then need the python extension.
31-
temp = shared_library('_pyframe3dd', sources,
32-
name_prefix: '',
33-
include_directories: 'src',
34-
install_dir: py3.get_install_dir() / 'pyframe3dd',
35-
install : true)
33+
temp = shared_library(
34+
'_pyframe3dd',
35+
sources,
36+
name_prefix: '',
37+
include_directories: ['src','src/microstran'],
38+
install_dir: py3.get_install_dir() / 'pyframe3dd',
39+
install : true,
40+
)

‎pyframe3dd/src/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CC ?= clang #gcc
2-
CFLAGS = -c -g -O2 -fPIC
2+
CFLAGS = -c -g -O2 -fPIC -Wall
33

44
OBS = coordtrans.o HPGutil.o NRutil.o
55
PYOBS = py_main.o py_io.o py_frame3dd.o py_eig.o py_HPGmatrix.o

‎pyproject.toml

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "mesonpy"
44

55
[project]
66
name = "WISDEM-pyFrame3DD"
7-
version = "1.1.0"
7+
version = "1.1.1"
88
description = "Python bindings to Frame3DD, a code for static and dynamic structural analysis of 2D and 3D frames and trusses, with permission from Prof Henri Gavin"
99
readme = "README.md"
1010
requires-python = ">=3.9"
@@ -116,5 +116,15 @@ atomic = true
116116
#src_paths=isort,test
117117

118118
[tool.cibuildwheel]
119-
skip = ["cp36-*", "cp37-*", "cp38-*", "*-win32"]
120-
build-frontend = "build"
119+
skip = ["pp*", "cp36-*", "cp37-*", "cp38-*", "*-win32", "*-win_arm64"] #, "*-musllinux*"]
120+
build-frontend = { name = "build", args = ["-w","-n","-x"] }
121+
before-build = "pip install numpy ninja meson meson-python"
122+
build-verbosity = "3"
123+
124+
# https://github.com/pdfo/pdfo
125+
[[tool.cibuildwheel.overrides]]
126+
select = "*-win_amd64"
127+
environment = { PKG_CONFIG_PATH="c:/opt/64/lib/pkgconfig" }
128+
129+
[tool.cibuildwheel.windows]
130+
repair-wheel-command = "bash .github/tools/cibw_repair_wheel_command_windows.sh {wheel} {dest_dir}"

0 commit comments

Comments
 (0)
Please sign in to comment.