[osmium-tool] 43/97: Updated cmake config.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 21 20:15:33 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 6e0c6a3c289401959f9a33fc2bafd58fa1e56593
Author: Jochen Topf <jochen at topf.org>
Date:   Tue Dec 16 09:57:51 2014 +0100

    Updated cmake config.
    
    This brings it in line with the changes done earlier in osmium-contrib.
---
 CMakeLists.txt            |  42 ++----------------
 cmake/FindOSMPBF.cmake    |   6 +--
 cmake/FindOsmium.cmake    | 106 ++++++++++++++++++++++++++++++++++++++++++++++
 cmake/OsmiumOptions.cmake |  32 ++++++++++++++
 4 files changed, 144 insertions(+), 42 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 708cc3a..3c01e77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,7 +67,9 @@ if(NOT CRYPTOPP_FOUND)
     set(MISSING_LIB 1)
 endif()
 
-find_package(Osmium REQUIRED)
+include(OsmiumOptions)
+
+find_package(Osmium REQUIRED COMPONENTS io)
 include_directories(${OSMIUM_INCLUDE_DIRS})
 if(NOT OSMIUM_FOUND)
     message(WARNING "Libosmium not found!\n")
@@ -208,44 +210,6 @@ include_directories(${PROJECT_BINARY_DIR}/src)
 
 
 #----------------------------------------------------------------------
-#
-#  C++ compilation options
-#
-#----------------------------------------------------------------------
-add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
-
-if(MSVC)
-    add_definitions(-wd4996 -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS)
-else()
-    add_compile_options(-std=c++11)
-    add_compile_options(
-        -Wall
-        -Wextra
-        -pedantic
-        -Wredundant-decls
-        -Wdisabled-optimization
-        -Wctor-dtor-privacy
-        -Wnon-virtual-dtor
-        -Woverloaded-virtual
-        -Wsign-promo
-        -Wold-style-cast
-    )
-    #always compile with optimization, even in debug mode
-    set(CMAKE_CXX_FLAGS_DEBUG -O3)
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
-endif()
-
-if (WIN32)
-    list(APPEND LIBRARIES ws2_32)
-endif()
-
-if(APPLE)
-    add_compile_options(-stdlib=libc++)
-    set(LDFLAGS ${LDFLAGS} -stdlib=libc++)
-endif(APPLE)
-
-
-#----------------------------------------------------------------------
 
 add_subdirectory(src)
 
diff --git a/cmake/FindOSMPBF.cmake b/cmake/FindOSMPBF.cmake
index 168d064..734042e 100644
--- a/cmake/FindOSMPBF.cmake
+++ b/cmake/FindOSMPBF.cmake
@@ -9,7 +9,7 @@
 # and not
 #  #include <osmpbf.h>
 
