Commit 53c1096f authored by Wu Jiayu's avatar Wu Jiayu Committed by yiwu-arbug

Fix mac build (#41)

- There is no libatomic in MacOS clang(and maybe some other environment), so check if libatomic existed before link.
- Added MacOS build to travis. For TSAN build , a unused-command-line-argument is defined in RocksDB cmake file, witch will fail compilation on MacOS, skip it.
parent d9761046
...@@ -8,3 +8,4 @@ titandb_stress ...@@ -8,3 +8,4 @@ titandb_stress
build/ build/
.idea/ .idea/
.vscode/ .vscode/
cmake-build-debug/
...@@ -4,6 +4,9 @@ language: cpp ...@@ -4,6 +4,9 @@ language: cpp
os: os:
- linux - linux
- osx
compiler: clang
osx_image: xcode10.2
addons: addons:
apt: apt:
...@@ -16,21 +19,37 @@ addons: ...@@ -16,21 +19,37 @@ addons:
- lcov - lcov
- clang-format-7 - clang-format-7
env:
- BUILD_TYPE="Release"
- SANITIZER="ASAN"
- SANITIZER="TSAN"
- SANITIZER="UBSAN"
# For GCC build, we also report code coverage to codecov. # For GCC build, we also report code coverage to codecov.
matrix: matrix:
include: exclude:
- compiler: clang - os: osx
env: BUILD_TYPE="Release"
- compiler: clang
env: SANITIZER="ASAN"
- compiler: clang
env: SANITIZER="TSAN" env: SANITIZER="TSAN"
- compiler: clang - os: osx
env: SANITIZER="UBSAN" env: SANITIZER="UBSAN"
- env: COMPILER=gcc7 - os: osx
- env: FORMATTER=ON env: BUILD_TYPE="Release"
include:
- os: linux
compiler:
env:
- COMPILER=gcc7
- os: linux
compiler:
env:
- FORMATTER=ON
install: install:
# osx dependencies
- if [ "${TRAVIS_OS_NAME}" == osx ]; then
brew install gflags zstd lz4 snappy xz;
fi
- git clone --depth=1 --branch=tikv-3.0 https://github.com/pingcap/rocksdb.git - git clone --depth=1 --branch=tikv-3.0 https://github.com/pingcap/rocksdb.git
- export CTEST_OUTPUT_ON_FAILURE=1 - export CTEST_OUTPUT_ON_FAILURE=1
- if [ "${COMPILER}" == gcc7 ]; then - if [ "${COMPILER}" == gcc7 ]; then
......
...@@ -57,7 +57,11 @@ endif() ...@@ -57,7 +57,11 @@ 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. # -latomic is needed when building titandb_stress using clang.
link_libraries(atomic) # check if libatomic exist before link
find_library(HAS_ATOMIC NAMES atomic libatomic.so.1 atomic.so.1)
if (HAS_ATOMIC)
link_libraries(atomic)
endif()
endif() endif()
if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release")) if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release"))
...@@ -98,8 +102,10 @@ if (WITH_TITAN_TOOLS) ...@@ -98,8 +102,10 @@ if (WITH_TITAN_TOOLS)
else() else()
# Hack: On Travis (with Ubuntu xenial or before), libgflags-dev package doesn't come with # 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. # gflags-config.cmake, so find_package will fail. Hard-code gflag path for now.
set(gflags_INCLUDE_DIR "/usr/include/gflags") if (NOT APPLE)
list(APPEND TOOLS_LIBS "/usr/lib/x86_64-linux-gnu/libgflags.a") set(gflags_INCLUDE_DIR "/usr/include/gflags")
list(APPEND TOOLS_LIBS "/usr/lib/x86_64-linux-gnu/libgflags.a")
endif()
endif() endif()
add_definitions(-DGFLAGS) add_definitions(-DGFLAGS)
......
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