Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize build system #105

Merged
merged 1 commit into from
Aug 10, 2023
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
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
BUILD_TYPE: Release
HAMMING_WITH_AVX2: OFF
Expand All @@ -20,24 +24,30 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
open-mp: "ON"
- os: macos-latest
open-mp: "OFF"
- os: windows-latest
open-mp: "OFF"

steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"

- name: enable openmp on linux
run: echo "HAMMING_WITH_OPENMP=ON" >> $GITHUB_ENV
if: runner.os == 'Linux'
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: make build directory
run: cmake -E make_directory ${{runner.workspace}}/build

- name: configure cmake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=ON -DHAMMING_BUILD_BENCHMARKS=ON -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=$HAMMING_WITH_AVX2 -DHAMMING_WITH_AVX512=$HAMMING_WITH_AVX512 -DHAMMING_BUILD_PYTHON=ON -DHAMMING_WITH_OPENMP=$HAMMING_WITH_OPENMP
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=ON -DHAMMING_BUILD_BENCHMARKS=ON -DHAMMING_WITH_SSE2=ON -DHAMMING_WITH_AVX2=$HAMMING_WITH_AVX2 -DHAMMING_WITH_AVX512=$HAMMING_WITH_AVX512 -DHAMMING_BUILD_PYTHON=ON -DHAMMING_WITH_OPENMP=${{ matrix.open-mp }}

- name: build
shell: bash
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ on:
release:
types: [published]

concurrency:
group: wheels-${{ github.ref }}
cancel-in-progress: true

jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_TEST_REQUIRES: "pytest numpy"
CIBW_TEST_COMMAND: "pytest {project}/python/tests -v"
CIBW_TEST_SKIP: "pp* *-musllinux*"
CIBW_ENVIRONMENT: "BLAS=None LAPACK=None ATLAS=None"
CIBW_SKIP: "*-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3

strategy:
matrix:
Expand All @@ -30,11 +27,7 @@ jobs:
with:
submodules: "recursive"

- name: enable openmp on linux
run: echo 'CIBW_ENVIRONMENT=HAMMING_WITH_OPENMP=ON' >> $GITHUB_ENV
if: runner.os == 'Linux'

- uses: pypa/[email protected]
- uses: pypa/[email protected]

- uses: actions/upload-artifact@v3
with:
Expand Down
20 changes: 8 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@ repos:
hooks:
- id: black

- repo: https://github.com/dfm/black_nbconvert
rev: v0.4.0
hooks:
- id: black_nbconvert

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
additional_dependencies: [pyyaml==5.4.1]

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
additional_dependencies: [pyyaml]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
rev: v3.0.1
hooks:
- id: prettier

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.22.0
hooks:
- id: check-github-workflows
- id: check-readthedocs
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.11)
cmake_minimum_required(VERSION 3.11..3.26)

project(
hammingdist
VERSION 0.19.0
VERSION 0.20.0
LANGUAGES CXX)

