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})
|
||||
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)
|
||||
message(FATAL_ERROR "MASON_PACKAGE_tbb_LIBRARY_DIRS is empty, rpath will not work")
|
||||
endif()
|
||||
@ -527,15 +522,6 @@ else()
|
||||
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})
|
||||
add_dependency_includes(${LUA_INCLUDE_DIR})
|
||||
|
||||
@ -615,12 +601,12 @@ set(BOOST_ENGINE_LIBRARIES
|
||||
${BOOST_BASE_LIBRARIES})
|
||||
|
||||
# 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-partition osrm_partition ${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-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
|
||||
${BZIP2_LIBRARIES}
|
||||
@ -645,7 +631,6 @@ set(CUSTOMIZER_LIBRARIES
|
||||
${BOOST_ENGINE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_SHAPEFILE}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(UPDATER_LIBRARIES
|
||||
@ -653,7 +638,6 @@ set(UPDATER_LIBRARIES
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_SHAPEFILE}
|
||||
${MAYBE_COVERAGE_LIBRARIES}
|
||||
${ZLIB_LIBRARY})
|
||||
set(CONTRACTOR_LIBRARIES
|
||||
@ -662,7 +646,6 @@ set(CONTRACTOR_LIBRARIES
|
||||
${USED_LUA_LIBRARIES}
|
||||
${STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_SHAPEFILE}
|
||||
${MAYBE_RT_LIBRARY}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
set(ENGINE_LIBRARIES
|
||||
@ -683,7 +666,6 @@ set(UTIL_LIBRARIES
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${STXXL_LIBRARY}
|
||||
${TBB_LIBRARIES}
|
||||
${MAYBE_SHAPEFILE}
|
||||
${MAYBE_COVERAGE_LIBRARIES})
|
||||
|
||||
# Libraries
|
||||
@ -703,10 +685,11 @@ install(TARGETS osrm-components DESTINATION bin)
|
||||
if(BUILD_TOOLS)
|
||||
message(STATUS "Activating OSRM internal tools")
|
||||
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)
|
||||
|
||||
find_package(Shapefile)
|
||||
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>)
|
||||
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>>;
|
||||
using local_time_t = std::pair<polygon_t, struct tm>;
|
||||
|
||||
bool SupportsShapefiles();
|
||||
|
||||
class Timezoner
|
||||
{
|
||||
public:
|
||||
|
@ -68,18 +68,11 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
|
||||
->default_value(0),
|
||||
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
||||
"which "
|
||||
"to evaluate the validity of conditional turn restrictions");
|
||||
|
||||
if (updater::SupportsShapefiles())
|
||||
{
|
||||
config_options.add_options()("time-zone-file",
|
||||
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");
|
||||
}
|
||||
"to evaluate the validity of conditional turn restrictions")(
|
||||
"time-zone-file",
|
||||
boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
|
||||
"Required for conditional turn restriction parsing, provide a geojson file containing "
|
||||
"time zone boundaries");
|
||||
|
||||
// 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");
|
||||
|
@ -59,18 +59,13 @@ parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customiz
|
||||
->default_value(0),
|
||||
"Optional for conditional turn restriction parsing, provide a UTC time stamp from "
|
||||
"which "
|
||||
"to evaluate the validity of conditional turn restrictions");
|
||||
|
||||
if (updater::SupportsShapefiles())
|
||||
{
|
||||
config_options.add_options()("time-zone-file",
|
||||
boost::program_options::value<std::string>(
|
||||
&customization_config.updater_config.tz_file_path)
|
||||
->default_value(""),
|
||||
"Required for conditional turn restriction parsing, provide a "
|
||||
"shp or dbf file containing "
|
||||
"time zone boundaries");
|
||||
}
|
||||
"to evaluate the validity of conditional turn restrictions")(
|
||||
"time-zone-file",
|
||||
boost::program_options::value<std::string>(
|
||||
&customization_config.updater_config.tz_file_path)
|
||||
->default_value(""),
|
||||
"Required for conditional turn restriction parsing, provide a geojson file containing "
|
||||
"time zone boundaries");
|
||||
|
||||
// hidden options, will be allowed on command line, but will not be
|
||||
// shown to the user
|
||||
|
@ -19,15 +19,6 @@ namespace osrm
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (tz_shapes_filename.empty())
|
||||
return;
|
||||
throw osrm::util::exception("Missing time zone geojson file");
|
||||
std::ifstream file(tz_shapes_filename.data());
|
||||
if (!file.is_open())
|
||||
throw osrm::util::exception("failed to open " + tz_shapes_filename);
|
||||
|
||||
util::Log() << "Parsing " + tz_shapes_filename;
|
||||
rapidjson::IStreamWrapper isw(file);
|
||||
rapidjson::Document geojson;
|
||||
geojson.ParseStream(isw);
|
||||
@ -137,7 +129,7 @@ void Timezoner::LoadLocalTimesRTree(const std::string &tz_shapes_filename, std::
|
||||
if (feat_type == "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]
|
||||
.GetObject()["geometry"]
|
||||
.GetObject()["coordinates"]
|
||||
|
Loading…
Reference in New Issue
Block a user