From ebfb024a90cfff9ec9d25cad4b8bdcef86ea677b Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Fri, 4 Feb 2022 14:46:15 +0100 Subject: [PATCH 1/6] attempt at libosrm --- .github/workflows/release.yml | 7 +++++-- pyproject.toml | 12 ++++++++++++ setup.py | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89a7684..eea299b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,9 @@ on: push: tags: - '*' + push: + branches: + - libosrm jobs: build_sdist: @@ -31,8 +34,8 @@ jobs: include: - image: ubuntu-latest platform: linux - - image: macos-latest - platform: macos + # - image: macos-latest + # platform: macos # - image: windows-latest # platform: windows diff --git a/pyproject.toml b/pyproject.toml index dd703e9..e5eda9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,10 +28,22 @@ skip = "*musllinux*" archs = "native" [tool.cibuildwheel.linux] +build = "cp39*" before-all = """ yum update -y yum install -y epel-release yum install -y openssl-devel asio-devel +yum install -y scl-utils +yum install -y gcc-toolset-9 +scl enable gcc-toolset-9 bash +yum install git cmake3 zlib-devel +git clone https://github.com/Project-OSRM/osrm-backend.git +cd osrm-backend +mkdir build +cd build +cmake3 .. -DENABLE_MASON=ON -DCMAKE_CXX_COMPILER=/opt/rh/gcc-toolset-9/root/usr/bin/g++ +make +make install """ [[tool.cibuildwheel.overrides]] diff --git a/setup.py b/setup.py index 70b242e..d3d5f97 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from pathlib import Path from setuptools import setup from pybind11.setup_helpers import Pybind11Extension, build_ext +from subprocess import run, PIPE include_dirs = ["src", os.path.join("vroom", "src"), os.path.join("vroom", "include")] libraries = [] @@ -57,6 +58,18 @@ else: logging.warning("Conan not installed and/or no conan build detected. Assuming dependencies are installed.") +if run(["shell", "pkg-config", "--exists", "libosrm"], + stdout=PIPE).stdout == "1": + extra_link_args += run(["shell", "pkg-config", "--libs", "libosrm"]).split() + extra_link_args += ["-lboost_system", "-boost_filesystem", "-lboost_iostream", "-lboost_thread -lrt -ltbb"] + extra_compile_args += run(["shell", "pkg-config", "--cflags", "libosrm"], + stdout=PIPE).stdout.split() + extra_compile_args += ["-D USE_LIBOSRM"] +else: + logging.warning("Libosrm not found. Package not included.") + + + ext_modules = [ Pybind11Extension( "_vroom", From 56f551be45fa0a7f35349899029464cc263e364d Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Fri, 4 Feb 2022 14:48:03 +0100 Subject: [PATCH 2/6] bugfix --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eea299b..7cbee2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,6 @@ on: push: tags: - '*' - push: branches: - libosrm From aac5f3f5751fad38b8a5e5c42f217a09cac16579 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Fri, 4 Feb 2022 14:51:14 +0100 Subject: [PATCH 3/6] check first for pkg-config --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index d3d5f97..cc43df9 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ import json import logging import os +import shutil import platform from pathlib import Path from setuptools import setup @@ -58,11 +59,11 @@ else: logging.warning("Conan not installed and/or no conan build detected. Assuming dependencies are installed.") -if run(["shell", "pkg-config", "--exists", "libosrm"], +if shutil.whice("pkg-config") && run(["pkg-config", "--exists", "libosrm"], stdout=PIPE).stdout == "1": - extra_link_args += run(["shell", "pkg-config", "--libs", "libosrm"]).split() + extra_link_args += run(["pkg-config", "--libs", "libosrm"]).split() extra_link_args += ["-lboost_system", "-boost_filesystem", "-lboost_iostream", "-lboost_thread -lrt -ltbb"] - extra_compile_args += run(["shell", "pkg-config", "--cflags", "libosrm"], + extra_compile_args += run(["pkg-config", "--cflags", "libosrm"], stdout=PIPE).stdout.split() extra_compile_args += ["-D USE_LIBOSRM"] else: From 8ac8db0c46585cd0dae3c2ff80b2d2db7975315e Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Fri, 4 Feb 2022 14:53:44 +0100 Subject: [PATCH 4/6] bugfix --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cc43df9..b5d5861 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ else: logging.warning("Conan not installed and/or no conan build detected. Assuming dependencies are installed.") -if shutil.whice("pkg-config") && run(["pkg-config", "--exists", "libosrm"], +if shutil.which("pkg-config") && run(["pkg-config", "--exists", "libosrm"], stdout=PIPE).stdout == "1": extra_link_args += run(["pkg-config", "--libs", "libosrm"]).split() extra_link_args += ["-lboost_system", "-boost_filesystem", "-lboost_iostream", "-lboost_thread -lrt -ltbb"] From 50bc1f5f35ec0076a0c713dac157e1d2ecc77f03 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Fri, 4 Feb 2022 14:55:06 +0100 Subject: [PATCH 5/6] bugfix --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b5d5861..18c2c7d 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ else: logging.warning("Conan not installed and/or no conan build detected. Assuming dependencies are installed.") -if shutil.which("pkg-config") && run(["pkg-config", "--exists", "libosrm"], +if shutil.which("pkg-config") and run(["pkg-config", "--exists", "libosrm"], stdout=PIPE).stdout == "1": extra_link_args += run(["pkg-config", "--libs", "libosrm"]).split() extra_link_args += ["-lboost_system", "-boost_filesystem", "-lboost_iostream", "-lboost_thread -lrt -ltbb"] From 9826301fb4ac1111133852cb0d9157af0cba8e26 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Sun, 13 Mar 2022 19:17:15 +0100 Subject: [PATCH 6/6] WIP --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++---- pyproject.toml | 11 +---------- src/_vroom.cpp | 2 +- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cbee2c..bc212fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,9 @@ on: branches: - libosrm +env: + osrm-tag: v5.26.0 + jobs: build_sdist: name: sdist @@ -24,6 +27,19 @@ jobs: with: path: dist/*.tar.gz + install_osrm: + name: "Cache OSRM" + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: sudo apt-get install libasio-dev libglpk-dev + - name: Cache OSRM + id: cache + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/osrm-backend + key: osrm-${{ env.osrm-tag }} + build_wheels: name: ${{ matrix.platform }} runs-on: ${{ matrix.image }} @@ -33,8 +49,8 @@ jobs: include: - image: ubuntu-latest platform: linux - # - image: macos-latest - # platform: macos + - image: macos-latest + platform: macos # - image: windows-latest # platform: windows @@ -59,8 +75,8 @@ jobs: with: python-version: '3.x' - - name: Install Conan - if: matrix.image == 'windows-latest' && steps.cache-conan.outputs.cache-hit != 'true' + - name: Conan Install + if: matrix.platform == 'windows' && steps.cache-conan.outputs.cache-hit != 'true' run: | pip install pip --upgrade pip install conan @@ -70,6 +86,17 @@ jobs: conan config set "storage.path=$env:GITHUB_WORKSPACE/conan_data" conan install --build=openssl --install-folder conan_build . + - name: Brew Install + if: matrix.platform == 'macos' + run: brew install asio + + - name: YUM Install + if: matrix.platform == 'linux' + run: | + yum update -y + yum install -y epel-release + yum install -y openssl-devel asio-devel + - uses: pypa/cibuildwheel@v2.3.1 env: MACOSX_DEPLOYMENT_TARGET: 10.14 diff --git a/pyproject.toml b/pyproject.toml index e5eda9c..9b1975f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,11 +28,8 @@ skip = "*musllinux*" archs = "native" [tool.cibuildwheel.linux] -build = "cp39*" +build = "cp39-*" before-all = """ -yum update -y -yum install -y epel-release -yum install -y openssl-devel asio-devel yum install -y scl-utils yum install -y gcc-toolset-9 scl enable gcc-toolset-9 bash @@ -52,9 +49,3 @@ before-all = """ apk add asio-dev apk add openssl-dev """ - -[tool.cibuildwheel.macos] - -before-all = """ -brew install asio -""" diff --git a/src/_vroom.cpp b/src/_vroom.cpp index 3a2d86d..f8e20de 100644 --- a/src/_vroom.cpp +++ b/src/_vroom.cpp @@ -132,7 +132,7 @@ PYBIND11_MODULE(_vroom, m) { py::class_(m, "Server") .def(py::init(), - py::arg("host") = "0.0.0.0", py::arg("port") = "5000"); + py::arg("host")="0.0.0.0", py::arg("port")="5000"); py::class_(m, "Violations") .def(py::init<>())