-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bindings created * pip install . working * python -m build working (on Windows anyway) * get it building on linux * Remove test stub (save for the next PR) * Undo an overzealous rename * Add Python wheel build job * Prepare for Python bindings * Revert CMake minimum version and use cmake_policy. Using builtin `BUILD_TESTING` cmake option. * Update build.yml * Update release.yml
- Loading branch information
Showing
7 changed files
with
635 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ on: | |
push: | ||
branches: | ||
- "main" | ||
pull_request: # TODO (aliddell): remove this | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
windows-and-linux-build: | ||
|
@@ -115,3 +118,51 @@ jobs: | |
with: | ||
name: macos-latest ${{matrix.build_type}} binaries | ||
path: ${{github.workspace}}/*.zip | ||
|
||
build-wheel: | ||
strategy: | ||
matrix: | ||
platform: | ||
- "windows-latest" | ||
- "ubuntu-latest" | ||
- "macos-latest" # TODO (aliddell): universal binary? | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
permissions: | ||
actions: write | ||
|
||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install vcpkg | ||
run: | | ||
git clone https://github.com/microsoft/vcpkg.git | ||
cd vcpkg && ./bootstrap-vcpkg.sh | ||
echo "VCPKG_ROOT=${{github.workspace}}/vcpkg" >> $GITHUB_ENV | ||
echo "${{github.workspace}}/vcpkg" >> $GITHUB_PATH | ||
./vcpkg integrate install | ||
shell: bash | ||
|
||
- name: Install dependencies | ||
run: python -m pip install -U pip "pybind11[global]" cmake build | ||
|
||
- name: Build | ||
run: python -m build | ||
|
||
- name: Upload wheel | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{github.workspace}}/dist/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
include CMakeLists.txt | ||
include CMakePresets.json | ||
include vcpkg.json | ||
include vcpkg-configuration.json | ||
include cmake/*.cmake | ||
recursive-include src * | ||
recursive-include include * | ||
recursive-include python * | ||
include LICENSE | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel", | ||
"ninja", | ||
"cmake>=3.12", | ||
"pybind11[global]", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = "-ra -q" | ||
testpaths = [ | ||
"python/tests", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
project(acquire-zarr-py) | ||
cmake_policy(SET CMP0057 NEW) | ||
|
||
execute_process(COMMAND python3 -m pybind11 --cmakedir | ||
RESULT_VARIABLE pybind11_NOT_FOUND | ||
OUTPUT_VARIABLE pybind11_DIR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
if (pybind11_NOT_FOUND) | ||
message(FATAL_ERROR "pybind11 not found in the current environment. Please install pybind11 via pip.") | ||
else () | ||
LIST(APPEND CMAKE_MODULE_PATH ${pybind11_DIR}) | ||
cmake_path(CONVERT CMAKE_MODULE_PATH TO_CMAKE_PATH_LIST CMAKE_MODULE_PATH) | ||
endif () | ||
|
||
find_package(Python3 REQUIRED COMPONENTS Interpreter Development) | ||
find_package(pybind11 REQUIRED) | ||
|
||
pybind11_add_module(acquire_zarr acquire-zarr-py.cpp) | ||
|
||
target_include_directories(acquire_zarr PRIVATE ${CMAKE_SOURCE_DIR}/include) | ||
target_link_libraries(acquire_zarr PRIVATE acquire-zarr) | ||
|
||
set_target_properties(acquire_zarr PROPERTIES | ||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" | ||
) |
Oops, something went wrong.