Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 39 additions & 63 deletions .github/workflows/dist_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@ jobs:
with:
path: llvm/install
# TODO: would be really better to add the hash of the LLVM commit cloned
# TODO: add "14.16" as a variable easy to replace
key: ${{ runner.os }}-llvm-release-13-msvc1416
key: ${{ runner.os }}-llvm-release-13-msvc
- name: Get LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: 'llvm/llvm-project'
repository: 'aguinet/llvm-project'
ref: 'release/13.x'
path: 'llvm'
- uses: ilammy/msvc-dev-cmd@v1
if: steps.cache-llvm.outputs.cache-hit != 'true'
with:
toolset: "14.16"
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
Expand All @@ -47,104 +44,82 @@ jobs:
strategy:
matrix:
include:
- tag: "manylinux2010_x86_64"
docker_host: quay.io/pypa
- tag: "manylinux2010_i686"
docker_host: quay.io/pypa
- tag: "manylinux2014_aarch64_cross_x64"
docker_host: aguinet
runs-on: ubuntu-latest
- image: "manylinux_2_28_x86_64"
runs: ubuntu-24.04
- image: "manylinux_2_28_aarch64"
runs: ubuntu-24.04-arm
runs-on: ${{ matrix.runs }}
steps:
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm/install
key: ${{ runner.os }}-llvm-release-13-${{ matrix.tag }}
key: ${{ runner.os }}-llvm-release-13-${{ matrix.image }}-00
- uses: actions/checkout@v2
if: steps.cache-llvm.outputs.cache-hit != 'true'
- name: Get LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: 'llvm/llvm-project'
repository: 'aguinet/llvm-project'
ref: 'release/13.x'
path: 'llvm'
- name: Set up QEMU
if: matrix.tag == 'manylinux2014_aarch64_cross_x64' && steps.cache-llvm.outputs.cache-hit != 'true'
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Setup AArch64 environment
if: matrix.tag == 'manylinux2014_aarch64_cross_x64' && steps.cache-llvm.outputs.cache-hit != 'true'
run: |
echo "DOCKER_OPTS=--env CC=/opt/native/bin/clang --env CXX=/opt/native/bin/clang++ --env CMAKE_BIN=/opt/native/bin/cmake --env LDFLAGS=-fuse-ld=lld" >>$GITHUB_ENV
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
docker run $DOCKER_OPTS -v $GITHUB_WORKSPACE:/pwd "${{ matrix.docker_host }}/${{ matrix.tag }}" /bin/bash /pwd/ci/build_llvm_manylinux.sh /pwd/llvm
docker run -v $GITHUB_WORKSPACE:/pwd "quay.io/pypa/${{ matrix.image }}" /bin/bash /pwd/ci/build_llvm_manylinux.sh /pwd/llvm

build_manylinux:
runs-on: ubuntu-latest
needs: build_llvm_manylinux

# Split into multiple jobs to speed up the process. Let's compile two
# Python versions per job.
strategy:
matrix:
tag:
- "manylinux2010_x86_64"
- "manylinux2010_i686"
- "manylinux2014_aarch64_cross_x64"
- image: "manylinux_2_28_x86_64"
runs: ubuntu-24.04
- image: "manylinux_2_28_aarch64"
runs: ubuntu-24.04-arm
py_vers:
- "cp36-cp36m cp37-cp37m"
- "cp38-cp38 cp39-cp39"
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
exclude:
- tag: "manylinux2014_aarch64_cross_x64"
py_vers: "cp310-cp310"
- "cp311-cp311"
- "cp312-cp312"
- "cp313-cp313"

env:
PY_VERS: ${{ matrix.py_vers }}

runs-on: ${{ matrix.tag.runs }}
container:
image: quay.io/pypa/${{ matrix.tag.image }}

