diff --git a/.travis.yml b/.travis.yml index 8bcb98e8853..3973667330d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ matrix: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache'] - env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' COVERAGE=ON + env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON - os: linux compiler: "clang-3.8-debug" @@ -130,7 +130,7 @@ install: fi - mkdir build && pushd build - export CC=${CCOMPILER} CXX=${CXXCOMPILER} - - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DCOVERAGE=${COVERAGE:-OFF} -DBUILD_TOOLS=ON -DBUILD_COMPONENTS=ON -DENABLE_CCACHE=ON + - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} -DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} -DBUILD_TOOLS=ON -DBUILD_COMPONENTS=ON -DENABLE_CCACHE=ON - echo "travis_fold:start:MAKE" - make osrm-extract --jobs=3 - make --jobs=${JOBS} @@ -171,6 +171,6 @@ after_success: ./scripts/format.sh # we don't want to fail just yet fi - | - if [ -n "${COVERAGE}" ]; then + if [ -n "${ENABLE_COVERAGE}" ]; then bash <(curl -s https://codecov.io/bash) fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dee28a88e1..e0f2e779530 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,9 +49,9 @@ endif() 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 OFF) -option(COVERAGE OFF) -option(SANITIZER 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) @@ -109,7 +109,6 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-inline -fno-omit-frame-pointer") - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ggdb") endif() @@ -175,17 +174,17 @@ if(CMAKE_BUILD_TYPE MATCHES Release) endif() set(MAYBE_COVERAGE_LIBRARIES "") -if (COVERAGE) +if (ENABLE_COVERAGE) if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") - message(ERROR "COVERAGE=ON only make sense with a Debug build") + message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build") endif() message(INFO "Enabling coverage") set(MAYBE_COVERAGE_LIBRARIES "gcov") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs") endif() -if (SANITIZER) +if (ENABLE_SANITIZER) if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") - message(ERROR "SANITIZER=ON only make sense with a Debug build") + message(ERROR "ENABLE_SANITIZER=ON only make sense with a Debug build") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") endif()