[osmium-tool] 88/97: Update FindOsmium.cmake from libosmium repos

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 21 20:15:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to tag v1.0.0
in repository osmium-tool.

commit d2302bf17a24b370d2636cec42ad0a1878e7b1c0
Author: Jochen Topf <jochen at topf.org>
Date:   Wed Feb 11 17:50:48 2015 +0100

    Update FindOsmium.cmake from libosmium repos
---
 cmake/FindOsmium.cmake | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/cmake/FindOsmium.cmake b/cmake/FindOsmium.cmake
index 15b1e01..4c33708 100644
--- a/cmake/FindOsmium.cmake
+++ b/cmake/FindOsmium.cmake
@@ -224,8 +224,27 @@ if(Osmium_USE_SPARSEHASH)
     find_path(SPARSEHASH_INCLUDE_DIR google/sparsetable)
 
     if(SPARSEHASH_INCLUDE_DIR)
-        set(SPARSEHASH_FOUND 1)
-        list(APPEND OSMIUM_INCLUDE_DIRS ${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++.
+        # Until we find a better way, we'll live with that.
+        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)
+
+        # 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})
+        elseif(SPARSETABLE_SIZE_TYPE STREQUAL "")
+            message(WARNING "Osmium: Disabled Google SparseHash library because we can't detect whether we are on a 64bit system.")
+        else()
+            message(WARNING "Osmium: Disabled Google SparseHash library on 32bit system (size_type=${SPARSETABLE_SIZE_TYPE}).")
+        endif()
     else()
         set(_missing_libraries 1)
         message(WARNING "Osmium: Google SparseHash library is required but not found, please install it or configure the paths.")
@@ -270,12 +289,20 @@ 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()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git



More information about the Pkg-grass-devel mailing list