diff --git a/.travis.yml b/.travis.yml index c359ee9b..42f2bcea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: - os: linux sudo: false compiler: ": gcc5" - env: JOBS=10 CXX="ccache g++-5" CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" + env: JOBS=10 CXX="ccache g++-5" addons: apt: sources: ['ubuntu-toolchain-r-test'] @@ -25,7 +25,7 @@ matrix: - os: linux sudo: false compiler: ": clang" - env: JOBS=10 CXX="ccache clang++-3.9 -Qunused-arguments" + env: JOBS=10 CXX="ccache clang++-4.0 -Qunused-arguments" addons: apt: sources: ['ubuntu-toolchain-r-test'] @@ -33,7 +33,7 @@ matrix: - os: linux sudo: false compiler: ": clang-coverage" - env: JOBS=10 CXX="ccache clang++-3.9 -Qunused-arguments" COVERAGE=true BUILDTYPE=Debug + env: JOBS=10 CXX="ccache clang++-4.0 -Qunused-arguments" COVERAGE=true addons: apt: sources: ['ubuntu-toolchain-r-test'] @@ -48,11 +48,11 @@ before_install: - ./install_mason.sh - | if [[ $(uname -s) == 'Linux' ]]; then - ./mason/mason install llvm-cov 3.9.1 - ./mason/mason install clang++ 3.9.1 - export PATH=$(./mason/mason prefix clang++ 3.9.1)/bin:${PATH} + ./mason/mason install llvm-cov 4.0.1 + ./mason/mason install clang++ 4.0.1 + export PATH=$(./mason/mason prefix clang++ 4.0.1)/bin:${PATH} which clang++ - export PATH=$(./mason/mason prefix llvm-cov 3.9.1)/bin:${PATH} + export PATH=$(./mason/mason prefix llvm-cov 4.0.1)/bin:${PATH} which llvm-cov fi @@ -64,8 +64,4 @@ before_script: script: # make sure tileinfo command works - - ./build/${BUILDTYPE:-Release}/tileinfo examples/data/14_2620_6331.vector.mvt.z - -notifications: - slack: - secure: eP79cXpZ3zyVarMooLYi75C5XBS65SJkf12h25hLDmoaQD+aX0u3+/hivE3jxi8KI8v1Izpzf06aCGHL1lx/xXGg2uuiM6dtZTou1mJJ4oFsxzOJFfLXhsUO1+qXkJJG1xoaLpbSdX/y+2dfe0xKTm4zAlluj2DvwZO+R9djLGM= + - ./build/Debug/tileinfo examples/data/14_2620_6331.vector.mvt.z diff --git a/Makefile b/Makefile index 90b50e11..065eb434 100755 --- a/Makefile +++ b/Makefile @@ -1,27 +1,44 @@ -MAPNIK_PLUGINDIR = $(shell mason_packages/.link/bin/mapnik-config --input-plugins) -BUILDTYPE ?= Release - GYP_REVISION=3464008 -all: libvtile +default: release + +mason_packages/.link/bin: + SKIP_MAPNIK_INSTALL=YES ./install_mason.sh mason_packages/.link/bin/mapnik-config: ./install_mason.sh +pre_build_check: + @echo "Looking for mapnik-config on your PATH..." + mapnik-config -v + ./deps/gyp: git clone https://chromium.googlesource.com/external/gyp.git ./deps/gyp && cd ./deps/gyp && git checkout $(GYP_REVISION) -build/Makefile: mason_packages/.link/bin/mapnik-config ./deps/gyp gyp/build.gyp test/* - deps/gyp/gyp gyp/build.gyp --depth=. -DMAPNIK_PLUGINDIR=\"$(MAPNIK_PLUGINDIR)\" -Goutput_dir=. --generator-output=./build -f make +build/Makefile: ./deps/gyp gyp/build.gyp test/* + deps/gyp/gyp gyp/build.gyp --depth=. -DMAPNIK_PLUGINDIR=\"$(shell mapnik-config --input-plugins)\" -Goutput_dir=. --generator-output=./build -f make + $(MAKE) -C build/ V=$(V) + +release: mason_packages/.link/bin/mapnik-config Makefile + CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" PATH="`pwd`/mason_packages/.link/bin/:${PATH}" $(MAKE) release_base -libvtile: build/Makefile Makefile - PATH="`pwd`/mason_packages/.link/bin/:${PATH}" $(MAKE) -C build/ BUILDTYPE=$(BUILDTYPE) V=$(V) +debug: mason_packages/.link/bin/mapnik-config Makefile + CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" PATH="`pwd`/mason_packages/.link/bin/:${PATH}" $(MAKE) debug_base + +release_base: pre_build_check mason_packages/.link/bin Makefile + BUILDTYPE=Release $(MAKE) build/Makefile + +debug_base: pre_build_check mason_packages/.link/bin Makefile + BUILDTYPE=Debug $(MAKE) build/Makefile test/geometry-test-data/README.md: git submodule update --init -test: libvtile test/geometry-test-data/README.md - BUILDTYPE=$(BUILDTYPE) ./test/run.sh +test: test/geometry-test-data/README.md + BUILDTYPE=Release ./test/run.sh + +test-debug: test/geometry-test-data/README.md + BUILDTYPE=Debug ./test/run.sh testpack: rm -f ./*tgz @@ -31,8 +48,12 @@ testpack: clean: rm -rf ./build + +distclean: clean + rm -rf ./mason + rm -rf ./deps/gyp rm -rf ./mason_packages -.PHONY: test +.PHONY: test build/Makefile diff --git a/README.md b/README.md index 3baf062e..5e8354a7 100644 --- a/README.md +++ b/README.md @@ -11,42 +11,37 @@ Provides C++ headers that support rendering geodata into vector tiles and render ## Depends -Mapnik Vector Tile does not currently support Mapnik 3.1.x. - - - mapnik-vector-tile >=1.4.x depends on Mapnik >=v3.0.14 - - mapnik-vector-tile >=1.0.x depends on Mapnik >=v3.0.11 - - mapnik-vector-tile 1.0.0 to 0.7.x depends on Mapnik v3.0.x (until 3.0.0 is released this means latest mapnik HEAD) - - mapnik-vector-tile 0.6.x and previous work with Mapnik v2.2.x or v2.3.x - - You will need `libmapnik` and `mapnik-config` available - - Protobuf: `libprotobuf` and `protoc` - ## Implementation details Vector tiles in this code represent a direct serialization of Mapnik layers optimized for space efficient storage and fast deserialization. For those familiar with the Mapnik API vector tiles here can be considered a named array of `mapnik::featureset_ptr` whose geometries have been pre-tiled. For more details see [vector-tile-spec](https://github.com/mapbox/vector-tile-spec). -### Ubuntu Dependencies Installation +## Building from source + +If you do not need to build against an external mapnik, just type: - sudo apt-get install -y libprotobuf7 libprotobuf-dev protobuf-compiler - sudo apt-add-repository --yes ppa:mapnik/nightly-2.3 - sudo apt-get update -y - sudo apt-get -y install libmapnik=2.3.0* mapnik-utils=2.3.0* libmapnik-dev=2.3.0* mapnik-input-plugin*=2.3.0* + make -### OS X Dependencies Installation +This will download all deps (including Mapnik) and compile against them. - brew install protobuf - brew install mapnik +To build and test in debug mode do: -## Building + make debug test-debug -Just type: +If you have Mapnik, libprotobuf, and all the Mapnik deps already installed on your system then you can build against them with: - make + make release_base + +If building against an external Mapnik please know that Mapnik Vector Tile does not currently support Mapnik 3.1.x. -This builds the protobuf C++ wrappers: `vector_tile.pb.cc` and `vector_tile.pb.h` + - mapnik-vector-tile >=1.4.x depends on Mapnik >=v3.0.14 + - mapnik-vector-tile >=1.0.x depends on Mapnik >=v3.0.11 + - mapnik-vector-tile 1.0.0 to 0.7.x depends on Mapnik v3.0.x (until 3.0.0 is released this means latest mapnik HEAD) + - mapnik-vector-tile 0.6.x and previous work with Mapnik v2.2.x or v2.3.x + - You will need `libmapnik` and `mapnik-config` available + - Protobuf: `libprotobuf` and `protoc` -Then include `vector_tile.pb.cc` in your code. The rest is header only. ## Tests diff --git a/bootstrap.sh b/bootstrap.sh index f47e3850..bf125c46 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,20 +1,27 @@ #!/usr/bin/env bash +# if built against mason package fix dynamic data locations function setup_runtime_settings() { - local MASON_LINKED_ABS=$(pwd)/mason_packages/.link - export PROJ_LIB=${MASON_LINKED_ABS}/share/proj - ICU_VERSION=$(ls ${MASON_LINKED_ABS}/share/icu/) - export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION} - export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal - if [[ $(uname -s) == 'Darwin' ]]; then - export DYLD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${DYLD_LIBRARY_PATH:-} - # OS X > 10.11 blocks DYLD_LIBRARY_PATH so we pass along using a - # differently named variable - export MVT_LIBRARY_PATH=${DYLD_LIBRARY_PATH} - else - export LD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${LD_LIBRARY_PATH:-} + if [[ -f $(pwd)/mason_packages/.link/bin/mapnik-config ]]; then + # TODO: use --proj-lib, --gdal-data, etc after https://github.com/mapnik/mapnik/pull/3759 is fixed + #export PROJ_LIB=$(mapnik-config --proj-lib) + #export GDAL_DATA=$(mapnik-config --gdal-data) + #export ICU_DATA=$(mapnik-config --icu-data) + local MASON_LINKED_ABS=$(pwd)/mason_packages/.link + export PROJ_LIB=${MASON_LINKED_ABS}/share/proj + ICU_VERSION=$(ls ${MASON_LINKED_ABS}/share/icu/) + export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION} + export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal + if [[ $(uname -s) == 'Darwin' ]]; then + export DYLD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${DYLD_LIBRARY_PATH:-} + # OS X > 10.11 blocks DYLD_LIBRARY_PATH so we pass along using a + # differently named variable + export MVT_LIBRARY_PATH=${DYLD_LIBRARY_PATH} + else + export LD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${LD_LIBRARY_PATH:-} + fi + export PATH=$(pwd)/mason_packages/.link/bin:${PATH} fi - export PATH=$(pwd)/mason_packages/.link/bin:${PATH} } function main() { diff --git a/gyp/build.gyp b/gyp/build.gyp index 5a22717d..611c443e 100644 --- a/gyp/build.gyp +++ b/gyp/build.gyp @@ -38,17 +38,18 @@ ], 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/', + '../mason_packages/.link/include/' ], 'cflags_cc' : [ '-D_THREAD_SAFE', - '