Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libosmium and add protozero and vtzero libraries #5037

Merged
merged 10 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# UNRELEASED
- Changes from 5.17.0:
- Infrastructure:
- ADDED: Updated libosmium and added protozero and vtzero libraries [#5037](https://github.com/Project-OSRM/osrm-backend/pull/5037)

# 5.17.0
- Changes from 5.16.0:
- Bugfixes:
Expand Down
29 changes: 17 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ add_executable(osrm-customize src/tools/customize.cpp)
add_executable(osrm-contract src/tools/contract.cpp)
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL> )
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:STORAGE> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_contract src/osrm/contractor.cpp $<TARGET_OBJECTS:CONTRACTOR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_extract src/osrm/extractor.cpp $<TARGET_OBJECTS:EXTRACTOR> $<TARGET_OBJECTS:MICROTAR> $<TARGET_OBJECTS:UTIL>)
add_library(osrm_guidance $<TARGET_OBJECTS:GUIDANCE> $<TARGET_OBJECTS:UTIL>)
Expand Down Expand Up @@ -416,11 +416,24 @@ if(UNIX AND NOT APPLE)
set(MAYBE_RT_LIBRARY -lrt)
endif()

# Disallow deprecated protozero APIs
add_definitions(-DPROTOZERO_STRICT_API)

find_package(Threads REQUIRED)

# Third-party libraries
set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})

set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)

set(PROTOZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/protozero/include")
include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})

set(VTZERO_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/vtzero/include")
include_directories(SYSTEM ${VTZERO_INCLUDE_DIR})


# if mason is enabled no find_package calls are made
# to ensure that we are only compiling and linking against
# fully portable mason packages
Expand Down Expand Up @@ -554,14 +567,6 @@ else()
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
endif()

set(RAPIDJSON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})

set(MICROTAR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src")
include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)

# prefix compilation with ccache by default if available and on clang or gcc
if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
find_program(CCACHE_FOUND ccache)
Expand Down
105 changes: 38 additions & 67 deletions scripts/update_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,79 +9,50 @@ set -o nounset
# structure will be lost.
# http://git.661346.n2.nabble.com/subtree-merges-lose-prefix-after-rebase-td7332850.html

OSMIUM_REPO="https://github.com/osmcode/libosmium.git"
OSMIUM_TAG=v2.13.1
OSMIUM_PATH="osmcode/libosmium"
OSMIUM_TAG=v2.14.0

VARIANT_REPO="https://github.com/mapbox/variant.git"
VARIANT_PATH="mapbox/variant"
VARIANT_TAG=v1.1.3

SOL_REPO="https://github.com/ThePhD/sol2.git"
SOL_PATH="ThePhD/sol2"
SOL_TAG=v2.17.5

RAPIDJSON_REPO="https://github.com/miloyip/rapidjson.git"
RAPIDJSON_PATH="Tencent/rapidjson"
RAPIDJSON_TAG=v1.1.0

MICROTAR_REPO="https://github.com/rxi/microtar"
MICROTAR_PATH="rxi/microtar"
MICROTAR_TAG=v0.1.0

VARIANT_LATEST=$(curl "https://api.github.com/repos/mapbox/variant/releases/latest" | jq ".tag_name")
OSMIUM_LATEST=$(curl "https://api.github.com/repos/osmcode/libosmium/releases/latest" | jq ".tag_name")
SOL_LATEST=$(curl "https://api.github.com/repos/ThePhD/sol2/releases/latest" | jq ".tag_name")
RAPIDJSON_LATEST=$(curl "https://api.github.com/repos/miloyip/rapidjson/releases/latest" | jq ".tag_name")
MICROTAR_LATEST=$(curl "https://api.github.com/repos/rxi/microtar/releases/latest" | jq ".tag_name")

echo "Latest osmium release is $OSMIUM_LATEST, pulling in \"$OSMIUM_TAG\""
echo "Latest variant release is $VARIANT_LATEST, pulling in \"$VARIANT_TAG\""
echo "Latest sol2 release is $SOL_LATEST, pulling in \"$SOL_TAG\""
echo "Latest rapidjson release is $RAPIDJSON_LATEST, pulling in \"$RAPIDJSON_TAG\""
echo "Latest microtar release is $MICROTAR_LATEST, pulling in \"$MICROTAR_TAG\""

read -p "Update osmium (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/libosmium" ]; then
git subtree pull -P third_party/libosmium/ $OSMIUM_REPO $OSMIUM_TAG --squash
else
git subtree add -P third_party/libosmium/ $OSMIUM_REPO $OSMIUM_TAG --squash
fi
fi

read -p "Update variant (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/variant" ]; then
git subtree pull -P third_party/variant/ $VARIANT_REPO $VARIANT_TAG --squash
else
git subtree add -P third_party/variant/ $VARIANT_REPO $VARIANT_TAG --squash
fi
fi

read -p "Update sol2 (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/sol2" ]; then
git subtree pull -P third_party/sol2/sol2/ $SOL_REPO $SOL_TAG --squash
else
git subtree add -P third_party/sol2/sol2/ $SOL_REPO $SOL_TAG --squash
fi
fi

