diff --git a/CMakeLists.txt b/CMakeLists.txt index 754521e8..c67b73ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,10 +38,16 @@ else() endif() set(BOOST_HAS_SYSTEM false) +set(BOOST_HAS_THROW_EXCEPTION false) find_package(Boost 1.89 QUIET COMPONENTS filesystem program_options) -if(NOT Boost_FOUND) +if(Boost_FOUND) + find_package(Boost 1.89 QUIET COMPONENTS throw_exception) + if(TARGET Boost::throw_exception) + set(BOOST_HAS_THROW_EXCEPTION true) + endif() +else() find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem program_options) set(BOOST_HAS_SYSTEM true) endif() @@ -150,6 +156,9 @@ target_link_libraries(tilemaker if(BOOST_HAS_SYSTEM) target_link_libraries(tilemaker Boost::system) endif() +if(BOOST_HAS_THROW_EXCEPTION) + target_link_libraries(tilemaker Boost::throw_exception) +endif() include(CheckCxxAtomic) if(NOT HAVE_CXX11_ATOMIC) @@ -162,5 +171,8 @@ install(FILES docs/man/tilemaker.1 DESTINATION share/man/man1) add_executable(tilemaker-server server/server.cpp) target_include_directories(tilemaker-server PRIVATE include) target_link_libraries(tilemaker-server ${THREAD_LIB} ${CMAKE_DL_LIBS} SQLite::SQLite3 Boost::filesystem Boost::program_options) +if(BOOST_HAS_THROW_EXCEPTION) + target_link_libraries(tilemaker-server Boost::throw_exception) +endif() install(TARGETS tilemaker tilemaker-server RUNTIME DESTINATION bin) diff --git a/Makefile b/Makefile index 000002df..38908e07 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,8 @@ 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 -Wl,-rpath,$(PLATFORM_PATH)/lib $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem -lboost_system -lshp -pthread +BOOST_SYSTEM_LIB := $(shell printf 'int main(){return 0;}\n' | $(CXX) -x c++ - -o /tmp/tilemaker-boost-system-check -lboost_system >/dev/null 2>&1 && echo -lboost_system; rm -f /tmp/tilemaker-boost-system-check) +LIB := -L$(PLATFORM_PATH)/lib -Wl,-rpath,$(PLATFORM_PATH)/lib $(LUA_LIBS) -lboost_program_options -lsqlite3 -lboost_filesystem $(BOOST_SYSTEM_LIB) -lshp -pthread INC := -I$(PLATFORM_PATH)/include -isystem ./include -I./src $(LUA_CFLAGS) # Targets diff --git a/include/helpers.h b/include/helpers.h index 68185980..a945db90 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -2,6 +2,7 @@ #ifndef _HELPERS_H #define _HELPERS_H +#include #include #include diff --git a/include/output_object.h b/include/output_object.h index ee76b4a4..4598d2d0 100644 --- a/include/output_object.h +++ b/include/output_object.h @@ -27,7 +27,7 @@ class OutputObject { uint_least8_t l, NodeID id, AttributeIndex attributes, - uint mz + unsigned int mz ): objectID(id), geomType(type),