include(CTest)
Expand Down
2 changes: 1 addition & 1 deletion ext/benchmark
Submodule benchmark updated 128 files
2 changes: 1 addition & 1 deletion ext/cpu_features
Submodule cpu_features updated 59 files
+4 −4 .dockerignore
+6 −4 .github/workflows/aarch64_linux_cmake.yml
+3 −3 .github/workflows/amd64_freebsd_cmake.yml
+0 −31 .github/workflows/amd64_linux.yml
+26 −0 .github/workflows/amd64_linux_bazel.yml
+31 −0 .github/workflows/amd64_linux_cmake.yml
+1 −1 .github/workflows/amd64_macos_cmake.yml
+1 −1 .github/workflows/amd64_windows_cmake.yml
+4 −4 .github/workflows/arm_linux_cmake.yml
+4 −4 .github/workflows/mips_linux_cmake.yml
+29 −0 .github/workflows/power_linux_cmake.yml
+28 −0 .github/workflows/riscv_linux_cmake.yml
+27 −0 .github/workflows/s390x_linux_cmake.yml
+21 −0 .grenrc.yml
+20 −21 BUILD.bazel
+15 −3 CMakeLists.txt
+76 −32 README.md
+7 −11 WORKSPACE
+5 −0 bazel/ci/README.md
+0 −66 ci/README.md
+1 −1 cmake/README.md
+15 −3 cmake/ci/Makefile
+40 −0 cmake/ci/README.md
+0 −0 cmake/ci/doc/docker.dot
+0 −0 cmake/ci/doc/docker.svg
+0 −0 cmake/ci/doc/generate_image.sh
+1 −1 cmake/ci/docker/amd64/Dockerfile
+0 −0 cmake/ci/docker/toolchain/Dockerfile
+0 −0 cmake/ci/sample/CMakeLists.txt
+0 −0 cmake/ci/sample/main.cpp
+10 −5 cmake/ci/vagrant/freebsd/Vagrantfile
+136 −1 include/cpu_features_macros.h
+105 −4 include/cpuinfo_aarch64.h
+19 −5 include/cpuinfo_mips.h
+72 −0 include/cpuinfo_riscv.h
+108 −0 include/cpuinfo_s390x.h
+76 −51 include/cpuinfo_x86.h
+50 −0 include/internal/hwcaps.h
+70 −0 include/internal/windows_utils.h
+165 −0 scripts/generate_badges.d
+4 −1 scripts/make_release.sh
+148 −21 scripts/run_integration.sh
+4 −1 src/impl_aarch64_linux_or_android.c
+138 −0 src/impl_aarch64_windows.c
+9 −4 src/impl_mips_linux_or_android.c
+1 −0 src/impl_ppc_linux.c
+111 −0 src/impl_riscv_linux.c
+120 −0 src/impl_s390x_linux.c
+270 −23 src/impl_x86__base_implementation.inl
+10 −10 src/impl_x86_windows.c
+31 −9 src/utils/list_cpu_features.c
+19 −1 test/CMakeLists.txt
+102 −0 test/cpuinfo_aarch64_test.cc
+12 −0 test/cpuinfo_arm_test.cc
+50 −0 test/cpuinfo_mips_test.cc
+12 −0 test/cpuinfo_ppc_test.cc
+180 −0 test/cpuinfo_riscv_test.cc
+82 −0 test/cpuinfo_s390x_test.cc
+699 −121 test/cpuinfo_x86_test.cc
2 changes: 1 addition & 1 deletion ext/pybind11
Submodule pybind11 updated 113 files
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[project]
name = "hammingdist"
version = "0.20.0"
description = "A fast tool to calculate Hamming distances"
readme = "README.md"
license = {text = "MIT"}
authors=[{name="Liam Keegan", email="[email protected]"}, {name="Dominic Kempf", email="[email protected]"}]
requires-python = ">=3.7"
classifiers=[
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
]

[project.urls]
Github = "https://github.com/ssciwr/hammingdist"
Issues = "https://github.com/ssciwr/hammingdist/issues"

[project.optional-dependencies]
test = ["pytest", "numpy"]

[tool.scikit-build.cmake.define]
BUILD_TESTING = "OFF"
HAMMING_BUILD_BENCHMARKS = "OFF"
HAMMING_BUILD_PYTHON = "ON"

[tool.cibuildwheel]
skip = "*-manylinux_i686"
# skip tests for python 3.12 until numpy 1.26 is available
test-skip = "pp* *-musllinux* cp312-*"
test-extras = "test"
test-command = "pytest {project}/python/tests -v"
environment = { BLAS="None", LAPACK="None", ATLAS="None" }
build-verbosity = 3

[tool.cibuildwheel.linux]
environment = { CMAKE_ARGS="-DHAMMING_WITH_OPENMP=ON" }
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pybind11_add_module(hammingdist hammingdist.cc)
target_link_libraries(hammingdist PUBLIC hamming)
install(TARGETS hammingdist DESTINATION .)
122 changes: 0 additions & 122 deletions setup.py

This file was deleted.