read -p "Update rapidjson (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/rapidjson" ]; then
git subtree pull -P third_party/rapidjson/ $RAPIDJSON_REPO $RAPIDJSON_TAG --squash
else
git subtree add -P third_party/rapidjson/ $RAPIDJSON_REPO $RAPIDJSON_TAG --squash
fi
fi

read -p "Update microtar (y/n) " ok
if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/microtar" ]; then
git subtree pull -P third_party/microtar/ $MICROTAR_REPO $MICROTAR_TAG --squash
else
git subtree add -P third_party/microtar/ $MICROTAR_REPO $MICROTAR_TAG --squash
fi
fi
PROTOZERO_PATH="mapbox/protozero"
PROTOZERO_TAG=v1.6.2

VTZERO_PATH="mapbox/vtzero"
VTZERO_TAG=v1.0.1

function update_subtree () {
name=${1^^}
path=$(tmpvar=${name}_PATH && echo ${!tmpvar})
tag=$(tmpvar=${name}_TAG && echo ${!tmpvar})
dir=$(basename $path)
repo="https://github.com/${path}.git"
latest=$(curl -s "https://api.github.com/repos/${path}/releases/latest" | jq ".tag_name")

echo "Latest $1 release is ${latest}, pulling in \"${tag}\""

read -p "Update ${1} (y/n) " ok

if [[ $ok =~ [yY] ]]
then
if [ -d "third_party/$dir" ]; then
git subtree pull -P third_party/$dir ${repo} ${tag} --squash
else
git subtree add -P third_party/$dir ${repo} ${tag} --squash
fi
fi
}

## Update dependencies
for dep in osmium variant sol rapidjson microtar protozero vtzero ; do
update_subtree $dep
done
90 changes: 90 additions & 0 deletions third_party/libosmium/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
Checks: '*,-android-cloexec-*,-cert-dcl21-cpp,-cert-err58-cpp,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-misc-macro-parentheses,-misc-unused-parameters,-modernize-make-unique,-modernize-raw-string-literal,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion'
#
# For a list of check options, see:
# http://clang.llvm.org/extra/clang-tidy/checks/list.html
#
# Disabled checks:
#
# android-cloexec-*
# O_CLOEXEC isn't available on Windows making this non-portable.
#
# cert-dcl21-cpp
# It is unclear whether this is still a good recommendation in modern C++.
#
# cert-err58-cpp
# Used in several singelton factory functions. I don't know of a better
# way to do this and it is rather unlikely that this will be a problem.
#
# cppcoreguidelines-owning-memory
# Don't want to add dependency on gsl library.
#
# cppcoreguidelines-pro-bounds-array-to-pointer-decay
# Limited use and many false positives including for all asserts.
#
# cppcoreguidelines-pro-bounds-constant-array-index
# Is needed for low-level code.
#
# cppcoreguidelines-pro-bounds-pointer-arithmetic
# This is a low-level library, it needs to do pointer arithmetic.
#
# cppcoreguidelines-pro-type-const-cast
# When you need it, you need it.
#
# cppcoreguidelines-pro-type-reinterpret-cast
# This is a low-level library, it needs to do reinterpret-casts.
#
# cppcoreguidelines-pro-type-static-cast-downcast
# This is needed and totally okay if we are sure about the types.
#
# cppcoreguidelines-pro-type-vararg
# We need some of these functions at least and for some functions it isn't
# even clear that those are vararg functions.
#
# fuchsia-*
# Much too strict.
#
# google-runtime-references
# This is just a matter of preference, and we can't change the interfaces
# now anyways.
#
# hicpp-invalid-access-moved
# Creates false positives.
#
# hicpp-no-array-decay
# Alias for cppcoreguidelines-pro-bounds-array-to-pointer-decay.
#
# hicpp-no-assembler
# Reports are from macros we don't have any control over.
#
# hicpp-vararg
# Too strict, sometimes calling vararg functions is necessary.
#
# misc-macro-parentheses
# False positive in the only place where it reports something and
# disabling locally doesn't work.
#
# misc-unused-parameters
# Can't be fixed, because then Doxygen will complain. (In file
# include/osmium/area/problem_reporter.hpp).
#
# modernize-make-unique
# This is a C++11 library and C++ doesn't have std::make_unique.
#
# modernize-raw-string-literal
# Readability isn't that much better, arguably worse because of the new
# syntax.
#
# readability-avoid-const-params-in-decls
# This is header only library, so the declaration and implementation are
# often the same and we want to have the const in implementations.
#
# readability-implicit-bool-cast
# Old name for readability-implicit-bool-conversion.
#
# readability-implicit-bool-conversion
# I don't think this makes the code more readable.
#
#WarningsAsErrors: '*'
HeaderFilterRegex: '\/include\/osmium\/.*'
...
3 changes: 3 additions & 0 deletions third_party/libosmium/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test/data-tests/osm-testdata"]
path = test/data-tests/osm-testdata
url = https://github.com/osmcode/osm-testdata
Loading