Skip to content
Commits on Source (14)
build
dist
contrib
osmium.egg-info
*.pyc
.ycm_extra_conf.py
......@@ -6,7 +6,6 @@
language: cpp
sudo: false
dist: trusty
matrix:
......@@ -23,6 +22,22 @@ matrix:
- os: linux
compiler: gcc
env: USE_PYTHON_VERSION=3
- os: osx
osx_image: xcode8.3
compiler: clang
env: USE_PYTHON_VERSION=3
- os: osx
osx_image: xcode9.4
compiler: clang
env: USE_PYTHON_VERSION=3
- os: osx
osx_image: xcode10.1
compiler: clang
env: USE_PYTHON_VERSION=
- os: osx
osx_image: xcode10.1
compiler: clang
env: USE_PYTHON_VERSION=3
# http://docs.travis-ci.com/user/apt/
addons:
......@@ -32,9 +47,7 @@ addons:
packages:
- g++-4.8
- gcc-4.8
- libboost-python1.55-dev
- libboost1.55-dev
- libsparsehash-dev
- python-dev
- python-nose
- python-mock
......@@ -44,13 +57,11 @@ addons:
- python3-setuptools
install:
- git clone --quiet --depth 1 https://github.com/osmcode/libosmium.git ../libosmium
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
- git clone --quiet --depth 1 https://github.com/osmcode/libosmium.git contrib/libosmium
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git contrib/protozero
- git clone --quiet --depth 1 https://github.com/pybind/pybind11.git contrib/pybind11
- if [ "$TRAVIS_OS_NAME" = 'osx' ]; then
brew update;
brew install python$PYTHON_SUFFIX google-sparsehash;
brew install boost-python $BOOST_PYTHON_OPTION;
pip$PYTHON_SUFFIX install -q nose mock;
pip${USE_PYTHON_VERSION} install -q nose mock;
fi
script:
......
......@@ -4,6 +4,18 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.15.0] - 2018-12-09
### Added
- more tests
### Changed
- replace boost-python with header only pybind11 library
- switch to cmake for configuration (called through setup.py)
- default node cache changed to flex_mem
## [2.14.4] - 2018-10-30
### Added
......
cmake_minimum_required(VERSION 2.8.12)
project(pyosmium)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(Osmium 2.14 REQUIRED COMPONENTS io pbf xml)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
if(MSVC)
set(PYBIND11_CPP_STANDARD /std:c++14)
else()
set(PYBIND11_CPP_STANDARD -std=c++11)
endif()
if(PYBIND11_PREFIX)
add_subdirectory(${PYBIND11_PREFIX} contrib/pybind11)
else()
find_package(pybind11 2.2 REQUIRED)
endif()
find_package(Boost 1.55 REQUIRED COMPONENTS)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
function(set_module_output module outdir)
set_target_properties(${module} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${outdir})
# windows needs a build type variant
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
set_target_properties(${module} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY_${config}
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${outdir})
endforeach()
endfunction()
set(PYOSMIUM_MODULES geom index io)
foreach(PYMOD geom index io)
pybind11_add_module(${PYMOD} lib/${PYMOD}.cc)
set_module_output(${PYMOD} osmium)
target_link_libraries(${PYMOD} PRIVATE ${OSMIUM_LIBRARIES})
if(APPLE)
set_target_properties(${PYMOD} PROPERTIES CXX_VISIBILITY_PRESET "default")
endif()
endforeach()
pybind11_add_module(_osm lib/osm.cc)
set_module_output(_osm osmium/osm)
pybind11_add_module(_osmium
lib/osmium.cc
lib/merge_input_reader.cc
lib/simple_writer.cc
lib/write_handler.cc)
set_module_output(_osmium osmium)
pybind11_add_module(_replication lib/replication.cc)
set_module_output(_replication osmium/replication)
target_link_libraries(_osmium PRIVATE ${OSMIUM_LIBRARIES})
target_link_libraries(_replication PRIVATE ${OSMIUM_LIBRARIES})
# workaround for https://github.com/pybind/pybind11/issues/1272
if(APPLE)
set_target_properties(_osmium PROPERTIES CXX_VISIBILITY_PRESET "default")
set_target_properties(_osm PROPERTIES CXX_VISIBILITY_PRESET "default")
endif()
Copyright (c) 2014, Sarah Hoffmann
Copyright (c) 2014-2018, Sarah Hoffmann
All rights reserved.
Redistribution and use in source and binary forms, with or without
......
include *md
include LICENSE.TXT
include lib/*.hpp
include CMakeLists.txt
include cmake/*.cmake
include lib/*.h
include lib/*.cc
include doc/*.rst
include examples/*py
include test/*py
include contrib/*.dll
......@@ -14,45 +14,38 @@ Python >= 2.7 is supported but a version >= 3.3 is strongly recommended.
Other requirements are:
* Python setuptools
* [Boost.Python](http://www.boost.org/doc/libs/1_56_0/libs/python/doc/index.html)
* protozero, expat, libz, libbz2 and Boost iterator
(see also [Libosmium dependencies](http://osmcode.org/libosmium/manual.html#dependencies))
* [cmake](https://cmake.org/)
* [Pybind11](https://github.com/pybind/pybind11) >= 2.2
* libosmium, protozero
* expat, libz, libbz2 and Boost variant and iterator
* a recent C++ compiler (Clang 3.4+, GCC 4.8+)
You have to compile with the same compiler version that Python is compiled with on
your system, otherwise it might not work.
## Installation
### Debian/Ubuntu
### Installing prerequisites
On Debian/Ubuntu systems all required dependencies can be installed with:
On Debian/Ubuntu-like systems the following should install all
dependencies required for installing via pip:
sudo apt-get install build-essential libboost-python-dev \
sudo apt-get install build-essential cmake libboost-dev \
libexpat1-dev zlib1g-dev libbz2-dev
### Homebrew (OS X)
On OS x Boost.Python needs to be installed with
`brew install boost-python` or `brew install boost-python3`
depending on which Python version you want to use. You can also (re)install
both.
## Installation
### Using Pip
The recommended way to install pyosmium is via pip:
pip install osmium
There are also experimental binary wheels for Windows available.
You need to install development packages first for the dependencies
mentioned above. For Windows, there are also experimental binary wheels
available with all required dependencies packed already.
### Compiling from Source
When compiling from source, you need to get the latest libosmium version
first. It is recommended to put it next to the pyosmium source. The setup
script uses per default either a globally installed libosmium or
looks for the source in `../libosmium`. You can set a custom location with
`LIBOSMIUM_PREFIX`.
Get the latest versions of libosmium, protozero and pybind11. It is
recommended that you put them in a subdirectory `contrib`. You can also
set custom locations with `LIBOSMIUM_PREFIX`, `PROTOZERO_PREFIX` and
`PYBIND11_PREFIX` respectively.
To use a custom boost installation, set `BOOST_PREFIX`.
......@@ -62,13 +55,7 @@ To compile the bindings, run
To compile and install the bindings, run
python setup.py install --user
to install only for your user, or
python setup.py install
to install globally.
python setup.py install [--user]
## Examples
......
......@@ -16,18 +16,15 @@ pyosmium can be installed with pip:
pip install osmium
The Pypi source package already comes bundled with a matching version of
libosmium. The library uses `Boost.Python`_ to create the C++ bindings.
On Debian/Ubuntu install `libboost-python-dev`.
On OS X run `brew install boost-python` or `brew install boost-python --with-python3`
depending on which python version you want to use. You can also (re)install both.
libosmium, protozero and pybind11. Pyosmium additionally depends on
expat, libz, libbz2 and Boost variant and iterator. You need to install
development packages for these libraries. On Debian/Ubuntu do::
Python >= 2.7 is supported but a version >= 3.3 is strongly recommended.
sudo apt-get install build-essential cmake libboost-dev \
libexpat1-dev zlib1g-dev libbz2-dev
Other dependencies are expat, libz, libbz2 and Boost iterator.
See `Libosmium dependencies`_ for required packages for various distributions.
.. _Boost.Python: http://www.boost.org/doc/libs/1_56_0/libs/python/doc/index.html
.. _Libosmium dependencies: http://osmcode.org/libosmium/manual.html#dependencies
Python >= 2.7 is supported but a version >= 3.3 is strongly recommended.
Documentation
=============
......
environment:
global:
BZIP2_VER: 1.0.6
EXPAT_VER: 2.2.5
ZLIB_VER: 1.2.11
BOOST_PREFIX: C:\Libraries\boost_1_67_0
matrix:
- PYTHON: "C:\\Python27-x64"
DEVPACK: pyosmium_libs27-b63.7z
PIPINSTALLS: nose wheel mock
arch: x64
- PYTHON: "C:\\Python36-x64"
DEVPACK: pyosmium_libs36-b63.7z
PIPINSTALLS: nose wheel
arch: x64
os: Visual Studio 2015
clone_depth: 1
init:
- git config --global core.autocrlf input
- if "%arch%"=="x86" (
set vcvarsall_arg=x86&&
set conda_path=C:\Miniconda36\Scripts&&
set conda_library_path=C:\Miniconda36\envs\pyosmium\Library&&
set build_type=Release)
- if "%arch%"=="x64" (
set vcvarsall_arg=amd64&&
set conda_path=C:\Miniconda36-x64\Scripts&&
set conda_library_path=C:\Miniconda36-x64\envs\pyosmium\Library&&
set build_type=Release)
- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall" %vcvarsall_arg%'
install:
- set PATH=%PATH%;%conda_path%
- cd c:\
- conda config --set always_yes yes
- conda create --name pyosmium
- activate pyosmium
- conda install bzip2=%BZIP2_VER% expat=%EXPAT_VER% zlib=%ZLIB_VER%
- SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
- SET VS90COMNTOOLS=%VS140COMNTOOLS%
- cd "c:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\"
- ren "Visual C++ for Python" "Visual C++ for Python Do Not Use"
- cd "C:\Program Files (x86)\"
- ren "Microsoft Visual Studio 9.0" "Microsoft Visual Studio 9.0 Do Not Use"
- python --version
- cd c:\dev
- git clone --depth 10 https://github.com/osmcode/libosmium.git
- git clone --depth 10 https://github.com/mapbox/protozero.git
- git clone --depth 10 https://github.com/osmcode/libosmium.git pyosmium/contrib/libosmium
- git clone --depth 10 https://github.com/mapbox/protozero.git pyosmium/contrib/protozero
- git clone --depth 10 https://github.com/pybind/pybind11.git pyosmium/contrib/pybind11
- dir c:\dev
- IF NOT EXIST pyosmium_libs_Release.7z ECHO downloading dependencies pack... && powershell Invoke-WebRequest https://github.com/alex85k/pyosmium_libs/releases/download/0.3/%DEVPACK% -OutFile %DEVPACK%
- cd c:\
- 7z x c:\dev\%DEVPACK%
- dir c:\libs\include
- dir c:\libs\lib
- pip install %PIPINSTALLS%
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
# clone directory
clone_folder: c:\dev\pyosmium
build_script:
- cd c:\dev\pyosmium
- SET BOOST_PREFIX=c:/libs
- SET BOOST_VERSION=1_63
- python setup.py build
- python setup.py install --user
......@@ -50,7 +62,9 @@ test_script:
after_test:
- cd c:\dev\pyosmium
- copy c:\libs\lib\*.dll c:\dev\pyosmium\src\osmium
- copy /y %conda_library_path%\bin\zlib.dll c:\dev\pyosmium\contrib
- copy /y %conda_library_path%\bin\expat.dll c:\dev\pyosmium\contrib
- copy /y %conda_library_path%\bin\libbz2.dll c:\dev\pyosmium\contrib
- "%PYTHON%\\python.exe setup.py bdist_wheel"
artifacts:
......
#----------------------------------------------------------------------
#
# FindOsmium.cmake
#
# Find the Libosmium headers and, optionally, several components needed
# for different Libosmium functions.
#
#----------------------------------------------------------------------
#
# Usage:
#
# Copy this file somewhere into your project directory, where cmake can
# find it. Usually this will be a directory called "cmake" which you can
# add to the CMake module search path with the following line in your
# CMakeLists.txt:
#
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#
# Then add the following in your CMakeLists.txt:
#
# find_package(Osmium [version] REQUIRED COMPONENTS <XXX>)
# include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
#
# The version number is optional. If it is not set, any version of
# libosmium will do.
#
# For the <XXX> substitute a space separated list of one or more of the
# following components:
#
# pbf - include libraries needed for PBF input and output
# xml - include libraries needed for XML input and output
# io - include libraries needed for any type of input/output
# geos - include if you want to use any of the GEOS functions
# gdal - include if you want to use any of the OGR functions
# proj - include if you want to use any of the Proj.4 functions
# sparsehash - include if you use the sparsehash index
#
# You can check for success with something like this:
#
# if(NOT OSMIUM_FOUND)
# message(WARNING "Libosmium not found!\n")
# endif()
#
#----------------------------------------------------------------------
#
# Variables:
#
# OSMIUM_FOUND - True if Osmium found.
# OSMIUM_INCLUDE_DIRS - Where to find include files.
# OSMIUM_XML_LIBRARIES - Libraries needed for XML I/O.
# OSMIUM_PBF_LIBRARIES - Libraries needed for PBF I/O.
# OSMIUM_IO_LIBRARIES - Libraries needed for XML or PBF I/O.
# OSMIUM_LIBRARIES - All libraries Osmium uses somewhere.
#
#----------------------------------------------------------------------
# This is the list of directories where we look for osmium includes.
set(_osmium_include_path
../libosmium
~/Library/Frameworks
/Library/Frameworks
/opt/local # DarwinPorts
/opt
)
# Look for the header file.
find_path(OSMIUM_INCLUDE_DIR osmium/version.hpp
PATH_SUFFIXES include
PATHS ${_osmium_include_path}
)
# Check libosmium version number
if(Osmium_FIND_VERSION)
file(STRINGS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp" _libosmium_version_define REGEX "#define LIBOSMIUM_VERSION_STRING")
if("${_libosmium_version_define}" MATCHES "#define LIBOSMIUM_VERSION_STRING \"([0-9.]+)\"")
set(_libosmium_version "${CMAKE_MATCH_1}")
else()
set(_libosmium_version "unknown")
endif()
endif()
set(OSMIUM_INCLUDE_DIRS "${OSMIUM_INCLUDE_DIR}")
#----------------------------------------------------------------------
#
# Check for optional components
#
#----------------------------------------------------------------------
if(Osmium_FIND_COMPONENTS)
foreach(_component ${Osmium_FIND_COMPONENTS})
string(TOUPPER ${_component} _component_uppercase)
set(Osmium_USE_${_component_uppercase} TRUE)
endforeach()
endif()
#----------------------------------------------------------------------
# Component 'io' is an alias for 'pbf' and 'xml'
if(Osmium_USE_IO)
set(Osmium_USE_PBF TRUE)
set(Osmium_USE_XML TRUE)
endif()
#----------------------------------------------------------------------
# Component 'ogr' is an alias for 'gdal'
if(Osmium_USE_OGR)
set(Osmium_USE_GDAL TRUE)
endif()
#----------------------------------------------------------------------
# Component 'pbf'
if(Osmium_USE_PBF)
find_package(ZLIB)
find_package(Threads)
find_package(Protozero 1.5.1)
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_FOUND)
list(APPEND OSMIUM_PBF_LIBRARIES
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
list(APPEND OSMIUM_INCLUDE_DIRS
${ZLIB_INCLUDE_DIR}
${PROTOZERO_INCLUDE_DIR}
)
else()
message(WARNING "Osmium: Can not find some libraries for PBF input/output, please install them or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
# Component 'xml'
if(Osmium_USE_XML)
find_package(EXPAT)
find_package(BZip2)
find_package(ZLIB)
find_package(Threads)
list(APPEND OSMIUM_EXTRA_FIND_VARS EXPAT_FOUND BZIP2_FOUND ZLIB_FOUND Threads_FOUND)
if(EXPAT_FOUND AND BZIP2_FOUND AND ZLIB_FOUND AND Threads_FOUND)
list(APPEND OSMIUM_XML_LIBRARIES
${EXPAT_LIBRARIES}
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
list(APPEND OSMIUM_INCLUDE_DIRS
${EXPAT_INCLUDE_DIR}
${BZIP2_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
else()
message(WARNING "Osmium: Can not find some libraries for XML input/output, please install them or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
list(APPEND OSMIUM_IO_LIBRARIES
${OSMIUM_PBF_LIBRARIES}
${OSMIUM_XML_LIBRARIES}
)
list(APPEND OSMIUM_LIBRARIES
${OSMIUM_IO_LIBRARIES}
)
#----------------------------------------------------------------------
# Component 'geos'
if(Osmium_USE_GEOS)
find_path(GEOS_INCLUDE_DIR geos/geom.h)
find_library(GEOS_LIBRARY NAMES geos)
list(APPEND OSMIUM_EXTRA_FIND_VARS GEOS_INCLUDE_DIR GEOS_LIBRARY)
if(GEOS_INCLUDE_DIR AND GEOS_LIBRARY)
SET(GEOS_FOUND 1)
list(APPEND OSMIUM_LIBRARIES ${GEOS_LIBRARY})
list(APPEND OSMIUM_INCLUDE_DIRS ${GEOS_INCLUDE_DIR})
else()
message(WARNING "Osmium: GEOS library is required but not found, please install it or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
# Component 'gdal' (alias 'ogr')
if(Osmium_USE_GDAL)
find_package(GDAL)
list(APPEND OSMIUM_EXTRA_FIND_VARS GDAL_FOUND)
if(GDAL_FOUND)
list(APPEND OSMIUM_LIBRARIES ${GDAL_LIBRARIES})
list(APPEND OSMIUM_INCLUDE_DIRS ${GDAL_INCLUDE_DIRS})
else()
message(WARNING "Osmium: GDAL library is required but not found, please install it or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
# Component 'proj'
if(Osmium_USE_PROJ)
find_path(PROJ_INCLUDE_DIR proj_api.h)
find_library(PROJ_LIBRARY NAMES proj)
list(APPEND OSMIUM_EXTRA_FIND_VARS PROJ_INCLUDE_DIR PROJ_LIBRARY)
if(PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
set(PROJ_FOUND 1)
list(APPEND OSMIUM_LIBRARIES ${PROJ_LIBRARY})
list(APPEND OSMIUM_INCLUDE_DIRS ${PROJ_INCLUDE_DIR})
else()
message(WARNING "Osmium: PROJ.4 library is required but not found, please install it or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
# Component 'sparsehash'
if(Osmium_USE_SPARSEHASH)
find_path(SPARSEHASH_INCLUDE_DIR google/sparsetable)
list(APPEND OSMIUM_EXTRA_FIND_VARS SPARSEHASH_INCLUDE_DIR)
if(SPARSEHASH_INCLUDE_DIR)
# Find size of sparsetable::size_type. This does not work on older
# CMake versions because they can do this check only in C, not in C++.
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
include(CheckTypeSize)
set(CMAKE_REQUIRED_INCLUDES ${SPARSEHASH_INCLUDE_DIR})
set(CMAKE_EXTRA_INCLUDE_FILES "google/sparsetable")
check_type_size("google::sparsetable<int>::size_type" SPARSETABLE_SIZE_TYPE LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_REQUIRED_INCLUDES)
else()
set(SPARSETABLE_SIZE_TYPE ${CMAKE_SIZEOF_VOID_P})
endif()
# Sparsetable::size_type must be at least 8 bytes (64bit), otherwise
# OSM object IDs will not fit.
if(SPARSETABLE_SIZE_TYPE GREATER 7)
set(SPARSEHASH_FOUND 1)
add_definitions(-DOSMIUM_WITH_SPARSEHASH=${SPARSEHASH_FOUND})
list(APPEND OSMIUM_INCLUDE_DIRS ${SPARSEHASH_INCLUDE_DIR})
else()
message(WARNING "Osmium: Disabled Google SparseHash library on 32bit system (size_type=${SPARSETABLE_SIZE_TYPE}).")
endif()
else()
message(WARNING "Osmium: Google SparseHash library is required but not found, please install it or configure the paths.")
endif()
endif()
#----------------------------------------------------------------------
list(REMOVE_DUPLICATES OSMIUM_INCLUDE_DIRS)
if(OSMIUM_XML_LIBRARIES)
list(REMOVE_DUPLICATES OSMIUM_XML_LIBRARIES)
endif()
if(OSMIUM_PBF_LIBRARIES)
list(REMOVE_DUPLICATES OSMIUM_PBF_LIBRARIES)
endif()
if(OSMIUM_IO_LIBRARIES)
list(REMOVE_DUPLICATES OSMIUM_IO_LIBRARIES)
endif()
if(OSMIUM_LIBRARIES)
list(REMOVE_DUPLICATES OSMIUM_LIBRARIES)
endif()
#----------------------------------------------------------------------
#
# Check that all required libraries are available
#
#----------------------------------------------------------------------
if(OSMIUM_EXTRA_FIND_VARS)
list(REMOVE_DUPLICATES OSMIUM_EXTRA_FIND_VARS)
endif()
# Handle the QUIETLY and REQUIRED arguments and the optional version check
# and set OSMIUM_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Osmium
REQUIRED_VARS OSMIUM_INCLUDE_DIR ${OSMIUM_EXTRA_FIND_VARS}
VERSION_VAR _libosmium_version)
unset(OSMIUM_EXTRA_FIND_VARS)
#----------------------------------------------------------------------
#
# A function for setting the -pthread option in compilers/linkers
#
#----------------------------------------------------------------------
function(set_pthread_on_target _target)
if(NOT MSVC)
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS "-pthread")
if(NOT APPLE)
set_target_properties(${_target} PROPERTIES LINK_FLAGS "-pthread")
endif()
endif()
endfunction()
#----------------------------------------------------------------------
#
# Add compiler flags
#
#----------------------------------------------------------------------
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
if(MSVC)
add_definitions(-wd4996)
# Disable warning C4068: "unknown pragma" because we want it to ignore
# pragmas for other compilers.
add_definitions(-wd4068)
# Disable warning C4715: "not all control paths return a value" because
# it generates too many false positives.
add_definitions(-wd4715)
# Disable warning C4351: new behavior: elements of array '...' will be
# default initialized. The new behaviour is correct and we don't support
# old compilers anyway.
add_definitions(-wd4351)
# Disable warning C4503: "decorated name length exceeded, name was truncated"
# there are more than 150 of generated names in libosmium longer than 4096 symbols supported in MSVC
add_definitions(-wd4503)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS)
endif()
if(APPLE)
# following only available from cmake 2.8.12:
# add_compile_options(-stdlib=libc++)
# so using this instead:
add_definitions(-stdlib=libc++)
set(LDFLAGS ${LDFLAGS} -stdlib=libc++)
endif()
#----------------------------------------------------------------------
# This is a set of recommended warning options that can be added when compiling
# libosmium code.
if(MSVC)
set(OSMIUM_WARNING_OPTIONS "/W3 /wd4514" CACHE STRING "Recommended warning options for libosmium")
else()
set(OSMIUM_WARNING_OPTIONS "-Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast" CACHE STRING "Recommended warning options for libosmium")
endif()
set(OSMIUM_DRACONIC_CLANG_OPTIONS "-Wdocumentation -Wunused-exception-parameter -Wmissing-declarations -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-exit-time-destructors -Wno-global-constructors -Wno-padded -Wno-switch-enum -Wno-missing-prototypes -Wno-weak-vtables -Wno-cast-align -Wno-float-equal")
if(Osmium_DEBUG)
message(STATUS "OSMIUM_XML_LIBRARIES=${OSMIUM_XML_LIBRARIES}")
message(STATUS "OSMIUM_PBF_LIBRARIES=${OSMIUM_PBF_LIBRARIES}")
message(STATUS "OSMIUM_IO_LIBRARIES=${OSMIUM_IO_LIBRARIES}")
message(STATUS "OSMIUM_LIBRARIES=${OSMIUM_LIBRARIES}")
message(STATUS "OSMIUM_INCLUDE_DIRS=${OSMIUM_INCLUDE_DIRS}")
endif()
#----------------------------------------------------------------------
#
# FindProtozero.cmake
#
# Find the protozero headers.
#
#----------------------------------------------------------------------
#
# Usage:
#
# Copy this file somewhere into your project directory, where cmake can
# find it. Usually this will be a directory called "cmake" which you can
# add to the CMake module search path with the following line in your
# CMakeLists.txt:
#
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#
# Then add the following in your CMakeLists.txt:
#
# find_package(Protozero [version] [REQUIRED])
# include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})
#
# The version number is optional. If it is not set, any version of
# protozero will do.
#
# if(NOT PROTOZERO_FOUND)
# message(WARNING "Protozero not found!\n")
# endif()
#
#----------------------------------------------------------------------
#
# Variables:
#
# PROTOZERO_FOUND - True if Protozero was found.
# PROTOZERO_INCLUDE_DIR - Where to find include files.
#
#----------------------------------------------------------------------
# find include path
find_path(PROTOZERO_INCLUDE_DIR protozero/version.hpp
PATH_SUFFIXES include
PATHS ${CMAKE_SOURCE_DIR}/../protozero
)
# Check version number
if(Protozero_FIND_VERSION)
file(STRINGS "${PROTOZERO_INCLUDE_DIR}/protozero/version.hpp" _version_define REGEX "#define PROTOZERO_VERSION_STRING")
if("${_version_define}" MATCHES "#define PROTOZERO_VERSION_STRING \"([0-9.]+)\"")
set(_version "${CMAKE_MATCH_1}")
else()
set(_version "unknown")
endif()
endif()
#set(PROTOZERO_INCLUDE_DIRS "${PROTOZERO_INCLUDE_DIR}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Protozero
REQUIRED_VARS PROTOZERO_INCLUDE_DIR
VERSION_VAR _version)
#----------------------------------------------------------------------
pyosmium (2.15.0-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
* Add patch for pybind11 2.2.4, as 2.0.1 is not supported.
-- Bas Couwenberg <sebastic@debian.org> Mon, 17 Dec 2018 10:54:02 +0100
pyosmium (2.15.0-1) unstable; urgency=medium
* New upstream release.
* Add build dependencies.
* Explicitly set distutils for pybuild build system.
* Enable verbose CMake output.
* Drop obsolete libboost-python-dev build dependency.
* Append CPPFLAGS to CXXFLAGS.
* Drop unusued overrides for hardening-no-fortify-functions.
* Update copyright years for Sarah Hoffmann.
* Bump minimum required libosmium2-dev to 2.15.0.
-- Bas Couwenberg <sebastic@debian.org> Sun, 09 Dec 2018 18:08:28 +0100
pyosmium (2.14.4-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
......
......@@ -3,16 +3,17 @@ Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
Uploaders: Bas Couwenberg <sebastic@debian.org>
Section: science
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: cmake (>= 2.8.12),
debhelper (>= 9),
dh-python,
libboost-dev,
libboost-python-dev,
libbz2-dev,
libexpat1-dev,
libgdal-dev,
libgeos++-dev,
libosmium2-dev (>= 2.14.2),
libosmium2-dev (>= 2.15.0),
libsparsehash-dev,
pybind11-dev,
python-all-dev,
python-setuptools,
python-mock,
......
......@@ -4,7 +4,7 @@ Upstream-Contact: Osmium Developers (https://osmcode.org/contact)
Source: https://github.com/osmcode/pyosmium
Files: *
Copyright: 2014-2017, Sarah Hoffmann <lonvia@denofr.de>
Copyright: 2014-2018, Sarah Hoffmann <lonvia@denofr.de>
License: BSD-2-Clause
Files: debian/*
......
This diff is collapsed.
pybind11-2.2.4.patch
# Build uses -D_FORTIFY_SOURCE=2, but hardening-check reports:
# Fortify Source functions: no, only unprotected functions found!
python-pyosmium: hardening-no-fortify-functions usr/lib/python2*/dist-packages/osmium/replication/_replication.*.so
python-pyosmium: hardening-no-fortify-functions usr/lib/python2*/dist-packages/osmium/index.*.so
# Build uses -D_FORTIFY_SOURCE=2, but hardening-check reports:
# Fortify Source functions: no, only unprotected functions found!
python3-pyosmium: hardening-no-fortify-functions usr/lib/python3*/dist-packages/osmium/replication/_replication.*.so
python3-pyosmium: hardening-no-fortify-functions usr/lib/python3*/dist-packages/osmium/index.*.so
......@@ -5,7 +5,12 @@
# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export DEB_CXXFLAGS_MAINT_APPEND=$(shell DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --get CPPFLAGS)
export PYBUILD_NAME=pyosmium
export PYBUILD_SYSTEM=distutils
export VERBOSE=1
%:
dh $@ \
......
......@@ -105,12 +105,15 @@ ways and areas. The :py:meth:`~!osmium.SimpleHandler.apply_file` method cannot
deduce by itself if this cache is needed. Therefore locations need to be
explicitly enabled by setting the locations parameter to True::
h.apply_file("test.osm.pbf", locations=True, idx='sparse_mem_array')
h.apply_file("test.osm.pbf", locations=True, idx='flex_mem')
The third parameter `idx` is optional and states what kind of cache
osmium is supposed to use. The default `sparse_mem_array` is a good
choice for small to medium size extracts of OSM data. If you plan to
process the whole planet file, `dense_mmap_array` is better suited.
osmium is supposed to use. The default `flex_mem` is a good
choice for most uses. If you plan to process large amount of data (e.g.
Europe or planet) and are tight on RAM then `dense_mmap_array` may be
better suited. This kind of index is able to temporarily store data on disk.
However, it does not work on MacOS and Windows.
If you want the cache to be persistent across invocations, you
can use `dense_file_array` giving an additional file location for the
cache like that::
......