remove shapefile dependency from build
This commit is contained in:
parent
6f41e3faf1
commit
f268163ea0
@ -447,11 +447,6 @@ if(ENABLE_MASON)
|
|||||||
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
||||||
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
||||||
|
|
||||||
mason_use(libshp2 VERSION ${MASON_LIBSHP_VERSION})
|
|
||||||
target_include_directories(UTIL PRIVATE ${MASON_PACKAGE_libshp2_INCLUDE_DIRS})
|
|
||||||
set(MAYBE_SHAPEFILE ${MASON_PACKAGE_libshp2_STATIC_LIBS})
|
|
||||||
target_compile_definitions(UTIL PRIVATE COMPILE_DEFINITIONS ENABLE_SHAPEFILE)
|
|
||||||
|
|
||||||
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
|
if(NOT MASON_PACKAGE_tbb_LIBRARY_DIRS)
|
||||||
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
|
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
|
||||||
endif()
|
endif()
|
||||||
@ -527,15 +522,6 @@ else()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
find_package(Shapefile) # optional package libshp-dev
|
|
||||||
if (Shapefile_FOUND)
|
|
||||||
set(MAYBE_SHAPEFILE "${LIBSHAPEFILE_LIBRARY}")
|
|
||||||
target_include_directories(UTIL PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})
|
|
||||||
target_compile_definitions(UTIL PRIVATE COMPILE_DEFINITIONS ENABLE_SHAPEFILE)
|
|
||||||
else()
|
|
||||||
set(MAYBE_SHAPEFILE "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
|
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
|
||||||
add_dependency_includes(${LUA_INCLUDE_DIR})
|
add_dependency_includes(${LUA_INCLUDE_DIR})
|
||||||
|
|
||||||
@ -615,12 +601,12 @@ set(BOOST_ENGINE_LIBRARIES
|
|||||||
${BOOST_BASE_LIBRARIES})
|
${BOOST_BASE_LIBRARIES})
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY} ${MAYBE_SHAPEFILE})
|
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-extract osrm_extract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-partition osrm_partition ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-customize osrm_customize ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
target_link_libraries(osrm-contract osrm_contract ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||||
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${MAYBE_SHAPEFILE} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
target_link_libraries(osrm-routed osrm ${Boost_PROGRAM_OPTIONS_LIBRARY} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
set(EXTRACTOR_LIBRARIES
|
set(EXTRACTOR_LIBRARIES
|
||||||
${BZIP2_LIBRARIES}
|
${BZIP2_LIBRARIES}
|
||||||
@ -645,7 +631,6 @@ set(CUSTOMIZER_LIBRARIES
|
|||||||
${BOOST_ENGINE_LIBRARIES}
|
${BOOST_ENGINE_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_SHAPEFILE}
|
|
||||||
${MAYBE_RT_LIBRARY}
|
${MAYBE_RT_LIBRARY}
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
set(UPDATER_LIBRARIES
|
set(UPDATER_LIBRARIES
|
||||||
@ -653,7 +638,6 @@ set(UPDATER_LIBRARIES
|
|||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_RT_LIBRARY}
|
${MAYBE_RT_LIBRARY}
|
||||||
${MAYBE_SHAPEFILE}
|
|
||||||
${MAYBE_COVERAGE_LIBRARIES}
|
${MAYBE_COVERAGE_LIBRARIES}
|
||||||
${ZLIB_LIBRARY})
|
${ZLIB_LIBRARY})
|
||||||
set(CONTRACTOR_LIBRARIES
|
set(CONTRACTOR_LIBRARIES
|
||||||
@ -662,7 +646,6 @@ set(CONTRACTOR_LIBRARIES
|
|||||||
${USED_LUA_LIBRARIES}
|
${USED_LUA_LIBRARIES}
|
||||||
${STXXL_LIBRARY}
|
${STXXL_LIBRARY}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_SHAPEFILE}
|
|
||||||
${MAYBE_RT_LIBRARY}
|
${MAYBE_RT_LIBRARY}
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
set(ENGINE_LIBRARIES
|
set(ENGINE_LIBRARIES
|
||||||
@ -683,7 +666,6 @@ set(UTIL_LIBRARIES
|
|||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${STXXL_LIBRARY}
|
${STXXL_LIBRARY}
|
||||||
${TBB_LIBRARIES}
|
${TBB_LIBRARIES}
|
||||||
${MAYBE_SHAPEFILE}
|
|
||||||
${MAYBE_COVERAGE_LIBRARIES})
|
${MAYBE_COVERAGE_LIBRARIES})
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
@ -703,10 +685,11 @@ install(TARGETS osrm-components DESTINATION bin)
|
|||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
message(STATUS "Activating OSRM internal tools")
|
message(STATUS "Activating OSRM internal tools")
|
||||||
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-io-benchmark src/tools/io-benchmark.cpp $<TARGET_OBJECTS:UTIL>)
|
||||||
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES} ${MAYBE_SHAPEFILE})
|
target_link_libraries(osrm-io-benchmark ${BOOST_BASE_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
install(TARGETS osrm-io-benchmark DESTINATION bin)
|
||||||
|
|
||||||
|
find_package(Shapefile)
|
||||||
if(SHAPEFILE_FOUND AND (Boost_VERSION VERSION_GREATER 106000 OR ENABLE_MASON))
|
if(SHAPEFILE_FOUND AND (Boost_VERSION VERSION_GREATER 106000 OR ENABLE_MASON))
|
||||||
add_executable(osrm-extract-conditionals src/tools/extract-conditionals.cpp $<TARGET_OBJECTS:UTIL>)
|
add_executable(osrm-extract-conditionals src/tools/extract-conditionals.cpp $<TARGET_OBJECTS:UTIL>)
|
||||||
target_include_directories(osrm-extract-conditionals PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})
|
target_include_directories(osrm-extract-conditionals PRIVATE ${LIBSHAPEFILE_INCLUDE_DIR})
|
||||||
|
@ -26,8 +26,6 @@ using rtree_t =
|
|||||||
boost::geometry::index::rtree<std::pair<box_t, size_t>, boost::geometry::index::rstar<8>>;
|
boost::geometry::index::rtree<std::pair<box_t, size_t>, boost::geometry::index::rstar<8>>;
|
||||||
using local_time_t = std::pair<polygon_t, struct tm>;
|
using local_time_t = std::pair<polygon_t, struct tm>;
|
||||||
|
|
||||||
bool SupportsShapefiles();
|
|
||||||
|
|
||||||
class Timezoner
|
class Timezoner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -68,18 +68,11 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
|
|||||||
->default_value(0),
|
->default_value(0),
|
||||||
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
||||||
"which "
|
"which "
|
||||||
"to evaluate the validity of conditional turn restrictions");
|
"to evaluate the validity of conditional turn restrictions")(
|
||||||
|
"time-zone-file",
|
||||||
if (updater::SupportsShapefiles())
|
boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
|
||||||
{
|
"Required for conditional turn restriction parsing, provide a geojson file containing "
|
||||||
config_options.add_options()("time-zone-file",
|
"time zone boundaries");
|
||||||
boost::program_options::value<std::string>(
|
|
||||||
&contractor_config.updater_config.tz_file_path)
|
|
||||||
->default_value(""),
|
|
||||||
"Required for conditional turn restriction parsing, provide a "
|
|
||||||
"shp or dbf file containing "
|
|
||||||
"time zone boundaries");
|
|
||||||
}
|
|
||||||
|
|
||||||
// hidden options, will be allowed on command line, but will not be shown to the user
|
// hidden options, will be allowed on command line, but will not be shown to the user
|
||||||
boost::program_options::options_description hidden_options("Hidden options");
|
boost::program_options::options_description hidden_options("Hidden options");
|
||||||
|
@ -59,18 +59,13 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
|
|||||||
->default_value(0),
|
->default_value(0),
|
||||||
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
||||||
"which "
|
"which "
|
||||||
"to evaluate the validity of conditional turn restrictions");
|
"to evaluate the validity of conditional turn restrictions")(
|
||||||
|
"time-zone-file",
|
||||||
if (updater::SupportsShapefiles())
|
boost::program_options::value<std::string>(
|
||||||
{
|
&customization_config.updater_config.tz_file_path)
|
||||||
config_options.add_options()("time-zone-file",
|
->default_value(""),
|
||||||
boost::program_options::value<std::string>(
|
"Required for conditional turn restriction parsing, provide a geojson file containing "
|
||||||
&customization_config.updater_config.tz_file_path)
|
"time zone boundaries");
|
||||||
->default_value(""),
|
|
||||||
"Required for conditional turn restriction parsing, provide a "
|
|
||||||
"shp or dbf file containing "
|
|
||||||
"time zone boundaries");
|
|
||||||
}
|
|
||||||
|
|
||||||
// hidden options, will be allowed on command line, but will not be
|
// hidden options, will be allowed on command line, but will not be
|
||||||
// shown to the user
|
// shown to the user
|
||||||
|
@ -19,15 +19,6 @@ namespace osrm
|
|||||||
namespace updater
|
namespace updater
|
||||||
{
|
{
|
||||||
|
|
||||||
bool SupportsShapefiles()
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_SHAPEFILE
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Timezoner::Timezoner(std::string tz_filename, std::time_t utc_time_now)
|
Timezoner::Timezoner(std::string tz_filename, std::time_t utc_time_now)
|
||||||
{
|
{
|
||||||
util::Log() << "Time zone validation based on UTC time : " << utc_time_now;
|
util::Log() << "Time zone validation based on UTC time : " << utc_time_now;
|
||||||
@ -89,11 +80,12 @@ void Timezoner::ValidateFeature(const rapidjson::Value &feature, const std::stri
|
|||||||
void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::time_t utc_time)
|
void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::time_t utc_time)
|
||||||
{
|
{
|
||||||
if (tz_shapes_filename.empty())
|
if (tz_shapes_filename.empty())
|
||||||
return;
|
throw osrm::util::exception("Missing time zone geojson file");
|
||||||
std::ifstream file(tz_shapes_filename.data());
|
std::ifstream file(tz_shapes_filename.data());
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
throw osrm::util::exception("failed to open " + tz_shapes_filename);
|
throw osrm::util::exception("failed to open " + tz_shapes_filename);
|
||||||
|
|
||||||
|
util::Log() << "Parsing " + tz_shapes_filename;
|
||||||
rapidjson::IStreamWrapper isw(file);
|
rapidjson::IStreamWrapper isw(file);
|
||||||
rapidjson::Document geojson;
|
rapidjson::Document geojson;
|
||||||
geojson.ParseStream(isw);
|
geojson.ParseStream(isw);
|
||||||
@ -137,7 +129,7 @@ void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::
|
|||||||
if (feat_type == "polygon")
|
if (feat_type == "polygon")
|
||||||
{
|
{
|
||||||
polygon_t polygon;
|
polygon_t polygon;
|
||||||
// per geojson spec, the first array of polygon coords is the exterior ring
|
// per geojson spec, the first array of polygon coords is the exterior ring, we only want to access that
|
||||||
auto coords_outer_array = features_array[i]
|
auto coords_outer_array = features_array[i]
|
||||||
.GetObject()["geometry"]
|
.GetObject()["geometry"]
|
||||||
.GetObject()["coordinates"]
|
.GetObject()["coordinates"]
|
||||||
|
Loading…
Reference in New Issue
Block a user