Skip to content
Open
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
92 changes: 92 additions & 0 deletions .github/workflows/debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build for Debian

# manually triggered workflow

on:
workflow_dispatch:
push:
pull_request:


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Debian postgis
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
postgres: [14, 15, 16, 17, 18]
postgis: [3.5, 3.6]
include:
- postgres: 18
pqxx: '7.10'
- postgres: 17
pqxx: '6.4'
- postgres: 16
pqxx: '6.4'
- postgres: 15
pqxx: '6.4'
- postgres: 14
pqxx: '6.4'
exclude:
- postgres: 18
postgis: 3.5
- postgres: 17
postgis: 3.6
- postgres: 16
postgis: 3.6
- postgres: 15
postgis: 3.6
- postgres: 14
postgis: 3.6

container:
image: postgis/postgis:${{ matrix.postgres }}-${{ matrix.postgis }}

steps:
- uses: actions/checkout@v6

- name: Install dependencies
run: |
apt update
apt install -y \
build-essential \
cmake \
libboost-program-options-dev \
libpqxx-dev \
libpqxx-${{ matrix.pqxx }} \
libexpat1 \
libexpat-dev \
libosmium2-dev \
zlib1g-dev

- name: Configure compiler
run: |
mkdir build
cd build
cmake ..

# Build osmium tool
cd ../tools/osmium
mkdir build
cd build
cmake ..

- name: Build
run: |
cd build
make -j $(nproc)
make install

# Build osmium tool
cd ../tools/osmium/build
make -j $(nproc)
make install
21 changes: 21 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
release: [Debug, Release]
os: [ubuntu-latest, ubuntu-22.04]
compiler: [ gcc-latest, g++-11, clang ]
include:
- os: ubuntu-latest
pqxx: '7.8' # 7.8t64
- os: ubuntu-22.04
pqxx: '6.4'

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -66,6 +71,11 @@ jobs:
postgresql-${{ matrix.psql }}-postgis-${{ matrix.postgis }}-scripts \
postgresql-${{ matrix.psql }}-pgrouting \
libpqxx-dev \
libpqxx-${{ matrix.pqxx }} \
libexpat1 \
libexpat-dev \
libosmium2-dev \
zlib1g-dev \
postgresql-server-dev-${{ matrix.psql }}
# should be 7 on latest and 6 on 22.04
apt-cache policy libpqxx-dev
Expand All @@ -79,8 +89,19 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.release }} ..

# Build osmium tool
cd ../tools/osmium
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.release }} ..

- name: Build
run: |
cd build
make -j 4
sudo make install

# Build osmium tool
cd ../tools/osmium/build
make -j 4
sudo make install
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ message(STATUS "POSTGRESQL_INCLUDE_DIR: ${POSTGRESQL_INCLUDE_DIR}")
message(STATUS "EXPAT_INCLUDE_DIRS: ${EXPAT_INCLUDE_DIRS}")
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "POSTGRESQL_LIBRARIES: ${POSTGRESQL_LIBRARIES}")
message(STATUS "Boost_LIBRARIES: ${boost_LIBRARIES}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "PQXX_LIBRARIES: ${PQXX_LIBRARIES}")

INCLUDE_DIRECTORIES(src
Expand Down
10 changes: 5 additions & 5 deletions cmake/FindPQXX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ find_library (PQXX_LIBRARIES
NAMES pqxx
DOC "pqxx library"
)
mark_as_advanced (PQXX_LIBRARY)
mark_as_advanced (PQXX_LIBRARIES)


if (PQXX_INCLUDE_DIR)
Expand All @@ -37,15 +37,15 @@ if (PQXX_INCLUDE_DIR)
message(STATUS "PQXX_VERSION_FILE=${PQXX_VERSION_FILE}")
file(READ "${PQXX_VERSION_FILE}" PQXX_FILE)
string(REGEX MATCH "PQXX_VERSION \"([0-9]*).([0-9]*).([0-9]*)" PQXX_VERSION_LINE ${PQXX_FILE})
string(REGEX REPLACE "PQXX_VERSION \"([0-9]*).([0-9]*).([0-9]*)" "\\1" PQXX_VERSION_MAYOR ${PQXX_VERSION_LINE})
string(REGEX REPLACE "PQXX_VERSION \"([0-9]*).([0-9]*).([0-9]*)" "\\1" PQXX_VERSION_MAJOR ${PQXX_VERSION_LINE})
string(REGEX REPLACE "PQXX_VERSION \"([0-9]*).([0-9]*).([0-9]*)" "\\2" PQXX_VERSION_MINOR ${PQXX_VERSION_LINE})
string(REGEX REPLACE "PQXX_VERSION \"([0-9]*).([0-9]*).([0-9]*)" "\\3" PQXX_VERSION_MICRO ${PQXX_VERSION_LINE})
set(PQXX_VERSION "${PQXX_VERSION_MAYOR}.${PQXX_VERSION_MINOR}.${PQXX_VERSION_MICRO}")
set(PQXX_VERSION "${PQXX_VERSION_MAJOR}.${PQXX_VERSION_MINOR}.${PQXX_VERSION_MICRO}")
message(STATUS "PQXX_VERSION=${PQXX_VERSION}")
message(STATUS "PQXX_VERSION_MAYOR=${PQXX_VERSION_MAYOR}")
message(STATUS "PQXX_VERSION_MAJOR=${PQXX_VERSION_MAJOR}")
message(STATUS "PQXX_VERSION_MINOR=${PQXX_VERSION_MINOR}")
message(STATUS "PQXX_VERSION_MICRO=${PQXX_VERSION_MICRO}")
unset(PQXX_VERSION_MAYOR)
unset(PQXX_VERSION_MAJOR)
unset(PQXX_VERSION_MINOR)
unset(PQXX_VERSION_MICRO)
unset(PQXX_FILE)
Expand Down
75 changes: 51 additions & 24 deletions tools/osmium/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
PROJECT(getrestirction)
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message(FATAL_ERROR "In-source builds not allowed.
Please make a new directory (called a build directory) and run CMake from there.
You may need to remove CMakeCache.txt." )
endif()

PROJECT(getrestrictions VERSION 3.0.0
LANGUAGES C CXX)

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
SET(SHARE_DIR "/usr/share/getrestrictions")

FIND_PACKAGE(PostgreSQL REQUIRED)
find_package(LibPQXX REQUIRED)
FIND_PACKAGE(EXPAT REQUIRED)
find_package(PostgreSQL REQUIRED)
find_package(PQXX REQUIRED)
include_directories(${PQXX_INCLUDE_DIR})
find_package(EXPAT REQUIRED)


find_package(Osmium REQUIRED COMPONENTS io pbf xml)
Expand All @@ -22,53 +25,77 @@ endif()
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})


FILE(GLOB SRC "${CMAKE_SOURCE_DIR}/src/*.cpp" "${CMAKE_SOURCE_DIR}/src/*/*.cpp")

#---------------------------------------------
# C++ Compiler requirements
#---------------------------------------------
#---------------------------------------------

#---------------------------------------------
# Boost
#---------------------------------------------
#---------------------------------------------
find_package(Boost ${BOOST_MINIMUM_VERSION} REQUIRED COMPONENTS program_options)
if (NOT Boost_VERSION_MACRO)
set(Boost_VERSION_MACRO ${Boost_VERSION})
endif()
add_definitions(-DBoost_VERSION_MACRO=${Boost_VERSION_MACRO})
add_definitions(-DBOOST_ALLOW_DEPRECATED_HEADERS)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})


