-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1fbc132
Showing
21 changed files
with
2,728 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.sh | ||
.*.swp | ||
*~ | ||
build/ | ||
*.input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
cmake_minimum_required(VERSION 3.5.0) | ||
project(mapnik-mbtiles-vector VERSION 0.0.1 LANGUAGES CXX C) | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
set(AUTHOR "Michael Reichert <[email protected]>") | ||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# | ||
# Find external dependencies | ||
# | ||
#----------------------------------------------------------------------------- | ||
|
||
find_package(Mapnik REQUIRED) | ||
find_package(Protozero REQUIRED) | ||
find_package(SQLite3 REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
find_package(Boost 1.55.0 REQUIRED) | ||
|
||
#----------------------------------------------------------------------------- | ||
# | ||
# Decide which C++ version to use (Minimum/default: C++17). | ||
# | ||
#----------------------------------------------------------------------------- | ||
if(NOT MSVC) | ||
if(NOT USE_CPP_VERSION) | ||
set(USE_CPP_VERSION c++17) | ||
endif() | ||
message(STATUS "Use C++ version: ${USE_CPP_VERSION}") | ||
# following only available from cmake 2.8.12: | ||
# add_compile_options(-std=${USE_CPP_VERSION}) | ||
# so using this instead: | ||
add_definitions(-std=${USE_CPP_VERSION}) | ||
endif() | ||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# | ||
# Compiler and Linker flags | ||
# | ||
#----------------------------------------------------------------------------- | ||
set(USUAL_COMPILE_OPTIONS "-O3 -g") | ||
|
||
set(CMAKE_CXX_FLAGS_DEV "${USUAL_COMPILE_OPTIONS}" | ||
CACHE STRING "Flags used by the compiler during developer builds." | ||
FORCE) | ||
|
||
set(CMAKE_EXE_LINKER_FLAGS_DEV "" | ||
CACHE STRING "Flags used by the linker during developer builds." | ||
FORCE) | ||
mark_as_advanced( | ||
CMAKE_CXX_FLAGS_DEV | ||
CMAKE_EXE_LINKER_FLAGS_DEV | ||
) | ||
|
||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${USUAL_COMPILE_OPTIONS}" | ||
CACHE STRING "Flags used by the compiler during RELWITHDEBINFO builds." | ||
FORCE) | ||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# | ||
# Build Type | ||
# | ||
#----------------------------------------------------------------------------- | ||
set(CMAKE_CONFIGURATION_TYPES "Debug Release RelWithDebInfo MinSizeRel Dev") | ||
|
||
# In 'Dev' mode: compile with very strict warnings and turn them into errors. | ||
if(CMAKE_BUILD_TYPE STREQUAL "Dev") | ||
if(NOT MSVC) | ||
add_definitions(-Werror -fno-omit-frame-pointer) | ||
endif() | ||
endif() | ||
|
||
# Force RelWithDebInfo build type if none was given | ||
if(CMAKE_BUILD_TYPE) | ||
set(build_type ${CMAKE_BUILD_TYPE}) | ||
else() | ||
set(build_type "RelWithDebInfo") | ||
endif() | ||
|
||
set(CMAKE_BUILD_TYPE ${build_type} | ||
CACHE STRING | ||
"Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}." | ||
FORCE) | ||
|
||
add_subdirectory(src) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# - Try to find Mapnik | ||
# Once done this will define | ||
# | ||
# MAPNIK_FOUND - system has Mapnik | ||
# MAPNIK_INCLUDE_DIRS - the Mapnik include directory | ||
# MAPNIK_DEPS_INCLUDE_DIRS - the include directory where header-only | ||
# dependencies of Mapnik can be found | ||
# MAPNIK_LIBRARIES - Link these to use Mapnik | ||
# MAPNIK_CONFIG - mapnik-config binary | ||
# MAPNIK_CXXFLAGS - mapnik-config --cflags) | ||
# MAPNIK_LDFLAGS - mapnik-config --libs) | ||
# MAPNIK_PLUGINDIR - mapnik-config --input-plugins) | ||
# | ||
# Copyright (c) 2007 Andreas Schneider <[email protected]> | ||
# Copyright (c) 2014 Maxim Dementyev <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# 1. Redistributions of source code must retain the copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# 3. The name of the author may not be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
|
||
if (MAPNIK_LIBRARIES AND MAPNIK_INCLUDE_DIRS AND MAPNIK_DEPS_INCLUDE_DIRS) | ||
# in cache already | ||
set(MAPNIK_FOUND TRUE) | ||
else (MAPNIK_LIBRARIES AND MAPNIK_INCLUDE_DIRS AND MAPNIK_DEPS_INCLUDE_DIRS) | ||
find_path(MAPNIK_INCLUDE_DIR | ||
NAMES | ||
mapnik/config.hpp | ||
PATHS | ||
/usr/include | ||
/usr/local/include | ||
/opt/local/include | ||
/sw/include | ||
) | ||
|
||
find_path(MAPNIK_DEPS_INCLUDE_DIR | ||
NAMES | ||
mapbox/geometry/point.hpp | ||
PATHS | ||
/usr/include | ||
/usr/local/include | ||
/opt/local/include | ||
/sw/include | ||
PATH_SUFFIXES | ||
mapnik/deps | ||
) | ||
|
||
find_library(MAPNIK_LIBRARY | ||
NAMES | ||
mapnik | ||
mapnik2 | ||
PATHS | ||
/usr/lib | ||
/usr/local/lib | ||
/opt/local/lib | ||
/sw/lib | ||
) | ||
|
||
if (MAPNIK_LIBRARY) | ||
set(MAPNIK_FOUND TRUE) | ||
endif (MAPNIK_LIBRARY) | ||
|
||
set(MAPNIK_INCLUDE_DIRS | ||
${MAPNIK_INCLUDE_DIR} | ||
) | ||
|
||
set(MAPNIK_DEPS_INCLUDE_DIRS | ||
${MAPNIK_DEPS_INCLUDE_DIR} | ||
) | ||
|
||
if (MAPNIK_FOUND) | ||
set(MAPNIK_LIBRARIES | ||
${MAPNIK_LIBRARIES} | ||
${MAPNIK_LIBRARY} | ||
) | ||
endif (MAPNIK_FOUND) | ||
|
||
if (MAPNIK_INCLUDE_DIRS AND MAPNIK_DEPS_INCLUDE_DIRS AND MAPNIK_LIBRARIES) | ||
set(MAPNIK_FOUND TRUE) | ||
endif (MAPNIK_INCLUDE_DIRS AND MAPNIK_DEPS_INCLUDE_DIRS AND MAPNIK_LIBRARIES) | ||
|
||
if (MAPNIK_FOUND) | ||
if (NOT Mapnik_FIND_QUIETLY) | ||
message(STATUS "Found Mapnik: ${MAPNIK_LIBRARIES}") | ||
endif (NOT Mapnik_FIND_QUIETLY) | ||
else (MAPNIK_FOUND) | ||
if (Mapnik_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find Mapnik") | ||
endif (Mapnik_FIND_REQUIRED) | ||
endif (MAPNIK_FOUND) | ||
|
||
find_program(MAPNIK_CONFIG | ||
NAMES | ||
mapnik-config | ||
PATHS | ||
/usr/bin | ||
/usr/local/bin | ||
/opt/local/bin | ||
) | ||
|
||
if (MAPNIK_CONFIG) | ||
message(STATUS "Found mapnik-config: ${MAPNIK_CONFIG}") | ||
execute_process(COMMAND mapnik-config --cflags OUTPUT_VARIABLE MAPNIK_CXXFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process(COMMAND mapnik-config --libs OUTPUT_VARIABLE MAPNIK_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process(COMMAND mapnik-config --input-plugins OUTPUT_VARIABLE MAPNIK_PLUGINDIR OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
message(STATUS "Mapnik default plugin path: ${MAPNIK_PLUGINDIR}") | ||
execute_process(COMMAND mapnik-config --dep-includes OUTPUT_VARIABLE MAPNIK_INCLUDE_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
string(REPLACE " " ";" MAPNIK_INCLUDE_FLAG_LIST ${MAPNIK_INCLUDE_FLAGS}) | ||
foreach(INCLUDEFLAG ${MAPNIK_INCLUDE_FLAG_LIST}) | ||
string(REPLACE "-I" "" INCLUDEPATH ${INCLUDEFLAG}) | ||
set(MAPNIK_INCLUDE_DIRS ${MAPNIK_INCLUDE_DIRS} ${INCLUDEPATH}) | ||
endforeach(INCLUDEFLAG) | ||
endif (MAPNIK_CONFIG) | ||
|
||
# show the variables only in the advanced view | ||
mark_as_advanced( | ||
MAPNIK_INCLUDE_DIRS | ||
MAPNIK_LIBRARIES | ||
MAPNIK_CXXFLAGS | ||
MAPNIK_LDFLAGS | ||
MAPNIK_PLUGINDIR | ||
) | ||
|
||
endif (MAPNIK_LIBRARIES AND MAPNIK_INCLUDE_DIRS AND MAPNIK_DEPS_INCLUDE_DIRS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#---------------------------------------------------------------------- | ||
# | ||
# 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) | ||
|
||
|
||
#---------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
add_library(input-mbtiles_vector MODULE) | ||
set_target_properties(input-mbtiles_vector PROPERTIES | ||
OUTPUT_NAME mbtiles_vector | ||
POSITION_INDEPENDENT_CODE ON | ||
PREFIX "" | ||
SUFFIX ".input" | ||
#LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" | ||
) | ||
#mapnik_install_plugin(input-mbtiles_vector) | ||
target_sources(input-mbtiles_vector PRIVATE | ||
mbtiles_vector_datasource.cpp | ||
mbtiles_vector_featureset.cpp | ||
mvt_io.cpp | ||
vector_tile_compression.cpp | ||
vector_tile_geometry_decoder.cpp | ||
) | ||
target_include_directories(input-mbtiles_vector PRIVATE | ||
${MAPNIK_INCLUDE_DIRS} | ||
${MAPNIK_DEPS_INCLUDE_DIRS} | ||
${PROTOZERO_INCLUDE_DIR} | ||
) | ||
target_link_libraries(input-mbtiles_vector PRIVATE | ||
${MAPNIK_LIBRARIES} | ||
SQLite::SQLite3 | ||
ZLIB::ZLIB | ||
) |
Oops, something went wrong.