Skip to content

Commit

Permalink
Migrate to modern TBB version
Browse files Browse the repository at this point in the history
  • Loading branch information
SiarheiFedartsou committed Aug 19, 2022
1 parent 8f0cd5c commit a4de7fc
Show file tree
Hide file tree
Showing 16 changed files with 529 additions and 680 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/osrm-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
CXXCOMPILER: g++-9
CXXFLAGS: -Wno-cast-function-type

- name: gcc-9-release-i686
- name: gcc-9-conan-release-i686
continue-on-error: false
node: 12
runs-on: ubuntu-20.04
Expand All @@ -209,7 +209,8 @@ jobs:
CXXCOMPILER: g++-9
CXXFLAGS: "-m32 -msse2 -mfpmath=sse"
TARGET_ARCH: i686

ENABLE_CONAN: ON

- name: gcc-8-release
continue-on-error: false
node: 12
Expand Down Expand Up @@ -416,7 +417,6 @@ jobs:
ENABLE_CONAN: ON
NODE_PACKAGE_TESTS_ONLY: ON


name: ${{ matrix.name}}
continue-on-error: ${{ matrix.continue-on-error }}
runs-on: ${{ matrix.runs-on }}
Expand Down Expand Up @@ -513,10 +513,6 @@ jobs:
wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH
# TBB
${MASON} install tbb 2017_U7
echo "LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
# ccache
${MASON} install ccache ${CCACHE_VERSION}
echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH
Expand All @@ -540,7 +536,7 @@ jobs:
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libtbb-dev libboost-all-dev
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
if [[ -z "${CLANG_VERSION}" ]]; then
sudo apt-get install -y ${CXXCOMPILER}
fi
Expand All @@ -552,6 +548,18 @@ jobs:
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV
fi
# TBB
TBB_VERSION=2021.3.0
if [[ "${RUNNER_OS}" == "Linux" ]]; then
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-lin.tgz"
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
TBB_URL="https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-mac.tgz"
fi
wget --tries 5 ${TBB_URL} -O onetbb.tgz
tar zxvf onetbb.tgz
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
- name: Prepare build
run: |
mkdir ${OSRM_BUILD_DIR}
Expand All @@ -567,6 +575,7 @@ jobs:
run: |
echo "Using ${JOBS} jobs"
pushd ${OSRM_BUILD_DIR}
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
- 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)
- Build:
- CHANGED: Migrate to modern TBB version. [#6300](https://github.com/Project-OSRM/osrm-backend/pull/6300)
- CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312)
- ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313)
- CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303)
Expand Down
30 changes: 13 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,26 +463,17 @@ if(ENABLE_CONAN)
set(CONAN_BZIP2_VERSION 1.0.8)
set(CONAN_EXPAT_VERSION 2.2.10)
set(CONAN_LUA_VERSION 5.4.4)
set(CONAN_TBB_VERSION 2020.3)
set(CONAN_TBB_VERSION 2021.3.0)

set(CONAN_SYSTEM_INCLUDES ON)

# TODO:
# if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol
# with exit code = -1073741515, which means that program cannot load required DLL.
if (MSVC)
set(TBB_SHARED False)
else()
set(TBB_SHARED True)
endif()

conan_cmake_run(
set(CONAN_ARGS
REQUIRES
boost/${CONAN_BOOST_VERSION}
bzip2/${CONAN_BZIP2_VERSION}
expat/${CONAN_EXPAT_VERSION}
lua/${CONAN_LUA_VERSION}
tbb/${CONAN_TBB_VERSION}
onetbb/${CONAN_TBB_VERSION}
BASIC_SETUP
BUILD missing
GENERATORS cmake_find_package
Expand All @@ -491,6 +482,12 @@ if(ENABLE_CONAN)
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
tbb:shared=${TBB_SHARED}
)
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
conan_cmake_run("${CONAN_ARGS} ARCH x86")
else()
conan_cmake_run("${CONAN_ARGS}")
endif()

add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})
add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2})
Expand All @@ -511,6 +508,7 @@ if(ENABLE_CONAN)
set(Boost_REGEX_LIBRARY "${Boost_regex_LIB_TARGETS}")
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")


find_package(BZip2 REQUIRED)
find_package(EXPAT REQUIRED)
find_package(lua REQUIRED)
Expand All @@ -533,9 +531,7 @@ else()

find_package(TBB REQUIRED)
add_dependency_includes(${TBB_INCLUDE_DIR})
if(WIN32)
set(TBB_LIBRARIES optimized ${TBB_LIBRARY} optimized ${TBB_MALLOC_LIBRARY} debug ${TBB_LIBRARY_DEBUG} debug ${TBB_MALLOC_LIBRARY_DEBUG})
endif()
set(TBB_LIBRARIES TBB::tbb)

find_package(EXPAT REQUIRED)
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
Expand Down Expand Up @@ -809,9 +805,9 @@ JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)

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

0 comments on commit a4de7fc

Please sign in to comment.