Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use libdeflate rather than zlib #769

Merged
merged 3 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ENDIF ()

find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem program_options iostreams)
find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem program_options)

find_package(libshp REQUIRED)

Expand All @@ -47,8 +47,6 @@ else()
include_directories(${LUAJIT_INCLUDE_DIR})
endif()

find_package(ZLIB REQUIRED)

set(CMAKE_CXX_STANDARD 17)

if(!TM_VERSION)
Expand All @@ -75,6 +73,17 @@ file(GLOB tilemaker_src_files
src/external/streamvbyte_decode.c
src/external/streamvbyte_encode.c
src/external/streamvbyte_zigzag.c
src/external/libdeflate/lib/adler32.c
src/external/libdeflate/lib/arm/cpu_features.c
src/external/libdeflate/lib/crc32.c
src/external/libdeflate/lib/deflate_compress.c
src/external/libdeflate/lib/deflate_decompress.c
src/external/libdeflate/lib/gzip_compress.c
src/external/libdeflate/lib/gzip_decompress.c
src/external/libdeflate/lib/utils.c
src/external/libdeflate/lib/x86/cpu_features.c
src/external/libdeflate/lib/zlib_compress.c
src/external/libdeflate/lib/zlib_decompress.c
src/geojson_processor.cpp
src/geom.cpp
src/helpers.cpp
Expand Down Expand Up @@ -114,9 +123,8 @@ target_link_libraries(tilemaker
${LUA_LIBRARIES}
shapelib::shp
SQLite::SQLite3
ZLIB::ZLIB
Rapidjson::rapidjson
Boost::system Boost::filesystem Boost::program_options Boost::iostreams)
Boost::system Boost::filesystem Boost::program_options)

include(CheckCxxAtomic)
if(NOT HAVE_CXX11_ATOMIC)
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-iostreams-dev \
rapidjson-dev \
cmake \
zlib1g-dev && \
cmake && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
Expand All @@ -38,8 +36,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
shapelib \
libsqlite3-0 \
libboost-filesystem1.74.0 \
libboost-program-options1.74.0 \
libboost-iostreams1.74.0 && \
libboost-program-options1.74.0 && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
Expand Down
37 changes: 35 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ MANPREFIX := /usr/share/man
TM_VERSION ?= $(shell git describe --tags --abbrev=0)
CXXFLAGS ?= -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c++14 -pthread -fPIE -DTM_VERSION=$(TM_VERSION) $(CONFIG)
CFLAGS ?= -O3 -Wall -Wno-unknown-pragmas -Wno-sign-compare -std=c99 -fPIE -DTM_VERSION=$(TM_VERSION) $(CONFIG)
LIB := -L$(PLATFORM_PATH)/lib -lz $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lboost_iostreams -lshp -pthread
LIB := -L$(PLATFORM_PATH)/lib $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lshp -pthread
INC := -I$(PLATFORM_PATH)/include -isystem ./include -I./src $(LUA_CFLAGS)

# Targets
Expand All @@ -91,6 +91,17 @@ tilemaker: \
src/external/streamvbyte_decode.o \
src/external/streamvbyte_encode.o \
src/external/streamvbyte_zigzag.o \
src/external/libdeflate/lib/adler32.o \
src/external/libdeflate/lib/arm/cpu_features.o \
src/external/libdeflate/lib/crc32.o \
src/external/libdeflate/lib/deflate_compress.o \
src/external/libdeflate/lib/deflate_decompress.o \
src/external/libdeflate/lib/gzip_compress.o \
src/external/libdeflate/lib/gzip_decompress.o \
src/external/libdeflate/lib/utils.o \
src/external/libdeflate/lib/x86/cpu_features.o \
src/external/libdeflate/lib/zlib_compress.o \
src/external/libdeflate/lib/zlib_decompress.o \
src/geojson_processor.o \
src/geom.o \
src/helpers.o \
Expand Down Expand Up @@ -155,6 +166,17 @@ test_deque_map: \

