From f7d985378ea27f749656e9e9ff8bdcd89be94316 Mon Sep 17 00:00:00 2001 From: Wouter van Kleunen Date: Sun, 21 Feb 2021 21:33:09 +0000 Subject: [PATCH] CI use boost 1.67 --- .github/workflows/ci.yml | 19 ++++++++++++++++--- CMakeLists.txt | 20 +++++++++++++++++--- include/sqlite_modern_cpp.h | 4 ++-- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6733f467..cf3ce06b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,15 +15,22 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y --no-install-recommends build-essential liblua5.1-0 liblua5.1-0-dev libprotobuf-dev libsqlite3-dev protobuf-compiler shapelib libshp-dev libboost-program-options-dev libboost-filesystem-dev libboost-system-dev + sudo apt-get install -y --no-install-recommends build-essential liblua5.1-0 liblua5.1-0-dev libprotobuf-dev libsqlite3-dev protobuf-compiler shapelib libshp-dev - name: Build and install + env: + S_CFLAGS: -flto -ffunction-sections -fdata-sections + S_CXXFLAGS: -flto -ffunction-sections -fdata-sections + S_LDFLAGS: -Wl,-gc-sections run: | - make -j 2 + mkdir build + cd build + export CFLAGS=${S_CFLAGS} && export CXXFLAGS=${S_CXXFLAGS} && export LDFLAGS=${S_LDFLAGS} + BOOST_ROOT=$BOOST_ROOT_1_72_0 cmake -DTILEMAKER_USE_STATIC_BOOST=true .. + make -j sudo make install - name: Build openmaptiles-compatible mbtiles files of Liechtenstein @@ -31,6 +38,12 @@ jobs: curl http://download.geofabrik.de/europe/${AREA}-latest.osm.pbf -o ${AREA}.osm.pbf tilemaker ${AREA}.osm.pbf --config=resources/config-openmaptiles.json --process=resources/process-openmaptiles.lua --output=${AREA}.mbtiles --verbose + - name: 'Upload compiled executable' + uses: actions/upload-artifact@v2 + with: + name: tilemaker + path: build/tilemaker + Github-Action: name: Generate mbtiles with Github Action runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e2ba44a..cc8502e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") @@ -6,6 +6,8 @@ endif() project(tilemaker) +OPTION(TILEMAKER_USE_STATIC_BOOST "Statically link with boost libraries" OFF) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") @@ -15,6 +17,18 @@ endif() include_directories(include) include_directories(${CMAKE_BINARY_DIR}) # for generated files +IF (TILEMAKER_USE_STATIC_BOOST) + MESSAGE (STATUS "Staticly linking with Boost") + SET (Boost_USE_STATIC_LIBS TRUE) +ELSE () + MESSAGE (STATUS "Dynamically linking with Boost") + SET (Boost_USE_STATIC_LIBS FALSE) +ENDIF () + +IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) +ENDIF () + find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem program_options) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) @@ -34,7 +48,6 @@ find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIR}) set(CMAKE_CXX_STANDARD 11) -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) if(MSVC) add_definitions(-D_USE_MATH_DEFINES) @@ -56,6 +69,7 @@ file(GLOB tilemaker_src_files "clipper/*.cpp" ) add_executable(tilemaker vector_tile.pb.cc osmformat.pb.cc ${tilemaker_src_files}) -target_link_libraries(tilemaker ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB}) +target_link_libraries(tilemaker ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB} ${CMAKE_DL_LIBS} + Boost::system Boost::filesystem Boost::program_options) install(TARGETS tilemaker RUNTIME DESTINATION bin) diff --git a/include/sqlite_modern_cpp.h b/include/sqlite_modern_cpp.h index 503b512d..b350c820 100644 --- a/include/sqlite_modern_cpp.h +++ b/include/sqlite_modern_cpp.h @@ -94,7 +94,7 @@ namespace sqlite { public: friend class database; - ~database_binder() { + ~database_binder() noexcept(false) { /* Will be executed if no >>op is found */ if (_stmt) { if (sqlite3_step(_stmt) != SQLITE_DONE) { @@ -548,4 +548,4 @@ namespace sqlite { }; #pragma endregion -} \ No newline at end of file +}