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

cmake: include dependencies headers (#4)

Update cmake script to add jemalloc and compression libraries' include directories. This is to fix missing headers in build, e.g: https://travis-ci.org/pingcap/rust-rocksdb/jobs/529604990

After the fix rust-rocksdb build will pass: https://travis-ci.org/yiwu-arbug/rust-rocksdb/jobs/529906506
parent 13bd2f5b
dist: xenial
language: cpp language: cpp
os: os:
...@@ -14,12 +16,15 @@ addons: ...@@ -14,12 +16,15 @@ addons:
matrix: matrix:
include: include:
- compiler: clang - compiler: clang
env: BUILD_TYPE="Debug"
- compiler: clang
env: BUILD_TYPE="Release"
- compiler: clang - compiler: clang
env: SANITIZER="-DWITH_ASAN=ON" env: SANITIZER="ASAN"
- compiler: clang - compiler: clang
env: SANITIZER="-DWITH_TSAN=ON" env: SANITIZER="TSAN"
- compiler: clang - compiler: clang
env: SANITIZER="-DWITH_UBSAN=ON" env: SANITIZER="UBSAN"
- env: COMPILER=gcc8 - env: COMPILER=gcc8
install: install:
...@@ -27,7 +32,16 @@ install: ...@@ -27,7 +32,16 @@ install:
- if [ "${COMPILER}" == gcc8 ]; then - if [ "${COMPILER}" == gcc8 ]; then
CC=gcc-8 && CXX=g++-8; CC=gcc-8 && CXX=g++-8;
fi fi
- if [ ! -z "${BUILD_TYPE}" ]; then
BUILD_OPT="-DCMAKE_BUILD_TYPE=${BUILD_TYPE}";
fi
- if [ ! -z "${SANITIZER}" ]; then
SANITIZER_OPT="-DWITH_${SANITIZER}=ON" && TOOLS_OPT="-DWITH_TITAN_TOOLS=OFF";
fi
script: script:
- ${CXX} --version - ${CXX} --version
- cmake . -DROCKSDB_DIR=./rocksdb -DTRAVIS=ON ${SANITIZER} && make -j4 && ctest -R titan - echo $BUILD_OPT
- echo $SANITIZER_OPT
- echo $TOOLS_OPT
- cmake . -DROCKSDB_DIR=./rocksdb -DTRAVIS=ON ${BUILD_OPT} ${SANITIZER_OPT} ${TOOLS_OPT} && make -j4 && ctest -R titan
...@@ -7,6 +7,7 @@ if (NOT DEFINED ROCKSDB_DIR) ...@@ -7,6 +7,7 @@ if (NOT DEFINED ROCKSDB_DIR)
message(FATAL_ERROR "ROCKSDB_DIR is not defined.") message(FATAL_ERROR "ROCKSDB_DIR is not defined.")
endif() endif()
list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DIR}/cmake/modules/")
include(cmake/rocksdb_flags.cmake) include(cmake/rocksdb_flags.cmake)
include_directories(${ROCKSDB_DIR}) include_directories(${ROCKSDB_DIR})
...@@ -45,7 +46,6 @@ option(TRAVIS "Building in Travis." OFF) ...@@ -45,7 +46,6 @@ 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)
set(WITH_TITAN_TOOLS OFF)
endif() endif()
if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS) if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS)
...@@ -54,7 +54,7 @@ if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS) ...@@ -54,7 +54,7 @@ if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS)
link_libraries(atomic) link_libraries(atomic)
endif() endif()
if (WITH_TITAN_TESTS) if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release"))
include(CTest) include(CTest)
include_directories(SYSTEM ${ROCKSDB_DIR}/third-party/gtest-1.7.0/fused-src) include_directories(SYSTEM ${ROCKSDB_DIR}/third-party/gtest-1.7.0/fused-src)
set(TESTS set(TESTS
......
...@@ -4,27 +4,44 @@ ...@@ -4,27 +4,44 @@
option(WITH_JEMALLOC "build with JeMalloc" OFF) option(WITH_JEMALLOC "build with JeMalloc" OFF)
if (WITH_JEMALLOC) if (WITH_JEMALLOC)
find_package(JeMalloc REQUIRED)
add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE)
include_directories(${JEMALLOC_INCLUDE_DIR})
endif() endif()
option(WITH_SNAPPY "build with SNAPPY" OFF) option(WITH_SNAPPY "build with SNAPPY" OFF)
if (WITH_SNAPPY) if (WITH_SNAPPY)
find_package(snappy REQUIRED)
add_definitions(-DSNAPPY) add_definitions(-DSNAPPY)
include_directories(${SNAPPY_INCLUDE_DIR})
endif()
option(WITH_BZ2 "build with bzip2" OFF)
if (WITH_BZ2)
find_package(bzip2 REQUIRED)
add_definitions(-DBZIP2)
include_directories(${BZIP2_INCLUDE_DIR})
endif() endif()
option(WITH_LZ4 "build with lz4" OFF) option(WITH_LZ4 "build with lz4" OFF)
if (WITH_LZ4) if (WITH_LZ4)
find_package(lz4 REQUIRED)
add_definitions(-DLZ4) add_definitions(-DLZ4)
include_directories(${LZ4_INCLUDE_DIR})
endif() endif()
option(WITH_ZLIB "build with zlib" OFF) option(WITH_ZLIB "build with zlib" OFF)
if (WITH_ZLIB) if (WITH_ZLIB)
find_package(zlib REQUIRED)
add_definitions(-DZLIB) add_definitions(-DZLIB)
include_directories(${ZLIB_INCLUDE_DIR})
endif() endif()
option(WITH_ZSTD "build with zstd" OFF) option(WITH_ZSTD "build with zstd" OFF)
if (WITH_ZSTD) if (WITH_ZSTD)
find_package(zstd REQUIRED)
add_definitions(-DZSTD) add_definitions(-DZSTD)
include_directories(${ZSTD_INCLUDE_DIR})
endif() endif()
if(MSVC) if(MSVC)
......
...@@ -47,9 +47,10 @@ class BlobFileSizeCollectorTest : public testing::Test { ...@@ -47,9 +47,10 @@ class BlobFileSizeCollectorTest : public testing::Test {
void NewTableBuilder(WritableFileWriter* file, void NewTableBuilder(WritableFileWriter* file,
std::unique_ptr<TableBuilder>* result) { std::unique_ptr<TableBuilder>* result) {
CompressionOptions compression_opts;
TableBuilderOptions options(cf_ioptions_, cf_moptions_, TableBuilderOptions options(cf_ioptions_, cf_moptions_,
cf_ioptions_.internal_comparator, &collectors_, cf_ioptions_.internal_comparator, &collectors_,
kNoCompression, CompressionOptions(), nullptr, kNoCompression, compression_opts, nullptr,
false, kDefaultColumnFamilyName, 0); false, kDefaultColumnFamilyName, 0);
result->reset(table_factory_->NewTableBuilder(options, 0, file)); result->reset(table_factory_->NewTableBuilder(options, 0, file));
ASSERT_TRUE(*result); ASSERT_TRUE(*result);
......
...@@ -142,9 +142,10 @@ class TableBuilderTest : public testing::Test { ...@@ -142,9 +142,10 @@ class TableBuilderTest : public testing::Test {
void NewTableBuilder(WritableFileWriter* file, void NewTableBuilder(WritableFileWriter* file,
std::unique_ptr<TableBuilder>* result) { std::unique_ptr<TableBuilder>* result) {
CompressionOptions compression_opts;
TableBuilderOptions options(cf_ioptions_, cf_moptions_, TableBuilderOptions options(cf_ioptions_, cf_moptions_,
cf_ioptions_.internal_comparator, &collectors_, cf_ioptions_.internal_comparator, &collectors_,
kNoCompression, CompressionOptions(), nullptr, kNoCompression, compression_opts, nullptr,
false, kDefaultColumnFamilyName, 0); false, kDefaultColumnFamilyName, 0);
result->reset(table_factory_->NewTableBuilder(options, 0, file)); result->reset(table_factory_->NewTableBuilder(options, 0, file));
} }
......
...@@ -212,6 +212,7 @@ class TitanDBTest : public testing::Test { ...@@ -212,6 +212,7 @@ class TitanDBTest : public testing::Test {
cf_options); cf_options);
ASSERT_EQ(original_table_factory, immu_cf_options.table_factory); ASSERT_EQ(original_table_factory, immu_cf_options.table_factory);
ASSERT_OK(db->Close()); ASSERT_OK(db->Close());
delete db;
DeleteDir(env_, options_.dirname); DeleteDir(env_, options_.dirname);
DeleteDir(env_, dbname_); DeleteDir(env_, dbname_);
...@@ -377,7 +378,7 @@ TEST_F(TitanDBTest, IngestExternalFiles) { ...@@ -377,7 +378,7 @@ TEST_F(TitanDBTest, IngestExternalFiles) {
} }
} }
TEST_F(TitanDBTest, DISABLED_ReadAfterDropCF) { TEST_F(TitanDBTest, ReadAfterDropCF) {
Open(); Open();
const uint64_t kNumCF = 3; const uint64_t kNumCF = 3;
for(uint64_t i = 1; i <= kNumCF; i++) { for(uint64_t i = 1; i <= kNumCF; i++) {
......
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