Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
tags:
- '*'
branches:
- libosrm

env:
osrm-tag: v5.26.0

jobs:
build_sdist:
Expand All @@ -22,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 }}
Expand Down Expand Up @@ -57,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
Expand All @@ -68,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
Expand Down
21 changes: 12 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@ 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]]
Expand All @@ -40,9 +49,3 @@ before-all = """
apk add asio-dev
apk add openssl-dev
"""

[tool.cibuildwheel.macos]

before-all = """
brew install asio
"""
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json
import logging
import os
import shutil
import platform
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 = []
Expand Down Expand Up @@ -57,6 +59,18 @@
else:
logging.warning("Conan not installed and/or no conan build detected. Assuming dependencies are installed.")

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"]
extra_compile_args += run(["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",
Expand Down
2 changes: 1 addition & 1 deletion src/_vroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ PYBIND11_MODULE(_vroom, m) {

py::class_<vroom::Server>(m, "Server")
.def(py::init<std::string &, std::string &>(),
py::arg("host") = "0.0.0.0", py::arg("port") = "5000");
py::arg("host")="0.0.0.0", py::arg("port")="5000");

py::class_<vroom::Violations>(m, "Violations")
.def(py::init<>())
Expand Down