Skip to content

Commit

Permalink
Merge pull request #5037 from Project-OSRM/subtrees-protozero-vtzero
Browse files Browse the repository at this point in the history
Update libosmium and add protozero and vtzero libraries
  • Loading branch information
Patrick Niklaus authored Apr 20, 2018
2 parents 6f84812 + 7feb79e commit 9970b7d
Show file tree
Hide file tree
Showing 740 changed files with 58,345 additions and 4,479 deletions.
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.1
- Changes from 5.17.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

0 comments on commit 9970b7d

Please sign in to comment.