steps:
- uses: actions/checkout@v2
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm/install
key: Linux-llvm-release-13-${{ matrix.tag }}
- name: Set up QEMU
if: matrix.tag == 'manylinux2014_aarch64_cross_x64'
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Setup AArch64 environment
if: matrix.tag == 'manylinux2014_aarch64_cross_x64'
run: |
echo "DOCKER_OPTS=--env CC=/opt/native/bin/clang --env CXX=/opt/native/bin/clang++ --env CMAKE_BIN=/opt/native/bin/cmake --env LDFLAGS=-fuse-ld=lld" >>$GITHUB_ENV
key: Linux-llvm-release-13-${{ matrix.tag.image }}-00
- name: Build wheels & tests
working-directory: bindings/python
run: |
[[ ${{ matrix.tag}} == "manylinux2014_aarch64_cross_x64" ]] && DOCKER_ROOT=aguinet || DOCKER_ROOT=quay.io/pypa
docker run $DOCKER_OPTS -v $GITHUB_WORKSPACE:/pwd "$DOCKER_ROOT/${{ matrix.tag }}" /bin/bash /pwd/ci/build_wheels_manylinux.sh /pwd /pwd/llvm/install $PY_VERS
- uses: actions/upload-artifact@v1
/bin/bash ./ci/build_wheels_manylinux.sh "$PWD" "${PWD}/llvm/install" $PY_VERS
- uses: actions/upload-artifact@v4
with:
name: pydffi-wheels
name: pydffi-wheels-linux-${{ matrix.tag.image }}-${{ matrix.py_vers }}
path: bindings/python/wheelhouse/

build_osxwin:

strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os:
- macos-latest
#- macos-latest
- windows-latest

runs-on: ${{ matrix.os }}
Expand All @@ -153,8 +128,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand All @@ -166,22 +139,25 @@ jobs:
uses: actions/cache@v2
with:
path: llvm/install
key: ${{ runner.os }}-llvm-release-13-msvc1416
key: ${{ runner.os }}-llvm-release-13-msvc
- name: Python dependencies
run: |
pip install wheel
pip install wheel setuptools
- name: Install Windows dependencies
run: |
choco install ninja
choco install --accept-license ninja
echo LLVM_CONFIG=%GITHUB_WORKSPACE%/llvm/install/bin/llvm-config.exe >> %GITHUB_ENV%
echo MSSdk=1 >> %GITHUB_ENV%
echo DISTUTILS_USE_SDK=1 >> %GITHUB_ENV%
if: runner.os == 'Windows'
shell: cmd
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.1.1
if: runner.os == 'macOS'
- name: Install OSX dependencies
run: |
brew install cmake ninja
sudo $CONDA/bin/conda install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
sudo conda install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
echo "LLVM_CONFIG=$CONDA/bin/llvm-config" >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Build wheel
Expand All @@ -204,9 +180,9 @@ jobs:
# use the generated wheel for tests.
pip install six purectypes==0.2
python -m unittest discover bindings/python/tests
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: pydffi-wheels
name: pydffi-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: bindings/python/dist/