message(STATUS "PQXX_VERSION=${PQXX_VERSION}")
if (PQXX_VERSION VERSION_GREATER_EQUAL "7.0.0")
set(CMAKE_CXX_STANDARD 17)
else()
add_definitions(-DPQXX_DISCONNECT)
set(CMAKE_CXX_STANDARD 14)
endif()

FIND_PACKAGE(Boost)
if(Boost_INCLUDE_DIRS)
message(STATUS "Boost headers were found here: ${Boost_INCLUDE_DIRS}")
else(Boost_INCLUDE_DIRS)
message(FATAL_ERROR " Please check your Boost installation ")
endif(Boost_INCLUDE_DIRS)

FIND_PACKAGE(Boost COMPONENTS program_options REQUIRED)

FILE(GLOB SRC "${CMAKE_SOURCE_DIR}/src/*.cpp" "${CMAKE_SOURCE_DIR}/src/*/*.cpp")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Wconversion -pedantic -Wextra -frounding-math -Wno-deprecated")

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64 -std=c++0x")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -Wconversion -pedantic -Wextra -frounding-math -Wno-deprecated -fmax-errors=10")
if(WIN32 AND MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SCL_SECURE_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_NONSTDC_NO_DEPRECATE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -EHsc")
endif()

#--------------------------------------------------------

set (OSM2PGROUTING_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include")
message(STATUS "LIBPQXX_INCLUDE_DIRS: ${LIBPQXX_INCLUDE_DIRS}")
message(STATUS "PQXX_INCLUDE_DIR: ${PQXX_INCLUDE_DIR}")
message(STATUS "POSTGRESQL_INCLUDE_DIR: ${POSTGRESQL_INCLUDE_DIR}")
message(STATUS "EXPAT_INCLUDE_DIRS: ${EXPAT_INCLUDE_DIRS}")
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "POSTGRESQL_LIBRARIES: ${POSTGRESQL_LIBRARIES}")
message(STATUS "Boost_LIBRARIES: ${boost_LIBRARIES}")
message(STATUS "LIBPQXX_LIBRARIES: ${LIBPQXX_LIBRARIES}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "PQXX_LIBRARIES: ${PQXX_LIBRARIES}")

INCLUDE_DIRECTORIES(src
${LIBPQXX_INCLUDE_DIRS}
${POSTGRESQL_INCLUDE_DIR}
${EXPAT_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${OSM2PGROUTING_INCLUDE_DIRS}
)

ADD_EXECUTABLE(getrestrictions ${SRC})

TARGET_LINK_LIBRARIES(getrestrictions
${LIBPQXX_LIBRARIES}
${PQXX_LIBRARIES}
${POSTGRESQL_LIBRARIES}
${EXPAT_LIBRARIES}
${Boost_LIBRARIES}
${OSMIUM_LIBRARIES}
)

INSTALL(TARGETS getrestrictions
RUNTIME DESTINATION "/usr/bin"
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
)

if(WIN32)
target_link_libraries(getrestrictions wsock32 ws2_32)
endif()
43 changes: 0 additions & 43 deletions tools/osmium/cmake/FindLibPQXX.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion tools/osmium/cmake/FindOsmium.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ set(_osmium_include_path
)

# Look for the header file.
find_path(OSMIUM_INCLUDE_DIR osmium/osm.hpp
find_path(OSMIUM_INCLUDE_DIR osmium/version.hpp
PATH_SUFFIXES include
PATHS ${_osmium_include_path}
)
Expand Down
Loading
Loading