test_helpers: \
src/helpers.o \
src/external/libdeflate/lib/adler32.o \
src/external/libdeflate/lib/arm/cpu_features.o \
src/external/libdeflate/lib/crc32.o \
src/external/libdeflate/lib/deflate_compress.o \
src/external/libdeflate/lib/deflate_decompress.o \
src/external/libdeflate/lib/gzip_compress.o \
src/external/libdeflate/lib/gzip_decompress.o \
src/external/libdeflate/lib/utils.o \
src/external/libdeflate/lib/x86/cpu_features.o \
src/external/libdeflate/lib/zlib_compress.o \
src/external/libdeflate/lib/zlib_decompress.o \
test/helpers.test.o
$(CXX) $(CXXFLAGS) -o test.helpers $^ $(INC) $(LIB) $(LDFLAGS) && ./test.helpers

Expand Down Expand Up @@ -206,6 +228,17 @@ test_tile_coordinates_set: \
test_pbf_reader: \
src/helpers.o \
src/pbf_reader.o \
src/external/libdeflate/lib/adler32.o \
src/external/libdeflate/lib/arm/cpu_features.o \
src/external/libdeflate/lib/crc32.o \
src/external/libdeflate/lib/deflate_compress.o \
src/external/libdeflate/lib/deflate_decompress.o \
src/external/libdeflate/lib/gzip_compress.o \
src/external/libdeflate/lib/gzip_decompress.o \
src/external/libdeflate/lib/utils.o \
src/external/libdeflate/lib/x86/cpu_features.o \
src/external/libdeflate/lib/zlib_compress.o \
src/external/libdeflate/lib/zlib_decompress.o \
test/pbf_reader.test.o
$(CXX) $(CXXFLAGS) -o test.pbf_reader $^ $(INC) $(LIB) $(LDFLAGS) && ./test.pbf_reader

Expand All @@ -227,6 +260,6 @@ install:
@install docs/man/tilemaker.1 ${DESTDIR}${MANPREFIX}/man1/ || true

clean:
rm -f tilemaker tilemaker-server src/*.o src/external/*.o include/*.o include/*.pb.h server/*.o test/*.o
rm -f tilemaker tilemaker-server src/*.o src/external/*.o src/external/libdeflate/lib/*.o src/external/libdeflate/lib/*/*.o include/*.o include/*.pb.h server/*.o test/*.o

.PHONY: install
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@ The tilemaker code is licensed as FTWPL; you may do anything you like with this

Licenses of third-party libraries:

- [sqlite_modern_cpp](https://github.com/SqliteModernCpp/sqlite_modern_cpp) is licensed under MIT
- [kaguya](https://github.com/satoren/kaguya) is licensed under the Boost Software Licence
- [libdeflate](https://github.com/ebiggers/libdeflate/) is licensed under MIT
- [libpopcnt](https://github.com/kimwalisch/libpopcnt) is licensed under BSD 2-clause
- [minunit](https://github.com/siu/minunit) is licensed under MIT
- [pmtiles](https://github.com/protomaps/PMTiles) is licensed under BSD 3-clause
- [streamvbyte](https://github.com/lemire/streamvbyte) is licensed under Apache 2
- [polylabel](https://github.com/mapbox/polylabel) is licensed under ISC
- [protozero](https://github.com/mapbox/protozero) is licensed under BSD 2-clause
- [vtzero](https://github.com/mapbox/vtzero) is licensed under BSD 2-clause
- [minunit](https://github.com/siu/minunit) is licensed under MIT
- [Simple-Web-Server](https://gitlab.com/eidheim/Simple-Web-Server) is licensed under MIT
- [sqlite_modern_cpp](https://github.com/SqliteModernCpp/sqlite_modern_cpp) is licensed under MIT
- [streamvbyte](https://github.com/lemire/streamvbyte) is licensed under Apache 2
- [vtzero](https://github.com/mapbox/vtzero) is licensed under BSD 2-clause
4 changes: 2 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Then:

Start with:

sudo apt install build-essential libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev liblua5.1-0-dev libshp-dev libsqlite3-dev rapidjson-dev zlib1g-dev
sudo apt install build-essential libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev liblua5.1-0-dev libshp-dev libsqlite3-dev rapidjson-dev

Once you've installed those, then `cd` back to your Tilemaker directory and simply:

Expand All @@ -30,7 +30,7 @@ If it fails, check that the LIB and INC lines in the Makefile correspond with yo

Start with:

dnf install lua-devel luajit-devel sqlite-devel shapelib-devel rapidjson-devel boost-devel zlib-devel
dnf install lua-devel luajit-devel sqlite-devel shapelib-devel rapidjson-devel boost-devel

then build either with lua:

Expand Down
Loading
Loading