make adjustments based on PR review from @themarex
This commit is contained in:
parent
83b7d75121
commit
87d09f78e6
@ -7,6 +7,17 @@ Please create a directory and run cmake from there, passing the path to this sou
|
|||||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_MASON "Use mason for dependencies" OFF)
|
||||||
|
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
||||||
|
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||||
|
option(BUILD_COMPONENTS "Build osrm-components" OFF)
|
||||||
|
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
||||||
|
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||||
|
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||||
|
option(ENABLE_LTO "Use LTO if available" ON)
|
||||||
|
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||||
|
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
||||||
|
|
||||||
if(ENABLE_MASON)
|
if(ENABLE_MASON)
|
||||||
|
|
||||||
# versions in use
|
# versions in use
|
||||||
@ -21,15 +32,7 @@ if(ENABLE_MASON)
|
|||||||
set(MASON_CCACHE_VERSION "3.3.1")
|
set(MASON_CCACHE_VERSION "3.3.1")
|
||||||
|
|
||||||
message(STATUS "Enabling mason")
|
message(STATUS "Enabling mason")
|
||||||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.mason/mason.cmake")
|
include(${CMAKE_CURRENT_SOURCE_DIR}/third_party/mason/mason.cmake)
|
||||||
execute_process(
|
|
||||||
COMMAND git clone -b v0.1.0 --depth 1 https://github.com/mapbox/mason.git ${CMAKE_CURRENT_SOURCE_DIR}/.mason ERROR_QUIET
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/.mason/mason --version ERROR_QUIET OUTPUT_VARIABLE MASON_RELEASE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
message(STATUS "Using mason ${MASON_RELEASE_VERSION}")
|
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/.mason/mason.cmake)
|
|
||||||
if(NOT CMAKE_CXX_COMPILER)
|
if(NOT CMAKE_CXX_COMPILER)
|
||||||
mason_use(clang++ VERSION ${MASON_CLANG_VERSION})
|
mason_use(clang++ VERSION ${MASON_CLANG_VERSION})
|
||||||
message(STATUS "Setting compiler to clang++ ${MASON_CLANG_VERSION} (via mason) ${MASON_PACKAGE_clang++_PREFIX}/bin/clang++")
|
message(STATUS "Setting compiler to clang++ ${MASON_CLANG_VERSION} (via mason) ${MASON_PACKAGE_clang++_PREFIX}/bin/clang++")
|
||||||
@ -77,17 +80,6 @@ if(WIN32 AND MSVC_VERSION LESS 1900)
|
|||||||
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
|
message(FATAL_ERROR "Building with Microsoft compiler needs Latest Visual Studio 2015 (Community or better)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_MASON "Use mason for dependencies" OFF)
|
|
||||||
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
|
|
||||||
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
|
||||||
option(BUILD_COMPONENTS "Build osrm-components" OFF)
|
|
||||||
option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
|
||||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
|
||||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
|
||||||
option(ENABLE_LTO "Use LTO if available" ON)
|
|
||||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
|
||||||
option(ENABLE_GOLD_LINKER "Use GNU gold linker if available" ON)
|
|
||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/)
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/)
|
||||||
@ -225,6 +217,11 @@ if(CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CM
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_MASON AND (LTO_WORKS OR ENABLE_GOLD_LINKER))
|
||||||
|
message(WARNING "ENABLE_MASON and ENABLE_LTO/ENABLE_GOLD_LINKER may not work on all linux systems currently")
|
||||||
|
message(WARNING "For more details see: https://github.com/Project-OSRM/osrm-backend/issues/3202")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||||
if (ENABLE_COVERAGE)
|
if (ENABLE_COVERAGE)
|
||||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
@ -366,13 +363,6 @@ if(ENABLE_MASON)
|
|||||||
add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS})
|
add_dependency_includes(${MASON_PACKAGE_bzip2_INCLUDE_DIRS})
|
||||||
set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS})
|
set(BZIP2_LIBRARIES ${MASON_PACKAGE_bzip2_STATIC_LIBS})
|
||||||
|
|
||||||
# todo - system packages do not provide a remote tarball
|
|
||||||
# but the mason-cmake integration expects one
|
|
||||||
#mason_use(zlib VERSION system)
|
|
||||||
#add_dependency_includes(${MASON_PACKAGE_zlib_INCLUDE_DIRS})
|
|
||||||
#set(ZLIB_LIBRARY ${MASON_PACKAGE_zlib_LDFLAGS})
|
|
||||||
set(ZLIB_LIBRARY "-lz")
|
|
||||||
|
|
||||||
mason_use(tbb VERSION ${MASON_TBB_VERSION})
|
mason_use(tbb VERSION ${MASON_TBB_VERSION})
|
||||||
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
add_dependency_includes(${MASON_PACKAGE_tbb_INCLUDE_DIRS})
|
||||||
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
set(TBB_LIBRARIES ${MASON_PACKAGE_tbb_LDFLAGS})
|
||||||
@ -393,8 +383,6 @@ if(ENABLE_MASON)
|
|||||||
install(FILES ${TBBGlob} DESTINATION lib)
|
install(FILES ${TBBGlob} DESTINATION lib)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
|
||||||
|
|
||||||
if(BUILD_COMPONENTS)
|
if(BUILD_COMPONENTS)
|
||||||
message(FATAL_ERROR "BUILD_COMPONENTS is not supported with ENABLE_MASON")
|
message(FATAL_ERROR "BUILD_COMPONENTS is not supported with ENABLE_MASON")
|
||||||
endif()
|
endif()
|
||||||
@ -411,14 +399,8 @@ if(ENABLE_MASON)
|
|||||||
set(ENV{CCACHE_CPP2} "true")
|
set(ENV{CCACHE_CPP2} "true")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
|
|
||||||
set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include")
|
|
||||||
find_package(Osmium REQUIRED COMPONENTS io)
|
|
||||||
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
|
|
||||||
|
|
||||||
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
find_package(Boost 1.49.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
add_dependency_includes(${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
@ -441,9 +423,6 @@ else()
|
|||||||
find_package(BZip2 REQUIRED)
|
find_package(BZip2 REQUIRED)
|
||||||
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
add_dependency_includes(${BZIP2_INCLUDE_DIR})
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
|
||||||
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
if(BUILD_COMPONENTS)
|
if(BUILD_COMPONENTS)
|
||||||
find_package(GDAL)
|
find_package(GDAL)
|
||||||
endif()
|
endif()
|
||||||
@ -472,6 +451,13 @@ else()
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# even with mason builds we want to link to system zlib
|
||||||
|
# to ensure that osrm binaries play well with other binaries like nodejs
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
add_dependency_includes(${ZLIB_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
|
||||||
|
|
||||||
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
|
||||||
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
add_dependency_defines(-DBOOST_TEST_DYN_LINK)
|
||||||
endif()
|
endif()
|
||||||
|
@ -15,11 +15,16 @@ OSMIUM_TAG=v2.9.0
|
|||||||
VARIANT_REPO=https://github.com/mapbox/variant.git
|
VARIANT_REPO=https://github.com/mapbox/variant.git
|
||||||
VARIANT_TAG=v1.1.0
|
VARIANT_TAG=v1.1.0
|
||||||
|
|
||||||
|
MASON_REPO=https://github.com/mapbox/mason.git
|
||||||
|
MASON_TAG=v0.1.0
|
||||||
|
|
||||||
VARIANT_LATEST=$(curl https://api.github.com/repos/mapbox/variant/releases/latest | jq ".tag_name")
|
VARIANT_LATEST=$(curl https://api.github.com/repos/mapbox/variant/releases/latest | jq ".tag_name")
|
||||||
OSMIUM_LATEST=$(curl https://api.github.com/repos/osmcode/libosmium/releases/latest | jq ".tag_name")
|
OSMIUM_LATEST=$(curl https://api.github.com/repos/osmcode/libosmium/releases/latest | jq ".tag_name")
|
||||||
|
MASON_LATEST=$(curl https://api.github.com/repos/mapbox/mason/releases/latest | jq ".tag_name")
|
||||||
|
|
||||||
echo "Latest osmium release is $OSMIUM_LATEST, pulling in \"$OSMIUM_TAG\""
|
echo "Latest osmium release is $OSMIUM_LATEST, pulling in \"$OSMIUM_TAG\""
|
||||||
echo "Latest variant release is $VARIANT_LATEST, pulling in \"$VARIANT_TAG\""
|
echo "Latest variant release is $VARIANT_LATEST, pulling in \"$VARIANT_TAG\""
|
||||||
|
echo "Latest mason release is $MASON_LATEST, pulling in \"$MASON_TAG\""
|
||||||
|
|
||||||
read -p "Looks good? (Y/n) " ok
|
read -p "Looks good? (Y/n) " ok
|
||||||
|
|
||||||
@ -27,4 +32,5 @@ if [[ $ok =~ [yY] ]]
|
|||||||
then
|
then
|
||||||
git subtree pull -P third_party/libosmium/ $OSMIUM_REPO $OSMIUM_TAG --squash
|
git subtree pull -P third_party/libosmium/ $OSMIUM_REPO $OSMIUM_TAG --squash
|
||||||
git subtree pull -P third_party/variant/ $VARIANT_REPO $VARIANT_TAG --squash
|
git subtree pull -P third_party/variant/ $VARIANT_REPO $VARIANT_TAG --squash
|
||||||
|
git subtree pull -P third_party/mason/ $MASON_REPO $MASON_TAG --squash
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user