publish:
Expand All @@ -218,7 +194,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.10
- name: Install dependencies
run: |
pip install twine
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ on:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
Expand All @@ -22,18 +22,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
# Github's ubuntu 18 docker image provides broken clang/llvm 8
# packages from whatever sources...
# Remove the mess it has, purge every thing we don't need from
# sources.list and reinstall the proper and clean clang/llvm packages
# from ubuntu 18.
sudo apt-get purge clang-8 llvm-8-dev libclang1-8 llvm-8 llvm-8-runtime libclang-common-8-dev llvm-8-dev libllvm8 liblldb-8
sudo rm /etc/apt/sources.list.d/*
echo "deb http://archive.ubuntu.com/ubuntu bionic main multiverse restricted universe" | sudo tee /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe" | sudo tee -a /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe " | sudo tee -a /etc/apt/sources.list
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main" | sudo tee -a /etc/apt/sources.list
curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update && sudo apt-get install -y clang-13 llvm-13-tools llvm-13-dev libclang-13-dev ninja-build cmake libarchive-dev libfftw3-dev
python -m pip install lit
python -m pip install purectypes==0.2 six
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/osx.yml → .github/workflows/osx.yml.dis
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ jobs:
runs-on: macOS-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.1.1
- name: Install system dependencies
run: |
brew install cmake ninja
sudo $CONDA/bin/conda install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
python -m pip install --upgrade pip
sudo conda install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
python -m pip install --upgrade pip setuptools
python -m pip install lit purectypes==0.2 six psutil
mkdir build
- name: CMake
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/win.yml → .github/workflows/win.yml.dis
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Disabled because the conda llvm 13 package is broken. Tests are done with the
# compiled wheel...

name: Tests Windows


on:
push:
branches:
Expand All @@ -12,30 +16,30 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.1.1
- name: Install system dependencies
run: |
choco install ninja
C:\Miniconda\condabin\conda.bat activate base
C:\Miniconda\condabin\conda.bat update -c conda-forge python
C:\Miniconda\condabin\conda.bat install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
choco install --accept-license ninja
conda activate base
conda update -c conda-forge python
conda install -c conda-forge llvmdev==13.0.0 clangdev==13.0.0
python -m pip install --upgrade pip
python -m pip install lit purectypes==0.2 six
python -m pip install lit purectypes==0.2 six setuptools
mkdir build
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: CMake + build
working-directory: build
run: |
cmake -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DPYTHON_BINDINGS=ON -DBUILD_TESTS=ON -DLLVM_CONFIG=C:/Miniconda/Library/bin/llvm-config.exe -DCMAKE_BUILD_TYPE=release -DCMAKE_PREFIX_PATH="C:/Miniconda/Library/lib/" -G Ninja ..
cmake -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DPYTHON_BINDINGS=ON -DBUILD_TESTS=ON -DLLVM_CONFIG=C:/Miniconda/condabin/llvm-config.exe -DCMAKE_BUILD_TYPE=release -DCMAKE_PREFIX_PATH="C:/Miniconda/Library/lib/" -G Ninja ..
ninja
- name: Native & Python tests
working-directory: build
Expand Down
9 changes: 4 additions & 5 deletions ci/build_llvm_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")

cd $1

mkdir build
mkdir install
cd build

if [ $(uname -m) == "aarch64" ]; then
TARGET="AArch64"
CMAKE_OPTS=-DLLVM_USE_LINKER=lld
else
TARGET="X86"
fi

mkdir build
mkdir install
cd build

$CMAKE_BIN ../llvm/ \
-DLLVM_BUILD_EXAMPLES=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
Expand Down
1 change: 1 addition & 0 deletions ci/build_wheels_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export MAKEFLAGS="-j$(nproc)"

cd "$DFFI/bindings/python"
for PY in $*; do
/opt/python/$PY/bin/pip install setuptools
/opt/python/$PY/bin/python ./setup.py bdist_wheel
rm -rf build
done
Expand Down
18 changes: 2 additions & 16 deletions ci/install_cmake_manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,10 @@
set -ex

function cmake_install {
local CMAKE_VERSION="3.18.3"
local CMAKE_FILE="cmake-${CMAKE_VERSION}-Linux-$(uname -m).tar.gz"
cd /tmp
if [ $(uname -m) == "x86_64" ]; then
local URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}"
echo "eb23bac95873cc0bc3946eed5d1aea6876ac03f7c0dcc6ad3a05462354b08228 cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" >cmake.sha
else
local URL="https://files.geekou.info"
echo "ae54e46bcd5a5bc81be330c4ebeabbf3c0c09fd775d28e394a58a18aba52492a cmake-${CMAKE_VERSION}-Linux-$(uname -m).tar.gz" >cmake.sha
fi
curl -sSL $URL/${CMAKE_FILE} -O
sha256sum -c cmake.sha
tar -C /opt -xf "${CMAKE_FILE}"
ln -s /opt/cmake* /opt/cmake
rm "${CMAKE_FILE}" cmake.sha
yum install -y cmake
}

if [ ! -f "$CMAKE_BIN" ]; then
cmake_install
export CMAKE_BIN=/opt/cmake/bin/cmake
export CMAKE_BIN=/usr/bin/cmake
fi
2 changes: 2 additions & 0 deletions lib/dffi_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ unsigned BasicType::getAlign() const
#endif
}
assert(false && "unhandled basic type!");
return 0;
}

uint64_t BasicType::getSize() const
Expand Down Expand Up @@ -157,6 +158,7 @@ uint64_t BasicType::getSize() const
#endif
}
assert(false && "unhandled basic type!");
return 0;
}

FunctionType::FunctionType(details::DFFIImpl& Dffi, QualType RetTy, ParamsVecTy ParamsTy, CallingConv CC, bool VarArgs, bool UseLastError):
Expand Down
Loading
Loading