Skip to content

Commit 2c40141

Browse files
wip
1 parent 9ecc91e commit 2c40141

File tree

2 files changed

+86
-61
lines changed

2 files changed

+86
-61
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,16 @@ jobs:
247247
# CUCUMBER_TIMEOUT: 60000
248248
# ENABLE_LTO: OFF
249249

250-
# - name: clang-16-release
251-
# continue-on-error: false
252-
# node: 18
253-
# runs-on: ubuntu-24.04
254-
# BUILD_TOOLS: ON
255-
# BUILD_TYPE: Release
256-
# CCOMPILER: clang-16
257-
# CXXCOMPILER: clang++-16
258-
# CUCUMBER_TIMEOUT: 60000
259-
# ENABLE_LTO: OFF
250+
- name: clang-16-release
251+
continue-on-error: false
252+
node: 18
253+
runs-on: ubuntu-24.04
254+
BUILD_TOOLS: ON
255+
BUILD_TYPE: Release
256+
CCOMPILER: clang-16
257+
CXXCOMPILER: clang++-16
258+
CUCUMBER_TIMEOUT: 60000
259+
ENABLE_LTO: OFF
260260

261261
# - name: conan-linux-debug-asan-ubsan
262262
# continue-on-error: false
@@ -552,8 +552,8 @@ jobs:
552552
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
553553
-DENABLE_CCACHE=ON \
554554
-DENABLE_LTO=${ENABLE_LTO:-ON} \
555-
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
556-
-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake
555+
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
556+
557557
make --jobs=${JOBS}
558558
559559
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then

CMakeLists.txt

Lines changed: 74 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
cmake_minimum_required(VERSION 3.18)
22

3+
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
4+
option(BUILD_TOOLS "Build OSRM tools" OFF)
5+
option(BUILD_PACKAGE "Build OSRM package" OFF)
6+
option(BUILD_ROUTED "Build osrm-routed HTTP server" ON)
7+
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
8+
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
9+
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
10+
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
11+
option(ENABLE_LTO "Use Link Time Optimisation" ON)
12+
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
13+
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
14+
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
15+
16+
if (ENABLE_CONAN)
17+
set(CMAKE_TOOLCHAIN_FILE "./conan_toolchain.cmake")
18+
endif()
19+
320
set(CMAKE_CXX_STANDARD 20)
421
set(CMAKE_CXX_STANDARD_REQUIRED ON)
522
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -22,21 +39,6 @@ if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
2239
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
2340
endif()
2441

25-
26-
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
27-
option(BUILD_TOOLS "Build OSRM tools" OFF)
28-
option(BUILD_PACKAGE "Build OSRM package" OFF)
29-
option(BUILD_ROUTED "Build osrm-routed HTTP server" ON)
30-
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
31-
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
32-
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
33-
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
34-
option(ENABLE_LTO "Use Link Time Optimisation" ON)
35-
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
36-
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
37-
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
38-
39-
4042
if (ENABLE_CLANG_TIDY)
4143
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
4244
if(NOT CLANG_TIDY_COMMAND)
@@ -322,48 +324,71 @@ if (MSVC)
322324
endif()
323325

324326
find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
325-
add_dependency_includes(${Boost_INCLUDE_DIRS})
326-
#message(FATAL_ERROR "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS} Boost_LIBRARIES: ${Boost_LIBRARIES}")
327-
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
328-
# set(BOOST_IN ${Boost_LIBRARIES})
329327
find_package(TBB REQUIRED)
330-
add_dependency_includes(${TBB_INCLUDE_DIR})
331-
set(TBB_LIBRARIES ${TBB_LIBRARIES})
332-
333328
find_package(EXPAT REQUIRED)
334-
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
335-
#message(FATAL_ERROR "EXPAT_INCLUDE_DIRS: ${expat_INCLUDE_DIRS} EXPAT_LIBRARIES: ${expat_LIBRARIES}")
336-
set(EXPAT_LIBRARIES ${expat_LIBRARIES})
337-
set(EXPAT_INCLUDE_DIRS ${expat_INCLUDE_DIRS})
338329
find_package(BZip2 REQUIRED)
339-
add_dependency_includes(${BZIP2_INCLUDE_DIR})
340-
341330
find_package(Lua 5.2 REQUIRED)
342-
set(LUA_LIBRARIES lua::lua)
343-
if (LUA_FOUND)
344-
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
345-
endif()
346331

347-
add_dependency_includes(${lua_INCLUDE_DIRS})
332+
if (ENABLE_CONAN)
333+
add_dependency_includes(${Boost_INCLUDE_DIRS})
334+
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
348335

349-
# add a target to generate API documentation with Doxygen
350-
find_package(Doxygen)
351-
if(DOXYGEN_FOUND)
352-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
353-
add_custom_target(doc
354-
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
355-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
356-
COMMENT "Generating API documentation with Doxygen" VERBATIM
357-
)
358-
endif()
336+
add_dependency_includes(${TBB_INCLUDE_DIR})
337+
set(TBB_LIBRARIES ${TBB_LIBRARIES})
338+
339+
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
340+
set(EXPAT_LIBRARIES ${expat_LIBRARIES})
341+
set(EXPAT_INCLUDE_DIRS ${expat_INCLUDE_DIRS})
342+
343+
add_dependency_includes(${BZIP2_INCLUDE_DIR})
344+
345+
set(LUA_LIBRARIES lua::lua)
346+
if (LUA_FOUND)
347+
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
348+
endif()
349+
350+
add_dependency_includes(${lua_INCLUDE_DIRS})
359351

360-
# note libosmium depends on expat and bzip2
361-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
362-
if(NOT OSMIUM_INCLUDE_DIR)
363-
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
352+
# note: we avoid calling find_package(Osmium ...) here to ensure that the
353+
# expat and bzip2 are used from conan rather than the system
354+
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
355+
else()
356+
add_dependency_includes(${Boost_INCLUDE_DIRS})
357+
add_dependency_includes(${TBB_INCLUDE_DIR})
358+
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
359+
add_dependency_includes(${BZIP2_INCLUDE_DIR})
360+
add_dependency_includes(${LUA_INCLUDE_DIR})
361+
362+
set(TBB_LIBRARIES TBB::tbb)
363+
364+
set(BOOST_LIBRARIES
365+
${Boost_DATE_TIME_LIBRARY}
366+
${Boost_IOSTREAMS_LIBRARY}
367+
${Boost_THREAD_LIBRARY}
368+
${Boost_ZLIB_LIBRARY}
369+
${Boost_REGEX_LIBRARY}
370+
)
371+
372+
# add a target to generate API documentation with Doxygen
373+
find_package(Doxygen)
374+
if(DOXYGEN_FOUND)
375+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
376+
add_custom_target(doc
377+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
378+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
379+
COMMENT "Generating API documentation with Doxygen" VERBATIM
380+
)
381+
endif()
382+
# note libosmium depends on expat and bzip2
383+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
384+
if(NOT OSMIUM_INCLUDE_DIR)
385+
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
386+
endif()
387+
find_package(Osmium REQUIRED COMPONENTS io)
388+
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
364389
endif()
365-
find_package(Osmium REQUIRED COMPONENTS io)
366-
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
390+
391+
367392

368393
# prefix compilation with ccache by default if available and on clang or gcc
369394
if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))

0 commit comments

Comments
 (0)