Unverified Commit 13bd2f5b authored by yiwu-arbug's avatar yiwu-arbug Committed by GitHub

Add travis config

Adding travis config to trigger CI build. Adjust cmake script accordingly.

Signed-off-by: Yi Wu yiwu@pingcap.com
parents bc9d8ac1 768f2cbf
language: cpp
os:
- linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
- libgflags-dev
matrix:
include:
- compiler: clang
- compiler: clang
env: SANITIZER="-DWITH_ASAN=ON"
- compiler: clang
env: SANITIZER="-DWITH_TSAN=ON"
- compiler: clang
env: SANITIZER="-DWITH_UBSAN=ON"
- env: COMPILER=gcc8
install:
- git clone --depth=1 --branch=tikv-3.0 https://github.com/pingcap/rocksdb.git
- if [ "${COMPILER}" == gcc8 ]; then
CC=gcc-8 && CXX=g++-8;
fi
script:
- ${CXX} --version
- cmake . -DROCKSDB_DIR=./rocksdb -DTRAVIS=ON ${SANITIZER} && make -j4 && ctest -R titan
...@@ -41,6 +41,7 @@ add_library(titan STATIC ${SOURCES}) ...@@ -41,6 +41,7 @@ add_library(titan STATIC ${SOURCES})
option(WITH_TITAN_TESTS "Build with tests." ON) option(WITH_TITAN_TESTS "Build with tests." ON)
option(WITH_TITAN_TOOLS "Build with tools." ON) option(WITH_TITAN_TOOLS "Build with tools." ON)
option(TRAVIS "Building in Travis." OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(WITH_TITAN_TESTS OFF) set(WITH_TITAN_TESTS OFF)
...@@ -49,12 +50,13 @@ endif() ...@@ -49,12 +50,13 @@ endif()
if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS) if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS)
add_subdirectory(${ROCKSDB_DIR} rocksdb EXCLUDE_FROM_ALL) add_subdirectory(${ROCKSDB_DIR} rocksdb EXCLUDE_FROM_ALL)
# -latomic is needed when building titandb_stress using clang.
link_libraries(atomic)
endif() endif()
if (WITH_TITAN_TESTS) if (WITH_TITAN_TESTS)
include(CTest) include(CTest)
find_package(Threads REQUIRED) include_directories(SYSTEM ${ROCKSDB_DIR}/third-party/gtest-1.7.0/fused-src)
find_package(GTest REQUIRED)
set(TESTS set(TESTS
blob_file_iterator_test blob_file_iterator_test
blob_file_size_collector_test blob_file_size_collector_test
...@@ -69,27 +71,31 @@ if (WITH_TITAN_TESTS) ...@@ -69,27 +71,31 @@ if (WITH_TITAN_TESTS)
set(TEST_LIBS set(TEST_LIBS
titan titan
rocksdb rocksdb
testharness
testutillib testutillib
Threads::Threads gtest)
GTest::GTest)
foreach(test ${TESTS}) foreach(test ${TESTS})
add_executable(titan_${test} src/${test}.cc) add_executable(titan_${test} src/${test}.cc $<TARGET_OBJECTS:testharness>)
target_include_directories(titan_${test} PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(titan_${test} ${TEST_LIBS}) target_link_libraries(titan_${test} ${TEST_LIBS})
add_test(titan_${test} titan_${test}) add_test(titan_${test} titan_${test})
endforeach(test ${TESTS}) endforeach(test ${TESTS})
endif() endif()
if (WITH_TITAN_TOOLS) if (WITH_TITAN_TOOLS)
find_package(gflags REQUIRED)
add_definitions(-DGFLAGS)
set(TOOLS_LIBS set(TOOLS_LIBS
titan titan
rocksdb) rocksdb)
if (NOT TRAVIS)
find_package(gflags REQUIRED)
else()
# Hack: On Travis (with Ubuntu xenial or before), libgflags-dev package doesn't come with
# gflags-config.cmake, so find_package will fail. Hard-code gflag path for now.
set(gflags_INCLUDE_DIR "/usr/include/gflags")
list(APPEND TOOLS_LIBS "/usr/lib/x86_64-linux-gnu/libgflags.a")
endif()
add_definitions(-DGFLAGS)
add_executable(titandb_stress tools/titandb_stress.cc) add_executable(titandb_stress tools/titandb_stress.cc)
target_include_directories(titandb_stress PRIVATE ${gflags_INCLUDE_DIR}) target_include_directories(titandb_stress PRIVATE ${gflags_INCLUDE_DIR})
target_link_libraries(titandb_stress ${TOOLS_LIBS}) target_link_libraries(titandb_stress ${TOOLS_LIBS})
......
# Generate compile and link flags # Generate compile and link flags
# Extracted from rocksdb/CMakeLists.txt # Extracted from rocksdb/CMakeLists.txt
option(WITH_JEMALLOC "build with JeMalloc" OFF)
if (WITH_JEMALLOC)
add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE)
endif()
option(WITH_SNAPPY "build with SNAPPY" OFF)
if (WITH_SNAPPY)
add_definitions(-DSNAPPY)
endif()
option(WITH_LZ4 "build with lz4" OFF)
if (WITH_LZ4)
add_definitions(-DLZ4)
endif()
option(WITH_ZLIB "build with zlib" OFF)
if (WITH_ZLIB)
add_definitions(-DZLIB)
endif()
option(WITH_ZSTD "build with zstd" OFF)
if (WITH_ZSTD)
add_definitions(-DZSTD)
endif()
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W4 /wd4127 /wd4800 /wd4996 /wd4351 /wd4100 /wd4204 /wd4324") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W4 /wd4127 /wd4800 /wd4996 /wd4351 /wd4100 /wd4204 /wd4324")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment