Skip to content

Commit

Permalink
should do better with pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarter committed May 1, 2024
1 parent 0cf7ddf commit 2081885
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 41 deletions.
45 changes: 29 additions & 16 deletions .github/workflows/Publish_pyFrame3DD.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,50 @@
name: Build and upload to PyPI
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# Best comparable example: https://github.com/pdfo/pdfo

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

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- name: Setup C/C++ Compiler
- name: Install compiler
if: false == contains( matrix.os, 'windows')
id: install_cc
uses: rlalik/setup-cpp-compiler@v1.2
uses: rlalik/setup-cpp-compiler@master
with:
compiler: gcc #clang
compiler: clang

- name: Install mingw-w64 on Windows
if: contains( matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: |
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
- name: Checkout
uses: actions/checkout@v4

- name: Build wheels
- name: Build wheels mac and linux
if: false == contains( matrix.os, 'windows')
uses: pypa/[email protected]
env:
CC: '${{ steps.install_cc.outputs.cc }}'
CXX: '${{ steps.install_cc.outputs.cxx }}'
uses: pypa/[email protected]
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}

- name: Build wheels windows
if: contains( matrix.os, 'windows')
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
Expand All @@ -41,7 +54,7 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist
Expand Down
47 changes: 26 additions & 21 deletions pyframe3dd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,33 @@ py3.install_sources(
subdir: 'pyframe3dd',
)

sources = ['src/py_main.c',
'src/py_structs.h',
'src/py_io.c',
'src/py_io.h',
'src/py_frame3dd.c',
'src/py_frame3dd.h',
'src/py_eig.c',
'src/py_eig.h',
'src/py_HPGmatrix.c',
'src/py_HPGmatrix.h',
'src/coordtrans.c',
'src/coordtrans.h',
'src/HPGutil.c',
'src/HPGutil.h',
'src/NRutil.c',
'src/NRutil.h']
sources = [
'src/HPGutil.h',
'src/HPGutil.c',
'src/coordtrans.h',
'src/coordtrans.c',
'src/NRutil.h',
'src/NRutil.c',
'src/py_io.h',
'src/py_io.c',
'src/py_eig.h',
'src/py_eig.c',
'src/py_structs.h',
'src/py_HPGmatrix.h',
'src/py_HPGmatrix.c',
'src/py_frame3dd.h',
'src/py_frame3dd.c',
'src/py_main.c',
]

# We need to build a shared library NOT A PYTHON EXTENSION
# The ctypes wrapper handles the extension part.
# If the interface was done purely in C, then need the python extension.
temp = shared_library('_pyframe3dd', sources,
name_prefix: '',
include_directories: 'src',
install_dir: py3.get_install_dir() / 'pyframe3dd',
install : true)
temp = shared_library(
'_pyframe3dd',
sources,
name_prefix: '',
include_directories: ['src','src/microstran'],
install_dir: py3.get_install_dir() / 'pyframe3dd',
install : true,
)
2 changes: 1 addition & 1 deletion pyframe3dd/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC ?= clang #gcc
CFLAGS = -c -g -O2 -fPIC
CFLAGS = -c -g -O2 -fPIC -Wall

OBS = coordtrans.o HPGutil.o NRutil.o
PYOBS = py_main.o py_io.o py_frame3dd.o py_eig.o py_HPGmatrix.o
Expand Down
16 changes: 13 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "mesonpy"

[project]
name = "WISDEM-pyFrame3DD"
version = "1.1.0"
version = "1.1.1"
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"
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -116,5 +116,15 @@ atomic = true
#src_paths=isort,test

[tool.cibuildwheel]
skip = ["cp36-*", "cp37-*", "cp38-*", "*-win32"]
build-frontend = "build"
skip = ["pp*", "cp36-*", "cp37-*", "cp38-*", "*-win32", "*-win_arm64"] #, "*-musllinux*"]
build-frontend = { name = "build", args = ["-w","-n","-x"] }
before-build = "pip install numpy ninja meson meson-python"
build-verbosity = "3"

# https://github.com/pdfo/pdfo
[[tool.cibuildwheel.overrides]]
select = "*-win_amd64"
environment = { PKG_CONFIG_PATH="c:/opt/64/lib/pkgconfig" }

[tool.cibuildwheel.windows]
repair-wheel-command = "bash .github/tools/cibw_repair_wheel_command_windows.sh {wheel} {dest_dir}"

0 comments on commit 2081885

Please sign in to comment.