40c4a48 Release v2.10.0 6addb2e Search for protozero also in the place where libosmium was found. 9c0d4bb Consistently use lhs and rhs as parameter names in operators etc. 6179759 Update change log. 894eb7d Explicitly use size_t to get no narrowing conversions. e549e73 Fix CMake config for index_lookup. ccf0bc2 Fix bug where some compilers deduce the wrong type. fc3507d Cleaned and documented index example and renamed to osmium_index_lookup. d3c3036 Rename serdump example to dump_internal and document it. 0e9822e Also forward set_uid_from_signed() function. 29ef95c Rename build_taglist function because it was to similar to build_tag_list. c088dd0 Move static constant out of class so clang will compile it. 606cdc4 Fix CMake build script: Path for finding libosmium. 65f91fe Removed unused typedef. 07174f5 Use condition_variable to tell producer when thread queue is not full. b35e957 Some code cleanup in XML parser. c703dff Fix problem with MemberMeta. 1ccbbef Refactoring CompressionFactory. 6561bd6 Use our own exception type for map factory errors. 56e31fa Throw not_found error directly instead of using helper function. 28230c3 Test empty value for node location store, reorganize tests. 2ba316c Reorganize and fix projection tests. f949485 Don't run quite as many tests with projections because they are slow. 1bad16d Add information about build environment to benchmark output. 99617bb Change proj_geojson benchmark into mercator benchmark. 553b946 Allow optional parameters on Reader in any order. dcc3d8f Factor out some common code. 004d8cd Fix forwarding constructor. 9702978 Fix metadata check. 6cfb6c4 Faster implementation of decode_dense_nodes without reading metdata. 4ba4638 Add additional read_metadata parameter to other Reader constructors. d005937 Optionally ignore metadata when reading file. 63961da Mark all CRC32 update functions as noexcept. cc4ca75 Refactor set_user() function to speed it up. 38d19dc Update comments with file sizes. OSM has grown... f7d0824 Add new benchmark that shows performance when main thread is busy. 25070dc Use const ref params. 88e8d96 Mark add_user() as deprecated. f58d9db Refactor some low-level collection code to clean up code. 4680def Add example showing how to create OSM data out of thin air. d42fd50 Add an example showing how tags in OSM files can be changed. 49bf5bc Add additional constructors to Builders taking a reference to parent. 7b91d63 Change Builder::add_item() to take a reference instead of pointer. 2957e48 Some cleanup of examples. d0b458d Calculate size of object at compile time. 3fbb6e7 Use explicit cast. 1851f3d Remove a test that depends on math details. f6a0802 Various cleanups of example programs. ba4921f Rename add_user() to set_user(). d7637c9 Various cleanups related to builders. 07827bc Fix add_user(). 9a5b395 Also refactor OSMObjectBuilder like ChangesetBuilder before. b1f423c Use call chaining on the builder. e49473d Get rid of ObjectBuilder class. 67d70b9 Refactor ChangesetBuilder::add_user(). 8199c33 Make ChangesetBuilder derive directly from Builder. 61d1b67 Simplify some code. d38467a Change derivation hierarchy of some builder classes. b52f8af Refactor Builder code. d012bfa Refactored some code setting attributes on objects using builder instead. 6a05f60 Also forward set_removed function from builders. 8d63b7d Return *this from Builder setter functions and test it. 72a1266 Update catch.hpp to newest version. 3424a74 Check GEOS version is <= 3.5. aee9f9d Cleanup test code. aef198c Improved asserts in Buffer. a98b9bf Code cleanup in tests. a150466 Use GDAL/OGR instead of GEOS to test our WKB implementation. b04a525 Refactor test. 39aa932 Refactored test_factory_with_projection so it works without GEOS. 648f43a Remove unused dependency on geos from tile test. f1748ae Add setters to Builder classes forwarding to underlying objects. 8166879 In debug mode check that Builders are correctly called and destructed. 1c4257e Call commit() on buffer only after all builders are destructed. 2618636 Add functions to check availability of relation members. b45a4d9 Mark RelationMember::set_ref() as deprecated. 7886771 Move "basic" and "buffer" tests to "osm" and "memory", respectively. b664685 Use functions instead of macros in location test for faster compile. b4929ac Add more tests for number parser. 02662a7 Merge pull request #171 from lonvia/fix-long-exponentials 5344a6c fix parsing of numbers in e-notiation with many post-comma digits 3aeaff3 Add some typedefs to NodeRefList and memory::Collection. e750665 Add iterators to IdSetSmall and add docs and tests to IdSet classes. 50ecb2a Add more features to IdSetDense, including unset and iterator. e3dec78 Make IdSet virtual base class with two implementations. 8ea0153 Use C array instead of std::array in IdSet and clear explicitly. 3ba9905 Deprecate osmium::index::BoolVector in favour of new IdSet. 453d1ca Add osmium::index::IdSet. c78254e Add function to (temporarily) disable the progress bar. 4d88a9f Better document osmium::io::Header class. 320e3af Look for protozero includes in CMake config. 838d25e Allow optional checking for libosmium version number in CMake config. 6ce60c1 Fix entity_bits static_assert() tests. f054731 Update change log. 77ac4c2 Make sleep duration for full queues much smaller. 7e39c01 Make some entity_bits functions constexpr. 69ea72f Fix ~ operator on entity_bits and more tests for entity bits. dafe4cf Update embedded Catch unit test header to version 1.5.7. a41c832 Fixed parsing of location coordinates starting with decimal dot. 6523bae README cosmetics. 229acac Add tests for some examples. f1e753d Merge pull request #163 from sebastic/executable-not-elf-or-script ccea2d5 Remove executable bit from .cpp files. af77fb4 Changelog formatting fixes. git-subtree-dir: third_party/libosmium git-subtree-split: 40c4a48f88d25edace6f0b9e079c306308c7760b
353 lines
12 KiB
CMake
353 lines
12 KiB
CMake
#----------------------------------------------------------------------
|
|
#
|
|
# 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 and protozero
|
|
# 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)
|
|
|
|
message(STATUS "Looking for protozero")
|
|
find_path(PROTOZERO_INCLUDE_DIR protozero/version.hpp
|
|
PATH_SUFFIXES include
|
|
PATHS ${_osmium_include_path}
|
|
${OSMIUM_INCLUDE_DIR}
|
|
)
|
|
if(PROTOZERO_INCLUDE_DIR)
|
|
message(STATUS "Looking for protozero - found")
|
|
else()
|
|
message(STATUS "Looking for protozero - not found")
|
|
endif()
|
|
|
|
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
|
|
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_INCLUDE_DIR)
|
|
list(APPEND OSMIUM_PBF_LIBRARIES
|
|
${ZLIB_LIBRARIES}
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
)
|
|
if(WIN32)
|
|
# This is needed for the ntohl() function
|
|
list(APPEND OSMIUM_PBF_LIBRARIES ws2_32)
|
|
endif()
|
|
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)
|
|
|
|
#----------------------------------------------------------------------
|
|
#
|
|
# 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)
|
|
|
|
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()
|
|
|