From 92e267db481f044b18aeac24a915844652104389 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 17:08:00 -0800 Subject: [PATCH 1/6] update demo to include an external library dependency (eg, google re2) * this works, but only includes a header file and requires re2-config.cmake Signed-off-by: Stephen L Arnold --- CMakeLists.txt | 12 ++++++++++++ src/main.cpp | 1 + tox.ini | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tox.ini diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b220b1..7d3e416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,21 @@ cmake_minimum_required(VERSION 3.4...3.18) project(cmake_example) +find_package(re2 CONFIG REQUIRED) +#find_path(HAVE_TOP_LEVEL_RE2_HEADER NAMES re2.h) + +find_package(Threads REQUIRED) + add_subdirectory(pybind11) pybind11_add_module(cmake_example src/main.cpp) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + # EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a # define (VERSION_INFO) here. target_compile_definitions(cmake_example PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO}) + +target_compile_features(cmake_example INTERFACE cxx_std_11) +target_link_libraries(cmake_example PRIVATE re2::re2) diff --git a/src/main.cpp b/src/main.cpp index d50bce7..4801c46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #include +#include #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..2401737 --- /dev/null +++ b/tox.ini @@ -0,0 +1,33 @@ +[tox] +envlist = py3{6,7,8,9} +skip_missing_interpreters = true + +[tox:travis] +3.6 = py36 +3.7 = py37 +3.8 = py38 +3.9 = py39 + +[testenv] +passenv = CI PYTHON CC CXX + +deps = + pip>=19.0.1 + wheel + +commands = + pip install . + python tests/test.py + #py.test . --cov --cov-report term-missing + # codecov + +[testenv:deploy] +passenv = CI PYTHON CC CXX + +deps = + pip>=19.0.1 + wheel + +commands = + python setup.py sdist + python setup.py bdist_wheel From 90d05d39b686608a9b84847a97b2d2c5e52fb64f Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 17:48:03 -0800 Subject: [PATCH 2/6] add lib dependencies to pip builds Signed-off-by: Stephen L Arnold --- .github/workflows/pip.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index dfabeff..4552d81 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -45,6 +45,26 @@ jobs: echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV echo "MSSdk=1" >> $GITHUB_ENV + - name: Install deps with vcpkg + run: | + echo $VCPKG_ROOT + vcpkg install re2:x64-windows + vcpkg integrate install + if: startsWith(matrix.os, 'win') + + - name: Install deps with brew + run: | + brew install re2 + if: startsWith(matrix.os, 'mac') + + - name: Install re2 deps with apt + if: runner.os == 'Linux' + run: | + sudo apt-get -qq update + sudo apt-get install -y software-properties-common + sudo add-apt-repository -y -s ppa:nerdboy/embedded + sudo apt-get install -y libre2-dev + - name: Build and install run: pip install --verbose . From 5beab59c3c7def53b9df86105993e4b109c39eaf Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 20:03:19 -0800 Subject: [PATCH 3/6] switch to another library with all the right cmake bits, update ci deps Signed-off-by: Stephen L Arnold --- .github/workflows/pip.yml | 14 ++++++-------- .github/workflows/wheels.yml | 5 +++++ CMakeLists.txt | 6 ++---- src/main.cpp | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 4552d81..68afe84 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -45,25 +45,23 @@ jobs: echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV echo "MSSdk=1" >> $GITHUB_ENV - - name: Install deps with vcpkg + - name: Install library deps with vcpkg run: | echo $VCPKG_ROOT - vcpkg install re2:x64-windows + vcpkg install eigen3:x64-windows vcpkg integrate install if: startsWith(matrix.os, 'win') - - name: Install deps with brew + - name: Install library deps with brew run: | - brew install re2 + brew install eigen3 if: startsWith(matrix.os, 'mac') - - name: Install re2 deps with apt + - name: Install library deps with apt if: runner.os == 'Linux' run: | sudo apt-get -qq update - sudo apt-get install -y software-properties-common - sudo add-apt-repository -y -s ppa:nerdboy/embedded - sudo apt-get install -y libre2-dev + sudo apt-get install -y libeigen3-dev - name: Build and install run: pip install --verbose . diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 11732ef..1c30121 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -54,6 +54,11 @@ jobs: - uses: actions/setup-python@v2 + - name: Install library deps with apt + run: | + sudo apt-get -qq update + sudo apt-get install -y libeigen3-dev + - name: Install cibuildwheel run: python -m pip install cibuildwheel==1.6.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d3e416..a61d3f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.4...3.18) project(cmake_example) -find_package(re2 CONFIG REQUIRED) -#find_path(HAVE_TOP_LEVEL_RE2_HEADER NAMES re2.h) - +find_package(Eigen3 CONFIG REQUIRED) find_package(Threads REQUIRED) add_subdirectory(pybind11) @@ -18,4 +16,4 @@ set(CMAKE_CXX_EXTENSIONS OFF) target_compile_definitions(cmake_example PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO}) target_compile_features(cmake_example INTERFACE cxx_std_11) -target_link_libraries(cmake_example PRIVATE re2::re2) +target_link_libraries(cmake_example PRIVATE Eigen3::Eigen) diff --git a/src/main.cpp b/src/main.cpp index 4801c46..d50bce7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,4 @@ #include -#include #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) From 969e0f6f0024fbd3a35dd1e3f8c65a70f397237b Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 20:17:37 -0800 Subject: [PATCH 4/6] get the package name right on macos... Signed-off-by: Stephen L Arnold --- .github/workflows/pip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 68afe84..e3eebfc 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -54,7 +54,7 @@ jobs: - name: Install library deps with brew run: | - brew install eigen3 + brew install eigen if: startsWith(matrix.os, 'mac') - name: Install library deps with apt From cbc0393486afc6e73b1e01f22a57bec1ff2ddc2b Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 21:38:21 -0800 Subject: [PATCH 5/6] apparently we need to at least update cmake Signed-off-by: Stephen L Arnold --- .github/workflows/pip.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index e3eebfc..ba60e60 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -54,6 +54,7 @@ jobs: - name: Install library deps with brew run: | + brew upgrade cmake brew install eigen if: startsWith(matrix.os, 'mac') From a3859768f7de23d51aa582f6c997646a7622b973 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 25 Nov 2020 22:53:01 -0800 Subject: [PATCH 6/6] fix silly windows path in a bash shell Signed-off-by: Stephen L Arnold --- .github/workflows/pip.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index ba60e60..cce7dc1 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -45,17 +45,22 @@ jobs: echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV echo "MSSdk=1" >> $GITHUB_ENV + - name: Update vcpkg + run: | + cd C:\vcpkg + git pull + .\\bootstrap-vcpkg.bat + if: startsWith(matrix.os, 'win') + - name: Install library deps with vcpkg run: | - echo $VCPKG_ROOT vcpkg install eigen3:x64-windows vcpkg integrate install if: startsWith(matrix.os, 'win') - name: Install library deps with brew run: | - brew upgrade cmake - brew install eigen + brew install -s eigen if: startsWith(matrix.os, 'mac') - name: Install library deps with apt