-FIND_PATH(OSMPBF_INCLUDE_DIR osmpbf/osmpbf.h
+find_path(OSMPBF_INCLUDE_DIR osmpbf/osmpbf.h
   HINTS
   $ENV{OSMPBF_DIR}
   PATH_SUFFIXES include
@@ -22,7 +22,7 @@ FIND_PATH(OSMPBF_INCLUDE_DIR osmpbf/osmpbf.h
   /opt
 )
 
-FIND_LIBRARY(OSMPBF_LIBRARY
+find_library(OSMPBF_LIBRARY
   NAMES osmpbf
   HINTS
   $ENV{OSMPBF_DIR}
@@ -36,7 +36,7 @@ FIND_LIBRARY(OSMPBF_LIBRARY
   /opt
 )
 
-INCLUDE(FindPackageHandleStandardArgs)
+include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set OSMPBF_FOUND to TRUE if
 # all listed variables are TRUE
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSMPBF DEFAULT_MSG OSMPBF_LIBRARY OSMPBF_INCLUDE_DIR)
diff --git a/cmake/FindOsmium.cmake b/cmake/FindOsmium.cmake
index 6f49169..da11989 100644
--- a/cmake/FindOsmium.cmake
+++ b/cmake/FindOsmium.cmake
@@ -9,6 +9,7 @@ find_path(OSMIUM_INCLUDE_DIR osmium/osm.hpp
     PATH_SUFFIXES include
     PATHS
     ../libosmium
+    ../../libosmium
     libosmium
     ~/Library/Frameworks
     /Library/Frameworks
@@ -28,3 +29,108 @@ if(OSMIUM_FOUND)
   set(OSMIUM_INCLUDE_DIRS ${OSMIUM_INCLUDE_DIR})
 endif()
 
+if(Osmium_FIND_REQUIRED AND NOT OSMIUM_FOUND)
+  message(FATAL_ERROR "Can not find libosmium headers, please install them or configure the paths")
+endif()
+
+
+if(";${Osmium_FIND_COMPONENTS};" MATCHES ";io;")
+  find_package(OSMPBF)
+  find_package(Protobuf)
+  find_package(ZLIB)
+  find_package(BZip2)
+  find_package(EXPAT)
+  find_package(Threads)
+
+  if(OSMPBF_FOUND AND PROTOBUF_FOUND AND ZLIB_FOUND AND BZIP2_FOUND AND EXPAT_FOUND AND Threads_FOUND)
+    list(APPEND OSMIUM_LIBRARIES
+      ${OSMPBF_LIBRARIES} ${PROTOBUF_LITE_LIBRARY}
+      ${ZLIB_LIBRARY} ${BZIP2_LIBRARIES}
+      ${EXPAT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
+    list(APPEND OSMIUM_INCLUDE_DIRS
+      ${OSMPBF_INCLUDE_DIRS}
+      ${PROTOBUF_INCLUDE_DIR}
+      ${EXPAT_INCLUDE_DIR}
+      ${BZIP2_INCLUDE_DIR}
+      ${ZLIB_INCLUDE_DIR}
+    )
+    if(WIN32)
+      list(APPEND OSMIUM_LIBRARIES ws2_32)
+    endif()
+  else()
+    set(MISSING_LIBRARIES 1)
+    if(Osmium_FIND_REQUIRED)
+      message(FATAL_ERROR "Can not find some libraries for Osmium input/output formats, please install them or configure the paths")
+    endif()
+  endif()
+endif()
+
+if(";${Osmium_FIND_COMPONENTS};" MATCHES ";geos;")
+  ##### Find GEOS Library
+  find_path(GEOS_INCLUDE_DIR geos/geom.h)
+  find_library(GEOS_LIBRARY NAMES geos)
+  if(GEOS_INCLUDE_DIR AND GEOS_LIBRARY)
+    message(STATUS "Found GEOS: " ${GEOS_LIBRARY})
+    SET(GEOS_FOUND 1)
+    list(APPEND OSMIUM_LIBRARIES ${GEOS_LIBRARY})
+    list(APPEND OSMIUM_INCLUDE_DIRS ${GEOS_INCLUDE_DIR})
+  else()
+    set(MISSING_LIBRARIES 1)
+    if(Osmium_FIND_REQUIRED)
+      message(FATAL_ERROR "GEOS library is required but not found, please install it or configure the paths")
+    endif()
+  endif()
+endif()
+
+if(";${Osmium_FIND_COMPONENTS};" MATCHES ";gdal;")
+  find_package(GDAL)
+  if(NOT GDAL_FOUND)
+    set(MISSING_LIBRARIES 1)
+    if(Osmium_FIND_REQUIRED)
+      message(FATAL_ERROR "GDAL library is required but not found, please install it or configure the paths")
+    endif()
+  else()
+    list(APPEND OSMIUM_LIBRARIES ${GDAL_LIBRARY})
+    list(APPEND OSMIUM_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
+  endif()
+endif()
+
+if(";${Osmium_FIND_COMPONENTS};" MATCHES ";proj;")
+  ##### Find Proj.4 Library
+  find_path(PROJ_INCLUDE_DIR proj_api.h)
+  find_library(PROJ_LIBRARY NAMES proj)
+  if(PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
+    message(STATUS "Found PROJ: " ${PROJ_LIBRARY})
+    set(PROJ_FOUND 1)
+    list(APPEND OSMIUM_LIBRARIES ${PROJ_LIBRARY})
+    list(APPEND OSMIUM_INCLUDE_DIRS ${PROJ_INCLUDE_DIR})
+  else()
+    set(MISSING_LIBRARIES 1)
+    if(Osmium_FIND_REQUIRED)
+      message(FATAL_ERROR "PROJ library is required but not found, please install it or configure the paths")
+    endif()
+  endif()
+endif()
+
+if(";${Osmium_FIND_COMPONENTS};" MATCHES ";sparsehash;")
+  ##### Find Google SparseHash
+  find_path(SPARSEHASH_INCLUDE_DIR google/sparsetable)
+  if(SPARSEHASH_INCLUDE_DIR)
+    message(STATUS "Found SparseHash")
+    set(SPARSEHASH_FOUND 1)
+    list(APPEND OSMIUM_INCLUDE_DIRS ${SPARSEHASH_INCLUDE_DIR})
+  else()
+    set(MISSING_LIBRARIES 1)
+    if(Osmium_FIND_REQUIRED)
+      message(FATAL_ERROR "SparseHash library is required but not found, please install it or configure the paths")
+    endif()
+  endif()
+endif()
+
+list(REMOVE_DUPLICATES OSMIUM_INCLUDE_DIRS)
+list(REMOVE_DUPLICATES OSMIUM_LIBRARIES)
+
+if(Osmium_DEBUG)
+  message(STATUS "OSMIUM_LIBRARIES=" ${OSMIUM_LIBRARIES})
+  message(STATUS "OSMIUM_INCLUDE_DIRS=" ${OSMIUM_INCLUDE_DIRS})
+endif()
diff --git a/cmake/OsmiumOptions.cmake b/cmake/OsmiumOptions.cmake
new file mode 100644
index 0000000..01d8c0e
--- /dev/null
+++ b/cmake/OsmiumOptions.cmake
@@ -0,0 +1,32 @@
+# Setup common compiler options adviced for building Osmium headers
+
+add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
+
+if(MSVC)
+    add_definitions(-wd4996 -DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS)
+else()
+    add_compile_options(-std=c++11)
+    add_compile_options(
+        -Wall
+        -Wextra
+        -pedantic
+        -Wredundant-decls
+        -Wdisabled-optimization
+        -Wctor-dtor-privacy
+        -Wnon-virtual-dtor
+        -Woverloaded-virtual
+        -Wsign-promo
+        -Wold-style-cast
+    )
+
+    #always compile with optimization, even in debug mode
+    set(CMAKE_CXX_FLAGS_DEBUG -O3)
+    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
+endif()
+
+if(APPLE)
+    add_compile_options(-stdlib=libc++)
+    set(LDFLAGS ${LDFLAGS} -stdlib=libc++)
+endif(APPLE)
+
+message(STATUS "Some compiler and linker options were changed by OsmiumOptions")

-- 
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