Mentions légales du service

Skip to content
Snippets Groups Projects
Unverified Commit 77bdd3a6 authored by Henry Schreiner's avatar Henry Schreiner Committed by GitHub
Browse files

fix: support CMake 3.15+ (#2)

* fix: support CMake 3.15+

See #1

* ci: add conda & wheel test, fix output location for conda
parent c964da6b
No related branches found
No related tags found
No related merge requests found
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
ignore:
# Offical actions have moving tags like v1
# that are used, so they don't need updates here
- dependency-name: "actions/*"
name: Conda
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-2016, macos-latest]
python-version: ["3.6", "3.8"]
runs-on: ${{ matrix.platform }}
# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"
steps:
- uses: actions/checkout@v2
- name: Get conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Prepare
run: conda install conda-build conda-verify
- name: Build
run: conda build conda.recipe
- name: Install
run: conda install -c ${CONDA_PREFIX}/conda-bld/ scikit_build_example
- name: Test
run: python tests/test.py
cmake_minimum_required(VERSION 3.18) cmake_minimum_required(VERSION 3.15...3.18)
project(scikit_build_example VERSION "0.0.1") project(scikit_build_example VERSION "0.0.1")
# Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR
include(GNUInstallDirs)
# Currently, Scikit-build does not support FindPython, so we convert the # Currently, Scikit-build does not support FindPython, so we convert the
# provided hints ourselves. # provided hints ourselves.
if(SKBUILD) if(SKBUILD)
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}") set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}") set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
set(Python_LIBRARY "${PYTHON_LIBRARY}") set(Python_LIBRARY "${PYTHON_LIBRARY}")
set(DUMMY "${PYTHON_VERSION_STRING}") # Not needed, silences a warning
endif() endif()
set(Python_FIND_IMPLEMENTATIONS CPython PyPy) set(Python_FIND_IMPLEMENTATIONS CPython PyPy) # PyPy requires 3.18
find_package(Python REQUIRED COMPONENTS Interpreter Development) find_package(Python REQUIRED COMPONENTS Interpreter Development)
# Scikit-Build does not add your site-packages to the search path automatically, # Scikit-Build does not add your site-packages to the search path automatically,
# so we need to add it here. # so we need to add it _or_ the pybind11 specific directory here.
execute_process( execute_process(
COMMAND COMMAND
"${Python_EXECUTABLE}" -c "${Python_EXECUTABLE}" -c
"import skbuild, os; print(os.path.dirname(os.path.dirname(skbuild.__file__)))" "import pybind11; print(pybind11.get_cmake_dir())"
OUTPUT_VARIABLE _tmp_sitepackages OUTPUT_VARIABLE _tmp_dir
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT ECHO_OUTPUT_VARIABLE OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
ECHO_ERROR_VARIABLE) list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
list(APPEND CMAKE_PREFIX_PATH "${_tmp_sitepackages}")
# Now we can find pybind11 # Now we can find pybind11
find_package(pybind11 CONFIG REQUIRED) find_package(pybind11 CONFIG REQUIRED)
......
python_example scikit_build_example
============== ==============
[![Gitter][gitter-badge]][gitter-link] [![Gitter][gitter-badge]][gitter-link]
[![Wheels Actions Status][actions-pip-badge]][actions-pip-link]
| CI | status |
|----------------------|--------|
| conda.recipe | [![Conda Actions Status][actions-conda-badge]][actions-conda-link] |
| pip builds | [![Pip Actions Status][actions-pip-badge]][actions-pip-link] |
An example project built with [pybind11](https://github.com/pybind/pybind11) and scikit-build.
[gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg [gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg
[gitter-link]: https://gitter.im/pybind/Lobby [gitter-link]: https://gitter.im/pybind/Lobby
[actions-pip-link]: https://github.com/pybind/scikit_build_example/actions?query=workflow%3APip [actions-badge]: https://github.com/pybind/scikit_build_example/workflows/Tests/badge.svg
[actions-pip-badge]: https://github.com/pybind/scikit_build_example/workflows/Pip/badge.svg [actions-conda-link]: https://github.com/pybind/scikit_build_example/actions?query=workflow%3A%22Conda
[actions-conda-badge]: https://github.com/pybind/scikit_build_example/workflows/Conda/badge.svg
An example project built with [pybind11](https://github.com/pybind/pybind11). [actions-pip-link]: https://github.com/pybind/scikit_build_example/actions?query=workflow%3A%22Pip
[actions-pip-badge]: https://github.com/pybind/scikit_build_example/workflows/Pip/badge.svg
[actions-wheels-link]: https://github.com/pybind/scikit_build_example/actions?query=workflow%3AWheels
[actions-wheels-badge]: https://github.com/pybind/scikit_build_example/workflows/Wheels/badge.svg
Installation Installation
------------ ------------
...@@ -19,7 +32,7 @@ Installation ...@@ -19,7 +32,7 @@ Installation
- clone this repository - clone this repository
- `pip install ./scikit_build_example` - `pip install ./scikit_build_example`
**On Windows (Requires Visual Studio 2017)** **On Windows**
- For Python 3.5+: - For Python 3.5+:
- clone this repository - clone this repository
...@@ -45,8 +58,8 @@ Test call ...@@ -45,8 +58,8 @@ Test call
--------- ---------
```python ```python
import python_example import scikit_build_example
python_example.add(1, 2) scikit_build_example.add(1, 2)
``` ```
[`cibuildwheel`]: https://cibuildwheel.readthedocs.io [`cibuildwheel`]: https://cibuildwheel.readthedocs.io
package:
name: scikit_build_example
version: 0.0.1
source:
path: ..
build:
number: 0
script: python -m pip install . -vvv
requirements:
build:
- {{ compiler('cxx') }}
host:
- python
- pip
- pybind11 >=2.6.0
- scikit-build
- cmake >=3.18
- ninja
run:
- python
test:
imports:
- scikit_build_example
source_files:
- tests
commands:
- python tests/test.py
about:
summary: An example project built with pybind11 and scikit-build.
license_file: LICENSE
...@@ -15,7 +15,7 @@ except ImportError: ...@@ -15,7 +15,7 @@ except ImportError:
raise raise
setup( setup(
name="scikit-build-example", name="scikit_build_example",
version="0.0.1", version="0.0.1",
description="a minimal example package (with pybind11)", description="a minimal example package (with pybind11)",
author="Henry Schreiner", author="Henry Schreiner",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment