Skip to content

Commit a4de7fc

Browse files
Migrate to modern TBB version
1 parent 8f0cd5c commit a4de7fc

File tree

16 files changed

+529
-680
lines changed

16 files changed

+529
-680
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
CXXCOMPILER: g++-9
199199
CXXFLAGS: -Wno-cast-function-type
200200

201-
- name: gcc-9-release-i686
201+
- name: gcc-9-conan-release-i686
202202
continue-on-error: false
203203
node: 12
204204
runs-on: ubuntu-20.04
@@ -209,7 +209,8 @@ jobs:
209209
CXXCOMPILER: g++-9
210210
CXXFLAGS: "-m32 -msse2 -mfpmath=sse"
211211
TARGET_ARCH: i686
212-
212+
ENABLE_CONAN: ON
213+
213214
- name: gcc-8-release
214215
continue-on-error: false
215216
node: 12
@@ -416,7 +417,6 @@ jobs:
416417
ENABLE_CONAN: ON
417418
NODE_PACKAGE_TESTS_ONLY: ON
418419

419-
420420
name: ${{ matrix.name}}
421421
continue-on-error: ${{ matrix.continue-on-error }}
422422
runs-on: ${{ matrix.runs-on }}
@@ -513,10 +513,6 @@ jobs:
513513
wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
514514
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH
515515
516-
# TBB
517-
${MASON} install tbb 2017_U7
518-
echo "LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
519-
520516
# ccache
521517
${MASON} install ccache ${CCACHE_VERSION}
522518
echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH
@@ -540,7 +536,7 @@ jobs:
540536
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then
541537
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
542538
sudo apt-get update -y
543-
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libtbb-dev libboost-all-dev
539+
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
544540
if [[ -z "${CLANG_VERSION}" ]]; then
545541
sudo apt-get install -y ${CXXCOMPILER}
546542
fi
@@ -552,6 +548,18 @@ jobs:
552548
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
553549
fi
554550
551+
# TBB
552+
TBB_VERSION=2021.3.0
553+
if [[ "${RUNNER_OS}" == "Linux" ]]; then
554+
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-lin.tgz"
555+
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
556+
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-mac.tgz"
557+
fi
558+
wget --tries 5 ${TBB_URL} -O onetbb.tgz
559+
tar zxvf onetbb.tgz
560+
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
561+
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
562+
555563
- name: Prepare build
556564
run: |
557565
mkdir ${OSRM_BUILD_DIR}
@@ -567,6 +575,7 @@ jobs:
567575
run: |
568576
echo "Using ${JOBS} jobs"
569577
pushd ${OSRM_BUILD_DIR}
578+
570579
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
571580
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
572581
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
1010
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
1111
- Build:
12+
- CHANGED: Migrate to modern TBB version. [#6300](https://github.com/Project-OSRM/osrm-backend/pull/6300)
1213
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
1314
- ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313)
1415
- CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303)

CMakeLists.txt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -463,26 +463,17 @@ if(ENABLE_CONAN)
463463
set(CONAN_BZIP2_VERSION 1.0.8)
464464
set(CONAN_EXPAT_VERSION 2.2.10)
465465
set(CONAN_LUA_VERSION 5.4.4)
466-
set(CONAN_TBB_VERSION 2020.3)
466+
set(CONAN_TBB_VERSION 2021.3.0)
467467

468468
set(CONAN_SYSTEM_INCLUDES ON)
469-
470-
# TODO:
471-
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
472-
# with exit code = -1073741515, which means that program cannot load required DLL.
473-
if (MSVC)
474-
set(TBB_SHARED False)
475-
else()
476-
set(TBB_SHARED True)
477-
endif()
478469

479-
conan_cmake_run(
470+
set(CONAN_ARGS
480471
REQUIRES
481472
boost/${CONAN_BOOST_VERSION}
482473
bzip2/${CONAN_BZIP2_VERSION}
483474
expat/${CONAN_EXPAT_VERSION}
484475
lua/${CONAN_LUA_VERSION}
485-
tbb/${CONAN_TBB_VERSION}
476+
onetbb/${CONAN_TBB_VERSION}
486477
BASIC_SETUP
487478
BUILD missing
488479
GENERATORS cmake_find_package
@@ -491,6 +482,12 @@ if(ENABLE_CONAN)
491482
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
492483
tbb:shared=${TBB_SHARED}
493484
)
485+
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
486+
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
487+
conan_cmake_run("${CONAN_ARGS} ARCH x86")
488+
else()
489+
conan_cmake_run("${CONAN_ARGS}")
490+
endif()
494491

495492
add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})
496493
add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2})
@@ -511,6 +508,7 @@ if(ENABLE_CONAN)
511508
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
512509
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
513510

511+
514512
find_package(BZip2 REQUIRED)
515513
find_package(EXPAT REQUIRED)
516514
find_package(lua REQUIRED)
@@ -533,9 +531,7 @@ else()
533531

534532
find_package(TBB REQUIRED)
535533
add_dependency_includes(${TBB_INCLUDE_DIR})
536-
if(WIN32)
537-
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} optimized ${TBB_MALLOC_LIBRARY} debug ${TBB_LIBRARY_DEBUG} debug ${TBB_MALLOC_LIBRARY_DEBUG})
538-
endif()
534+
set(TBB_LIBRARIES TBB::tbb)
539535

540536
find_package(EXPAT REQUIRED)
541537
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
@@ -809,9 +805,9 @@ JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
809805

810806
# Boost uses imported targets, we need to use a generator expression to extract
811807
# the link libraries to be written to the pkg-config file.
812-
# Conan defines dependencies as CMake targets too, that's why we do the same for them.
808+
# Conan & TBB define dependencies as CMake targets too, that's why we do the same for them.
813809
foreach(engine_lib ${ENGINE_LIBRARIES})
814-
if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*")
810+
if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*" OR "${engine_lib}" MATCHES "^TBB.*")
815811
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>")
816812
else()
817813
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}")

0 commit comments

Comments
 (0)