Skip to content

Commit

Permalink
Use FetchContent to download pybind11
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmang9 committed May 18, 2020
1 parent 73c916a commit d56a7b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 240 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ jobs:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags

- name: Checkout submodules
uses: snickerbockers/submodules-init@v4

- uses: actions/setup-python@v1
name: Install Python
with:
python-version: '3.7'

- name: Install cibuildwheel and pybind11
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install wheel pybind11==2.5.0
pip install cibuildwheel==1.3.0
- name: Lint source with flake8
Expand Down Expand Up @@ -63,11 +59,9 @@ jobs:
&& rm -f /usr/bin/cmake
&& yum -y install boost-devel gmp-devel
&& python -m pip install --upgrade pip
&& pip install pybind11==2.5.0
CIBW_BEFORE_BUILD_MACOS: >
brew install boost
&& python -m pip install --upgrade pip
&& pip install pybind11==2.5.0
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
CIBW_BUILD_VERBOSITY_MACOS: 0
CIBW_TEST_REQUIRES: pytest
Expand All @@ -79,7 +73,6 @@ jobs:
&& cp {wheel} {dest_dir}
CIBW_BEFORE_BUILD_WINDOWS: >
python -m pip install --upgrade pip
&& pip install pybind11==2.5.0
&& git clone https://github.com/Chia-Network/mpir_gc_x64.git
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
ls -l mpir_gc_x64 && pip uninstall -y delocate
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CMakeFiles/
Makefile
CMakeCache.txt
cmake_install.cmake
_deps/

# Binary files
src/compile_asm
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ pip wheel .

The primary build process for this repository is to use GitHub Actions to
build binary wheels for MacOS, Linux, and Windows and publish them with
a source wheel on PyPi. See `.github/workflows/build.yml`. setup.py adds
a dependency on [pybind11](https://github.com/pybind/pybind11) using
`pip install pybind11`. Building is then managed by
a source wheel on PyPi. See `.github/workflows/build.yml`. CMake uses
[FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html)
to download [pybind11](https://github.com/pybind/pybind11).
Building is then managed by
[cibuildwheel](https://github.com/joerick/cibuildwheel). Further installation
is then available via `pip install chiavdf` e.g.

Expand Down
12 changes: 10 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ include_directories(

set (CMAKE_CXX_FLAGS "-std=c++1z")

add_subdirectory(lib/pybind11)
pybind11_add_module(chiavdf
include(FetchContent)

FetchContent_Declare(
pybind11-src
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.5.0
)
FetchContent_MakeAvailable(pybind11-src)

pybind11_add_module(chiavdf
${CMAKE_CURRENT_SOURCE_DIR}/python_bindings/fastvdf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/refcode/lzcnt.c
)
Expand Down
227 changes: 0 additions & 227 deletions src/cmake/pybind11Tools.cmake

This file was deleted.

0 comments on commit d56a7b6

Please sign in to comment.