From b309300660a2987c66851b3ded80d69c36e3b6fb Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Mon, 10 Aug 2020 17:19:04 +0800 Subject: [PATCH] Refactor the build system (#107) * Refactor build * Suppress -Wmissing-field-initializers * Fix CI * Fix linking --- .github/workflows/pull_request.yml | 2 - CMakeLists.txt | 492 +++------------------------- cmake/AddDependentProject.cmake | 72 ---- cmake/FetchModule.cmake | 42 +++ cmake/FindBzip2.cmake | 34 -- cmake/FindDoubleConversion.cmake | 30 -- cmake/FindFatal.cmake | 27 -- cmake/FindFbthrift.cmake | 33 -- cmake/FindFolly.cmake | 30 -- cmake/FindGPERF.cmake | 61 ---- cmake/FindGflags.cmake | 30 -- cmake/FindGlog.cmake | 30 -- cmake/FindGoogletest.cmake | 30 -- cmake/FindJemalloc.cmake | 29 -- cmake/FindKrb5.cmake | 169 ---------- cmake/FindLZ4.cmake | 27 -- cmake/FindLibevent.cmake | 30 -- cmake/FindLibunwind.cmake | 24 -- cmake/FindMstch.cmake | 31 -- cmake/FindPCHSupport.cmake | 95 ------ cmake/FindProxygen.cmake | 31 -- cmake/FindRocksdb.cmake | 30 -- cmake/FindSnappy.cmake | 30 -- cmake/FindWangle.cmake | 30 -- cmake/FindZstd.cmake | 34 -- cmake/LinkerConfig.cmake | 22 -- src/codec/RowReaderV2.cpp | 4 +- src/codec/RowWriterV2.cpp | 6 +- src/codec/test/RowReaderV2Test.cpp | 4 +- src/codec/test/RowWriterV2Test.cpp | 2 +- src/mock/MockData.cpp | 4 +- src/mock/MockData.h | 2 +- src/storage/test/IndexWriteTest.cpp | 8 +- 33 files changed, 110 insertions(+), 1415 deletions(-) delete mode 100644 cmake/AddDependentProject.cmake create mode 100644 cmake/FetchModule.cmake delete mode 100644 cmake/FindBzip2.cmake delete mode 100644 cmake/FindDoubleConversion.cmake delete mode 100644 cmake/FindFatal.cmake delete mode 100644 cmake/FindFbthrift.cmake delete mode 100644 cmake/FindFolly.cmake delete mode 100644 cmake/FindGPERF.cmake delete mode 100644 cmake/FindGflags.cmake delete mode 100644 cmake/FindGlog.cmake delete mode 100644 cmake/FindGoogletest.cmake delete mode 100644 cmake/FindJemalloc.cmake delete mode 100644 cmake/FindKrb5.cmake delete mode 100644 cmake/FindLZ4.cmake delete mode 100644 cmake/FindLibevent.cmake delete mode 100644 cmake/FindLibunwind.cmake delete mode 100644 cmake/FindMstch.cmake delete mode 100644 cmake/FindPCHSupport.cmake delete mode 100644 cmake/FindProxygen.cmake delete mode 100644 cmake/FindRocksdb.cmake delete mode 100644 cmake/FindSnappy.cmake delete mode 100644 cmake/FindWangle.cmake delete mode 100644 cmake/FindZstd.cmake delete mode 100644 cmake/LinkerConfig.cmake diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 627eca180..18e8e8471 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -119,8 +119,6 @@ jobs: -B build ;; esac - - name: Make common - run: cmake --build modules/common/ -j $(nproc) - name: Make storage run: cmake --build build/ -j $(nproc) - name: CTest diff --git a/CMakeLists.txt b/CMakeLists.txt index 26fe8b6d4..9d74df4de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,8 @@ # NEBULA_OTHER_ROOT -- Specify the root directory for user build # -- Split with ":", exp: DIR:DIR # -# NEBULA_COMMON_PATH -- Path to nebula-common source directory +# NEBULA_COMMON_SOURCE_DIR -- Path to nebula-common source directory +# NEBULA_COMMON_BUILD_DIR -- Path to nebula-common build directory # NEBULA_COMMON_REPO_URL -- Git URL for the nebula-common repo # NEBULA_COMMON_REPO_TAG -- Tag/branch of the nebula-common repo # @@ -21,342 +22,62 @@ # ENABLE_NATIVE -- Build native client # ENABLE_TESTING -- Build unit test # -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.5.0) -project("Nebula Graph" C CXX) - -set(CMAKE_SKIP_RPATH TRUE) - -option(ENABLE_JEMALLOC "Whether to link jemalloc to all executables" ON) -option(ENABLE_NATIVE "Whether to build native client" OFF) -option(ENABLE_CCACHE "Whether to use ccache to speed up compiling" ON) -option(ENABLE_ASAN "Whether to turn AddressSanitizer ON or OFF" OFF) -option(ENABLE_TESTING "Whether to turn unit test ON or OFF" ON) -option(ENABLE_UBSAN "Whether to turn Undefined Behavior Sanitizer ON or OFF" OFF) -option(ENABLE_FUZZ_TEST "Whether to turn Fuzz Test ON or OFF" OFF) -option(ENABLE_UPDATE "Whether to update common" OFF) -option(ENABLE_STRICT_ALIASING "Whether to turn strict-aliasing ON or OFF" OFF) - -message(STATUS "ENABLE_ASAN: ${ENABLE_ASAN}") -message(STATUS "ENABLE_TESTING: ${ENABLE_TESTING}") -message(STATUS "ENABLE_UBSAN: ${ENABLE_UBSAN}") -message(STATUS "ENABLE_FUZZ_TEST: ${ENABLE_FUZZ_TEST}") +project("Nebula Storage" C CXX) +option(ENABLE_MODULE_UPDATE "Automatically update module" OFF) if (ENABLE_NATIVE) message(STATUS "ENABLE_NATIVE is ${ENABLE_NATIVE}") add_compile_options(-fPIC) endif() -if (ENABLE_TESTING) - enable_testing() -endif() - -if (!CMAKE_CXX_COMPILER) - message(FATAL_ERROR "No C++ compiler found") -endif() - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -no-pie") - -# To detect if ccache available -find_program(ccache_program_found "ccache") -if (ENABLE_CCACHE AND ccache_program_found) - message(STATUS "ENABLE_CCACHE: ON") - if (NOT $ENV{CCACHE_DIR} STREQUAL "") - message(STATUS "CCACHE_DIR: $ENV{CCACHE_DIR}") +add_definitions(-DNEBULA_HOME=${CMAKE_SOURCE_DIR}) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +if(NOT NEBULA_COMMON_SOURCE_DIR) + include(FetchModule) + nebula_fetch_module( + NAME + common + URL + ${NEBULA_COMMON_REPO_URL} + TAG + ${NEBULA_COMMON_REPO_TAG} + UPDATE + ${ENABLE_MODULE_UPDATE} + ) + set(nebula_common_source_dir ${CMAKE_SOURCE_DIR}/modules/common) + set(nebula_common_build_dir ${CMAKE_BINARY_DIR}/modules/common) +else() + set(nebula_common_source_dir ${NEBULA_COMMON_SOURCE_DIR}) + if(NOT NEBULA_COMMON_BUILD_DIR) + set(nebula_common_build_dir ${CMAKE_BINARY_DIR}/modules/common) else() - message(STATUS "CCACHE_DIR: $ENV{HOME}/.ccache") + set(nebula_common_build_dir ${NEBULA_COMMON_BUILD_DIR}) endif() - set(CMAKE_CXX_COMPILER_LAUNCHER "ccache") -elseif (ENABLE_CCACHE) - message(STATUS "CCACHE: enabled but not found") - set(CMAKE_CXX_COMPILER_LAUNCHER) -else () - message(STATUS "CCACHE: OFF") - set(CMAKE_CXX_COMPILER_LAUNCHER) -endif() - -# Possible values are Debug, Release, RelWithDebInfo, MinSizeRel -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Debug") -endif(NOT CMAKE_BUILD_TYPE) - -if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") - message(STATUS "Set macro _FORTIFY_SOURCE=2") - add_definitions(-D_FORTIFY_SOURCE=2) -endif() - -message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE} " - "(Options are: Debug, Release, RelWithDebInfo, MinSizeRel)") - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "_build") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "_build") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "_build") - -# Set the project home dir -set(NEBULA_HOME ${CMAKE_CURRENT_SOURCE_DIR}) -add_definitions(-DNEBULA_HOME=${NEBULA_HOME}) - -# Let s2 use glog -add_definitions(-DS2_USE_GLOG) - -if (NEBULA_BUILD_VERSION) - add_definitions(-DNEBULA_BUILD_VERSION=${NEBULA_BUILD_VERSION}) endif() -if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local") - set(CMAKE_INSTALL_PREFIX "/usr/local/nebula") -endif() -message(STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX}) - -find_package(Git) -if (GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") - execute_process( - COMMAND - ${GIT_EXECUTABLE} rev-parse --short HEAD - OUTPUT_VARIABLE GIT_INFO_SHA - ) -endif() - -if (GIT_INFO_SHA) - string(REGEX REPLACE "[^0-9a-f]+" "" GIT_INFO_SHA "${GIT_INFO_SHA}") - add_definitions(-DGIT_INFO_SHA=${GIT_INFO_SHA}) -endif() - -# To include customized FindXXX.cmake modules -list(APPEND CMAKE_MODULE_PATH "${NEBULA_HOME}/cmake") -#list(APPEND CMAKE_MODULE_PATH "${NEBULA_HOME}/modules/common") -message(STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH}) -# When NEBULA_THIRDPARTY_ROOT is null, set default value as /opt/nebula/third-party -if("${NEBULA_THIRDPARTY_ROOT}" STREQUAL "") - SET(NEBULA_THIRDPARTY_ROOT "/opt/vesoft/third-party") -endif() - -if("${NEBULA_COMMON_REPO_URL}" STREQUAL "") - SET(NEBULA_COMMON_REPO_URL "git@github.com:vesoft-inc-private/nebula-common.git") -endif() -message(STATUS "NEBULA_COMMON_REPO_URL: " ${NEBULA_COMMON_REPO_URL}) - -if("${NEBULA_COMMON_REPO_TAG}" STREQUAL "") - SET(NEBULA_COMMON_REPO_TAG "master") -endif() -message(STATUS "NEBULA_COMMON_REPO_TAG: " ${NEBULA_COMMON_REPO_TAG}) - -SET(NEBULA_COMMON_PACKAGE "nebula-common") -SET(nebula-common_DIR ${CMAKE_CURRENT_SOURCE_DIR}/modules/common) -if (NOT "${NEBULA_COMMON_PATH}" STREQUAL "") - message(STATUS "NEBULA_COMMON_PATH: " ${NEBULA_COMMON_PATH}) - execute_process( - COMMAND ln -snf ${NEBULA_COMMON_PATH} ${NEBULA_HOME}/modules/common - ) -endif() - -# Configure the dependent projects -include(AddDependentProject) -message(STATUS "") -message(STATUS ">>>>> Configuring the nebula-common repo <<<<<") -add_dependent_project( - ${NEBULA_HOME}/modules - common - ${NEBULA_COMMON_REPO_URL} - ${NEBULA_COMMON_REPO_TAG} +list(APPEND CMAKE_MODULE_PATH ${nebula_common_source_dir}/cmake) +list(APPEND CMAKE_MODULE_PATH ${nebula_common_source_dir}/cmake/nebula) + +include(PlatformCheck) +include(GeneralCMakeOptions) +include(GeneralCMakeConfig) +include(GeneralCompilerConfig) +include(LinkerConfig) +include(CcacheConfig) +include(ThirdPartyConfig) +include(SanitizerConfig) +include(GitHooksConfig) +include(GitInfoConfig) +include(NebulaCMakeMacros) +include(ConfigNebulaCommon) +config_nebula_common( + SOURCE_DIR ${nebula_common_source_dir} + BUILD_DIR ${nebula_common_build_dir} ) -find_package(${NEBULA_COMMON_PACKAGE} REQUIRED PATHS "${NEBULA_HOME}/modules/common") -message(STATUS ">>>>> The nebula-common repo has been configured successfully <<<<<") -message(STATUS "") -include_directories(AFTER modules/common/src) - -# third-party -if(NOT ${NEBULA_THIRDPARTY_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_THIRDPARTY_ROOT: " ${NEBULA_THIRDPARTY_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/lib) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/lib64) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/bin) - include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/include) - link_directories( - ${NEBULA_THIRDPARTY_ROOT}/lib - ${NEBULA_THIRDPARTY_ROOT}/lib64 - ) -endif() - -if(NOT ${NEBULA_OTHER_ROOT} STREQUAL "") - string(REPLACE ":" ";" DIR_LIST ${NEBULA_OTHER_ROOT}) - list(LENGTH DIR_LIST len) - foreach(DIR IN LISTS DIR_LIST ) - list(INSERT CMAKE_INCLUDE_PATH 0 ${DIR}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${DIR}/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${DIR}/bin) - include_directories(SYSTEM ${DIR}/include) - link_directories(${DIR}/lib) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${DIR}/lib") - endforeach() -endif() - -string(REPLACE ";" ":" INCLUDE_PATH_STR "${CMAKE_INCLUDE_PATH}") -string(REPLACE ";" ":" LIBRARY_PATH_STR "${CMAKE_LIBRARY_PATH}") -string(REPLACE ";" ":" PROGRAM_PATH_STR "${CMAKE_PROGRAM_PATH}") -message(STATUS "CMAKE_INCLUDE_PATH: " ${INCLUDE_PATH_STR}) -message(STATUS "CMAKE_LIBRARY_PATH: " ${LIBRARY_PATH_STR}) -message(STATUS "CMAKE_PROGRAM_PATH: " ${PROGRAM_PATH_STR}) - -find_package(Bzip2 REQUIRED) -find_package(DoubleConversion REQUIRED) -find_package(Fatal REQUIRED) -find_package(Fbthrift REQUIRED) -find_package(Folly REQUIRED) -find_package(Gflags REQUIRED) -find_package(Glog REQUIRED) -find_package(Googletest REQUIRED) -if(ENABLE_JEMALLOC) - find_package(Jemalloc REQUIRED) -endif() -find_package(Libevent REQUIRED) -find_package(Mstch REQUIRED) -find_package(Proxygen REQUIRED) -find_package(Rocksdb REQUIRED) -find_package(Snappy REQUIRED) -find_package(Wangle REQUIRED) -find_package(ZLIB REQUIRED) -find_package(Zstd REQUIRED) -find_package(Boost REQUIRED) -find_package(OpenSSL REQUIRED) -find_package(Krb5 REQUIRED gssapi) -find_package(GPERF 2.8 REQUIRED) -find_package(Libunwind REQUIRED) -find_package(LZ4 MODULE) -find_package(LibLZMA MODULE) - -if(NOT ENABLE_ASAN AND NOT ENABLE_NATIVE) - find_package(PCHSupport) - add_compile_options(-Winvalid-pch) -endif() - -if(NOT ENABLE_STRICT_ALIASING) - add_compile_options(-fno-strict-aliasing) -endif() - -find_package(nebula-common REQUIRED) - -add_compile_options(-Wall) -add_compile_options(-Werror) -add_compile_options(-Wunused-parameter) -add_compile_options(-Wshadow) -add_compile_options(-Wno-invalid-pch) -add_compile_options(-Wno-strict-aliasing) - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # This requries GCC 5.1+ - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1) - add_compile_options(-Wsuggest-override) - endif() -elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_compile_options(-Wno-overloaded-virtual) - add_compile_options(-Wno-self-assign-overloaded) - add_compile_options(-Wno-self-move) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic") - if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - add_compile_options(-fno-limit-debug-info) - endif() -endif() - -include(CheckCXXCompilerFlag) - -if(ENABLE_ASAN) - add_definitions(-DBUILT_WITH_SANITIZER) - set(CMAKE_REQUIRED_FLAGS "-fsanitize=address") - check_cxx_compiler_flag("-fsanitize=address" ENABLE_ASAN_OK) - if (NOT ENABLE_ASAN_OK) - MESSAGE(FATAL_ERROR "The compiler does not support address sanitizer") - endif() - add_compile_options(-fsanitize=address) - add_compile_options(-g) - add_compile_options(-fno-omit-frame-pointer) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") -endif() - -if(ENABLE_UBSAN) - check_cxx_compiler_flag("-fsanitize=undefined -fno-sanitize=alignment" ENABLE_UBSAN_OK) - if (NOT ENABLE_UBSAN_OK) - MESSAGE(FATAL_ERROR "The compiler does not support Undefined Behavior Sanitizer") - endif() - add_compile_options(-fsanitize=undefined -fno-sanitize=alignment) - if(NOT ENABLE_ASAN) - add_compile_options(-g) - add_compile_options(-fno-omit-frame-pointer) - endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined") -endif() - -if(ENABLE_FUZZ_TEST) - check_cxx_compiler_flag("-fsanitize=fuzzer" ENABLE_FUZZ_OK) - if (NOT ENABLE_FUZZ_OK) - MESSAGE(FATAL_ERROR "The compiler does not support fuzz testing") - endif() -endif() - -macro(nebula_add_executable) - cmake_parse_arguments( - nebula_exec # prefix - "" # - "NAME" # - "SOURCES;OBJECTS;LIBRARIES" # - ${ARGN} - ) - add_executable( - ${nebula_exec_NAME} - ${nebula_exec_SOURCES} - ${nebula_exec_OBJECTS} - ) - nebula_link_libraries( - ${nebula_exec_NAME} - ${nebula_exec_LIBRARIES} - ) - add_dependencies( - ${nebula_exec_NAME} - common_project - ) -endmacro() - -macro(nebula_add_test) - cmake_parse_arguments( - nebula_test # prefix - "DISABLED;FUZZER" # - "NAME" # - "SOURCES;OBJECTS;LIBRARIES" # - ${ARGN} - ) - - nebula_add_executable( - NAME ${nebula_test_NAME} - SOURCES ${nebula_test_SOURCES} - OBJECTS ${nebula_test_OBJECTS} - LIBRARIES ${nebula_test_LIBRARIES} - ) - - if (${nebula_test_FUZZER}) - #Currently only Clang supports fuzz test - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_target_properties(${nebula_test_NAME} PROPERTIES COMPILE_FLAGS "-g -fsanitize=fuzzer") - set_target_properties(${nebula_test_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer") - endif() - elseif (NOT ${nebula_test_DISABLED}) - string(REGEX REPLACE "${CMAKE_SOURCE_DIR}/src/(.*)/test" "\\1" test_group ${CMAKE_CURRENT_SOURCE_DIR}) - add_test(NAME ${nebula_test_NAME} COMMAND ${nebula_test_NAME}) - set_tests_properties(${nebula_test_NAME} PROPERTIES LABELS ${test_group}) - # e.g. cmake -DNEBULA_ASAN_PRELOAD=/path/to/libasan.so - # or, cmake -DNEBULA_ASAN_PRELOAD=`/path/to/gcc --print-file-name=libasan.so` - if (NEBULA_ASAN_PRELOAD) - set_property( - TEST ${nebula_test_NAME} - PROPERTY ENVIRONMENT LD_PRELOAD=${NEBULA_ASAN_PRELOAD} - ) - endif() - endif() -endmacro() # For simplicity, we make all ordinary libraries depend on the compile-time generated files, # including the precompiled header, a.k.a Base.h.gch, and thrift headers. @@ -368,102 +89,14 @@ macro(nebula_add_library name type) ) endmacro() -include_directories(AFTER ${NEBULA_HOME}/src) +include_directories(AFTER ${CMAKE_SOURCE_DIR}/src) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/kvstore/plugins) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/kvstore/plugins/hbase) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${NEBULA_THIRDPARTY_ROOT}/lib64") - -# All thrift libraries -set(THRIFT_LIBRARIES - thriftcpp2 - thrift - thriftprotocol - async - protocol - transport - concurrency - security - thriftfrozen2 - thrift-core - wangle -) - -set(ROCKSDB_LIBRARIES ${Rocksdb_LIBRARY}) - -# All compression libraries -set(COMPRESSION_LIBRARIES bz2 snappy zstd z) -if (LIBLZMA_FOUND) - include_directories(SYSTEM ${LIBLZMA_INCLUDE_DIRS}) - list(APPEND COMPRESSION_LIBRARIES ${LIBLZMA_LIBRARIES}) -endif() -if (LZ4_FOUND) - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) - list(APPEND COMPRESSION_LIBRARIES ${LZ4_LIBRARY}) -endif() - -if (NOT ENABLE_JEMALLOC OR ENABLE_ASAN) - set(JEMALLOC_LIB ) -else() - set(JEMALLOC_LIB jemalloc) -endif() - -execute_process( - COMMAND ldd --version - COMMAND head -1 - COMMAND cut -d ")" -f 2 - COMMAND cut -d " " -f 2 - OUTPUT_VARIABLE GLIBC_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE -) -message(STATUS "Glibc version is " ${GLIBC_VERSION}) - -if (GLIBC_VERSION VERSION_LESS "2.17") - set(GETTIME_LIB rt) -else() - set(GETTIME_LIB) -endif() - -# A wrapper for target_link_libraries() -macro(nebula_link_libraries target) - target_link_libraries( - ${target} - ${ARGN} - folly - glog - gflags - boost_context - boost_system - event - double-conversion - s2 - ${OPENSSL_SSL_LIBRARY} - ${OPENSSL_CRYPTO_LIBRARY} - ${KRB5_LIBRARIES} - ${COMPRESSION_LIBRARIES} - ${JEMALLOC_LIB} - ${LIBUNWIND_LIBRARIES} - keyutils - resolv - dl - ${GETTIME_LIB} - ${libatomic_link_flags} - -pthread - ) -endmacro(nebula_link_libraries) - -function(nebula_add_subdirectory dir_name) - if ((NOT ENABLE_TESTING) AND (${dir_name} STREQUAL test)) - return() - endif() - add_subdirectory(${dir_name}) -endfunction() - -add_subdirectory(src) -add_subdirectory(conf) -add_subdirectory(scripts) +nebula_add_subdirectory(src) +nebula_add_subdirectory(conf) +nebula_add_subdirectory(scripts) add_custom_target( clean-modules @@ -495,33 +128,12 @@ add_custom_target( DEPENDS clean-all ) - -IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") - # Create the pre-commit hook every time we run cmake - message(STATUS "Create the pre-commit hook") - set(PRE_COMMIT_HOOK ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit) - execute_process( - COMMAND - "rm" "-f" ${PRE_COMMIT_HOOK} - ) - execute_process( - COMMAND - "ln" "-s" ${CMAKE_CURRENT_SOURCE_DIR}/.linters/cpp/hooks/pre-commit.sh ${PRE_COMMIT_HOOK} - RESULT_VARIABLE retcode - ) - IF(${retcode} EQUAL 0) - MESSAGE(STATUS "Creating pre-commit hook done") - ELSE() - MESSAGE(FATAL_ERROR "Creating pre-commit hook failed: ${retcode}") - ENDIF() -ENDIF() - # package nebula to a deb/rpm file -set(CPACK_PACKAGE_DESCRIPTION "nebula-graph") -set(CPACK_PACKAGE_CONTACT "nebula-graph") +set(CPACK_PACKAGE_DESCRIPTION "nebula-storage") +set(CPACK_PACKAGE_CONTACT "nebula-storage") set(CPACK_PACKAGE_VERSION ${NEBULA_BUILD_VERSION}) set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0 + Common Clause 1.0") -set(CPACK_PACKAGE_NAME nebula-graph) +set(CPACK_PACKAGE_NAME nebula-storage) set(CPACK_SET_DESTDIR TRUE) set(CPACK_PACKAGE_RELOCATABLE FALSE) set(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) diff --git a/cmake/AddDependentProject.cmake b/cmake/AddDependentProject.cmake deleted file mode 100644 index 484a377f8..000000000 --- a/cmake/AddDependentProject.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) 2020 vesoft inc. All rights reserved. -# -# This source code is licensed under Apache 2.0 License, -# attached with Common Clause Condition 1.0, found in the LICENSES directory. -# - -macro(add_dependent_project base name repo tag) - -# Clone or update the repo -if(EXISTS ${base}/${name}/.git) - message(STATUS "Updating from the repo \"" ${repo} "\", update option ${ENABLE_UPDATE}") - if (ENABLE_UPDATE) - execute_process( - COMMAND ${GIT_EXECUTABLE} pull --depth=1 - WORKING_DIRECTORY ${base}/${name} - RESULT_VARIABLE clone_result - ) - endif() -else() - message(STATUS "Cloning from the repo \"" ${repo} "\"") - execute_process( - COMMAND - ${GIT_EXECUTABLE} clone --depth 1 --progress --branch ${tag} ${repo} ${base}/${name} - RESULT_VARIABLE clone_result - ) -endif() - -if(NOT ${clone_result} EQUAL 0) - message( - FATAL_ERROR - "Cannot clone the repo from \"" - ${repo} - "\" (branch \"" - ${tag} - "\"): \"" - ${clone_result} - "\"") -else() - message(STATUS "Updated the repo from \"" ${repo} "\" (branch \"" ${tag} "\")") -endif() - -# Configure the repo -execute_process( - COMMAND - ${CMAKE_COMMAND} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DNEBULA_THIRDPARTY_ROOT=${NEBULA_THIRDPARTY_ROOT} - -DNEBULA_OTHER_ROOT=${NEBULA_OTHER_ROOT} - -DENABLE_JEMALLOC=${ENABLE_JEMALLOC} - -DENABLE_NATIVE=${ENABLE_NATIVE} - -DENABLE_TESTING=false - -DENABLE_CCACHE=${ENABLE_CCACHE} - -DENABLE_ASAN=${ENABLE_ASAN} - -DENABLE_UBSAN=${ENABLE_UBSAN} - . - WORKING_DIRECTORY ${base}/${name} - RESULT_VARIABLE cmake_result -) -if(NOT ${cmake_result} EQUAL 0) - message(FATAL_ERROR "Failed to configure the dependent project \"" ${name} "\"") -endif() - -# Add a custom target to build the project -add_custom_target( - ${name}_project ALL - COMMAND make -j$(nproc) - WORKING_DIRECTORY ${base}/${name} -) - -endmacro() diff --git a/cmake/FetchModule.cmake b/cmake/FetchModule.cmake new file mode 100644 index 000000000..33259cd9b --- /dev/null +++ b/cmake/FetchModule.cmake @@ -0,0 +1,42 @@ +# Copyright (c) 2020 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License, +# attached with Common Clause Condition 1.0, found in the LICENSES directory. +# + +find_package(Git) +macro(nebula_fetch_module) + cmake_parse_arguments( + module # + "" # + "URL;TAG;UPDATE;NAME" # + "" # + ${ARGN} + ) + set(module_dir ${CMAKE_SOURCE_DIR}/modules/${module_NAME}) + if(NOT EXISTS ${module_dir}/.git) + message(STATUS "Cloning from ${module_URL}") + execute_process( + COMMAND + ${GIT_EXECUTABLE} clone + --single-branch + --branch ${module_TAG} + ${module_URL} ${module_dir} + RESULT_VARIABLE fetch_status + ERROR_VARIABLE ERROR_MESSAGE + ) + if(NOT ${fetch_status} EQUAL 0) + message(FATAL_ERROR "Cloning failed") + endif() + elseif(${module_UPDATE}) + message(STATUS "Updating from ${module_URL}") + execute_process( + COMMAND ${GIT_EXECUTABLE} pull + WORKING_DIRECTORY ${module_dir} + RESULT_VARIABLE fetch_status + ) + if(NOT ${fetch_status} EQUAL 0) + message(FATAL_ERROR "Updating failed") + endif() + endif() +endmacro() diff --git a/cmake/FindBzip2.cmake b/cmake/FindBzip2.cmake deleted file mode 100644 index 70f944a3c..000000000 --- a/cmake/FindBzip2.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - Try to find Bzip2 includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Bzip2) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Bzip2_FOUND System has bzip2, include and lib dirs found. -# Bzip2_INCLUDE_DIR The bzip2 includes directories. -# Bzip2_LIBRARY The bzip2 library. -# Bzip2_BIN The bzip2 binary. - -find_path(Bzip2_INCLUDE_DIR NAMES bzlib.h) -find_library(Bzip2_LIBRARY NAMES libbz2.a) -find_program(Bzip2_BIN NAMES bzip2) - -if(Bzip2_INCLUDE_DIR AND Bzip2_LIBRARY AND Bzip2_BIN) - set(Bzip2_FOUND TRUE) - mark_as_advanced( - Bzip2_INCLUDE_DIR - Bzip2_LIBRARY - Bzip2_BIN - ) -endif() - -if(NOT Bzip2_FOUND) - message(FATAL_ERROR "Bzip2 doesn't exist") -endif() - - diff --git a/cmake/FindDoubleConversion.cmake b/cmake/FindDoubleConversion.cmake deleted file mode 100644 index cdfc87fc3..000000000 --- a/cmake/FindDoubleConversion.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find libdouble-conversion includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(DoubleConversion) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# DoubleConversion_FOUND System has double-conversion, include and lib dirs found -# DoubleConversion_INCLUDE_DIR The double-conversion includes directories. -# DoubleConversion_LIBRARY The double-conversion library. - -find_path(DoubleConversion_INCLUDE_DIR NAMES double-conversion/double-conversion.h) -find_library(DoubleConversion_LIBRARY NAMES libdouble-conversion.a) - -if(DoubleConversion_INCLUDE_DIR AND DoubleConversion_LIBRARY) - set(DoubleConversion_FOUND TRUE) - mark_as_advanced( - DoubleConversion_INCLUDE_DIR - DoubleConversion_LIBRARY - ) -endif() - -if(NOT DoubleConversion_FOUND) - message(FATAL_ERROR "Double-conversion doesn't exist") -endif() - diff --git a/cmake/FindFatal.cmake b/cmake/FindFatal.cmake deleted file mode 100644 index 5b4e28709..000000000 --- a/cmake/FindFatal.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# - Try to find Fatal includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Fatal) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Fatal_FOUND System has readline, include and lib dirs found -# Fatal_INCLUDE_DIR The readline includes directories. - -find_path(Fatal_INCLUDE_DIR NAMES fatal) - -if(Fatal_INCLUDE_DIR) - set(Fatal_FOUND TRUE) - mark_as_advanced( - Fatal_INCLUDE_DIR - ) -endif() - -if(NOT Fatal_FOUND) - message(FATAL_ERROR "Fatal doesn't exist") -endif() - diff --git a/cmake/FindFbthrift.cmake b/cmake/FindFbthrift.cmake deleted file mode 100644 index 496b8a350..000000000 --- a/cmake/FindFbthrift.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# - Try to find Fbthrift includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Fbthrift) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Fbthrift_FOUND System has fbthrift, thrift1 and include and lib dirs found. -# Fbthrift_INCLUDE_DIR The fbthrift includes directories. -# Fbthrift_LIBRARY The fbthrift library. -# Fbthrift_BIN The fbthrift binary. - -find_path(Fbthrift_INCLUDE_DIR NAMES thrift) -find_library(Fbthrift_LIBRARY NAMES libthrift.a) -find_program(Fbthrift_BIN NAMES thrift1) - -if(Fbthrift_INCLUDE_DIR AND Fbthrift_LIBRARY AND Fbthrift_BIN) - set(Fbthrift_FOUND TRUE) - mark_as_advanced( - Fbthrift_INCLUDE_DIR - Fbthrift_LIBRARY - Fbthrift_BIN - ) -endif() - -if(NOT Fbthrift_FOUND) - message(FATAL_ERROR "Fbthrift doesn't exist") -endif() - diff --git a/cmake/FindFolly.cmake b/cmake/FindFolly.cmake deleted file mode 100644 index ba4e052ba..000000000 --- a/cmake/FindFolly.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Folly includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Folly) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Folly_FOUND System has folly, include and lib dirs found -# Folly_INCLUDE_DIR The folly includes directories. -# Folly_LIBRARY The folly library. - -find_path(Folly_INCLUDE_DIR NAMES folly) -find_library(Folly_LIBRARY NAMES libfolly.a libfollybenchmark.a) - -if(Folly_INCLUDE_DIR AND Folly_LIBRARY) - set(Folly_FOUND TRUE) - mark_as_advanced( - Folly_INCLUDE_DIR - Folly_LIBRARY - ) -endif() - -if(NOT Folly_FOUND) - message(FATAL_ERROR "Folly doesn't exist") -endif() - diff --git a/cmake/FindGPERF.cmake b/cmake/FindGPERF.cmake deleted file mode 100644 index e2e99cbf4..000000000 --- a/cmake/FindGPERF.cmake +++ /dev/null @@ -1,61 +0,0 @@ -# FindGPERF -# --------- -# -# Find ``gperf`` executable -# -# The module defines the following variables: -# -# ``GPERF_EXECUTABLE_DIR`` -# path to search the gperf binary -# -# ``GPERF_EXECUTABLE`` -# path to the ``gperf`` program -# -# ``GPERF_BIN_DIR`` -# path to the directory that holds ``gperf`` program -# -# ``GPERF_VERSION`` -# version of ``gperf`` -# -# ``GPERF_FOUND`` -# true if the program was found -# -# The minimum required version of ``gperf`` can be specified using the -# standard CMake syntax, e.g. ``find_package(GPERF 3.0)``. - -find_program(GPERF_EXECUTABLE - NAMES gperf - PATHS ${GPERF_EXECUTABLE_DIR} - DOC "path to the gperf executable") - -if(GPERF_EXECUTABLE) - # Extract the path - STRING(REGEX REPLACE "/gperf$" "" GPERF_BIN_DIR ${GPERF_EXECUTABLE}) - - # the gperf commands should be executed with the C locale, otherwise - # the message (which is parsed) may be translated - set(_gperf_SAVED_LC_ALL "$ENV{LC_ALL}") - set(ENV{LC_ALL} C) - - execute_process(COMMAND ${GPERF_EXECUTABLE} --version - OUTPUT_VARIABLE GPERF_version_output - ERROR_VARIABLE GPERF_version_error - RESULT_VARIABLE GPERF_version_result - OUTPUT_STRIP_TRAILING_WHITESPACE) - - set(ENV{LC_ALL} ${_gperf_SAVED_LC_ALL}) - - if(NOT ${GPERF_version_result} EQUAL 0) - message(SEND_ERROR "Command \"${GPERF_EXECUTABLE} --version\" failed with output:\n${GPERF_version_error}") - else() - if("${GPERF_version_output}" MATCHES "^GNU gperf ([^\n]+)") - set(GPERF_VERSION "${CMAKE_MATCH_1}") - endif() - endif() - -endif() -mark_as_advanced(GPERF_EXECUTABLE GPERF_BIN_DIR) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPERF REQUIRED_VARS GPERF_EXECUTABLE - VERSION_VAR GPERF_VERSION) diff --git a/cmake/FindGflags.cmake b/cmake/FindGflags.cmake deleted file mode 100644 index 144e1c097..000000000 --- a/cmake/FindGflags.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Gflags includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Gflags) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Gflags_FOUND System has Gflags, include and lib dirs found -# Gflags_INCLUDE_DIR The Gflags includes directories. -# Gflags_LIBRARY The Gflags library. - -find_path(Gflags_INCLUDE_DIR NAMES gflags) -find_library(Gflags_LIBRARY NAMES libgflags.a) - -if(Gflags_INCLUDE_DIR AND Gflags_LIBRARY) - set(Gflags_FOUND TRUE) - mark_as_advanced( - Gflags_INCLUDE_DIR - Gflags_LIBRARY - ) -endif() - -if(NOT Gflags_FOUND) - message(FATAL_ERROR "Gflags doesn't exist") -endif() - diff --git a/cmake/FindGlog.cmake b/cmake/FindGlog.cmake deleted file mode 100644 index 539418329..000000000 --- a/cmake/FindGlog.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Glog includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Glog) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Glog_FOUND System has Glog, include and lib dirs found -# Glog_INCLUDE_DIR The Glog includes directories. -# Glog_LIBRARY The Glog library. - -find_path(Glog_INCLUDE_DIR NAMES glog) -find_library(Glog_LIBRARY NAMES libglog.a) - -if(Glog_INCLUDE_DIR AND Glog_LIBRARY) - set(Glog_FOUND TRUE) - mark_as_advanced( - Glog_INCLUDE_DIR - Glog_LIBRARY - ) -endif() - -if(NOT Glog_FOUND) - message(FATAL_ERROR "Glog doesn't exist") -endif() - diff --git a/cmake/FindGoogletest.cmake b/cmake/FindGoogletest.cmake deleted file mode 100644 index cb22c8d31..000000000 --- a/cmake/FindGoogletest.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Googletest includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Googletest) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Googletest_FOUND System has Googletest, include and lib dirs found -# Googletest_INCLUDE_DIR The Googletest includes directories. -# Googletest_LIBRARY The Googletest library. - -find_path(Googletest_INCLUDE_DIR NAMES gmock gtest) -find_library(Googletest_LIBRARY NAMES libgmock.a libgmock_main.a libgtest.a libgtest_main.a) - -if(Googletest_INCLUDE_DIR AND Googletest_LIBRARY) - set(Googletest_FOUND TRUE) - mark_as_advanced( - Googletest_INCLUDE_DIR - Googletest_LIBRARY - ) -endif() - -if(NOT Googletest_FOUND) - message(FATAL_ERROR "Googletest doesn't exist") -endif() - diff --git a/cmake/FindJemalloc.cmake b/cmake/FindJemalloc.cmake deleted file mode 100644 index e85a842fa..000000000 --- a/cmake/FindJemalloc.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# - Try to find Jemalloc includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Jemalloc) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Jemalloc_FOUND System has Jemalloc, include and lib dirs found -# Jemalloc_INCLUDE_DIR The Jemalloc includes directories. -# Jemalloc_LIBRARY The Jemalloc library. - -find_path(Jemalloc_INCLUDE_DIR NAMES jemalloc) -find_library(Jemalloc_LIBRARY NAMES libjemalloc.a) - -if(Jemalloc_INCLUDE_DIR AND Jemalloc_LIBRARY) - set(Jemalloc_FOUND TRUE) - mark_as_advanced( - Jemalloc_INCLUDE_DIR - Jemalloc_LIBRARY - ) -endif() - -if(NOT Jemalloc_FOUND) - message(FATAL_ERROR "Jemalloc doesn't exist") -endif() diff --git a/cmake/FindKrb5.cmake b/cmake/FindKrb5.cmake deleted file mode 100644 index 0c064097a..000000000 --- a/cmake/FindKrb5.cmake +++ /dev/null @@ -1,169 +0,0 @@ -# Original source: -# https://raw.githubusercontent.com/nfs-ganesha/nfs-ganesha/master/src/cmake/modules/FindKrb5.cmake -# -# - Find kerberos 5 -# Find the native Kerberos 5 headers and libraries. -# KRB5_INCLUDE_DIRS - where to find krb5.h, etc. -# KRB5_LIBRARY_DIRS - where to find krb5 libraries. -# KRB5_LIBRARIES - List of libraries when using kerberos 5. -# KRB5_CFLAGS - Required cflags for KRB5, such as -I -# KRB5_LINKFLAGS - Required link flags for KRB5 -# KRB5_FOUND - True if kerberos 5 found. -# KRB5 modules may be specified as components for this find module. -# Modules may be listed by running "krb5-config". Modules include: -# krb5 Kerberos 5 application -# gssapi GSSAPI application with Kerberos 5 bindings -# krb4 Kerberos 4 application -# kadm-client Kadmin client -# kadm-server Kadmin server -# kdb Application that accesses the kerberos database -# Typical usage: -# FIND_PACKAGE(KRB5 REQUIRED gssapi) - -# First find the config script from which to obtain other values. -IF(KRB5_PREFIX) - FIND_PROGRAM(KRB5_C_CONFIG NAMES krb5-config - PATHS ${KRB5_PREFIX}/bin - NO_SYSTEM_ENVIRONMENT_PATH - NO_DEFAULT_PATH - ) -ENDIF(KRB5_PREFIX) -FIND_PROGRAM(KRB5_C_CONFIG NAMES krb5-config) - -MESSAGE(STATUS "found krb5-config here ${KRB5_C_CONFIG}") - -# Check whether we found anything. -IF(KRB5_C_CONFIG) - SET(KRB5_FOUND 1) -ELSE(KRB5_C_CONFIG) - SET(KRB5_FOUND 0) -ENDIF(KRB5_C_CONFIG) - -# Lookup the include directories needed for the components requested. -IF(KRB5_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - IF(COMMAND EXECUTE_PROCESS) - EXECUTE_PROCESS( - COMMAND ${KRB5_C_CONFIG} ${KRB5_FIND_COMPONENTS} --cflags - OUTPUT_VARIABLE KRB5_C_CONFIG_CFLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE KRB5_C_CONFIG_RESULT - ) - ELSE(COMMAND EXECUTE_PROCESS) - EXEC_PROGRAM(${KRB5_C_CONFIG} ARGS "${KRB5_FIND_COMPONENTS} --cflags" - OUTPUT_VARIABLE KRB5_C_CONFIG_CFLAGS - RETURN_VALUE KRB5_C_CONFIG_RESULT - ) - ENDIF(COMMAND EXECUTE_PROCESS) - - # Parse the include flags. - IF("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") - SET(KRB5_CFLAGS ${KRB5_C_CONFIG_CFLAGS}) - - # Convert the compile flags to a CMake list. - STRING(REGEX REPLACE " +" ";" - KRB5_C_CONFIG_CFLAGS "${KRB5_C_CONFIG_CFLAGS}") - - # Look for -I options. - SET(KRB5_INCLUDE_DIRS) - FOREACH(flag ${KRB5_C_CONFIG_CFLAGS}) - IF("${flag}" MATCHES "^-I") - STRING(REGEX REPLACE "^-I" "" DIR "${flag}") - FILE(TO_CMAKE_PATH "${DIR}" DIR) - SET(KRB5_INCLUDE_DIRS ${KRB5_INCLUDE_DIRS} "${DIR}") - ENDIF("${flag}" MATCHES "^-I") - ENDFOREACH(flag) - ELSE("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") - MESSAGE("Error running ${KRB5_C_CONFIG}: [${KRB5_C_CONFIG_RESULT}]") - SET(KRB5_FOUND 0) - ENDIF("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") -ENDIF(KRB5_FOUND) - -IF(KRB5_PREFIX) - SET(KRB5_INCLUDE_DIRS "${KRB5_PREFIX}/include" ${KRB5_INCLUDE_DIRS}) -ENDIF(KRB5_PREFIX) - -# Lookup the libraries needed for the components requested. -IF(KRB5_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - IF(COMMAND EXECUTE_PROCESS) - EXECUTE_PROCESS( - COMMAND ${KRB5_C_CONFIG} ${KRB5_FIND_COMPONENTS} --libs gssapi - OUTPUT_VARIABLE KRB5_C_CONFIG_LIBS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE KRB5_C_CONFIG_RESULT - ) - ELSE(COMMAND EXECUTE_PROCESS) - EXEC_PROGRAM(${KRB5_C_CONFIG} ARGS "${KRB5_FIND_COMPONENTS} --libs gssapi" - OUTPUT_VARIABLE KRB5_C_CONFIG_LIBS - RETURN_VALUE KRB5_C_CONFIG_RESULT - ) - ENDIF(COMMAND EXECUTE_PROCESS) - - # Parse the library names and directories. - IF("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") - SET(KRB5_LINKFLAGS ${KRB5_C_CONFIG_LIBS}) - - STRING(REGEX REPLACE " +" ";" - KRB5_C_CONFIG_LIBS "${KRB5_C_CONFIG_LIBS}") - - # Look for -L flags for directories and -l flags for library names. - SET(KRB5_LIBRARY_DIRS) - SET(KRB5_LIBRARY_NAMES) - FOREACH(flag ${KRB5_C_CONFIG_LIBS}) - IF("${flag}" MATCHES "^-L") - STRING(REGEX REPLACE "^-L" "" DIR "${flag}") - FILE(TO_CMAKE_PATH "${DIR}" DIR) - SET(KRB5_LIBRARY_DIRS ${KRB5_LIBRARY_DIRS} "${DIR}") - ELSEIF("${flag}" MATCHES "^-l") - STRING(REGEX REPLACE "^-l" "" NAME "${flag}") - SET(KRB5_LIBRARY_NAMES ${KRB5_LIBRARY_NAMES} "${NAME}") - ENDIF("${flag}" MATCHES "^-L") - ENDFOREACH(flag) - - # add gssapi_krb5 (MIT) - #SET(KRB5_LIBRARY_NAMES ${KRB5_LIBRARY_NAMES} "gssapi_krb5") - # Add krb5support - SET(KRB5_LIBRARY_NAMES ${KRB5_LIBRARY_NAMES} "krb5support") - STRING(CONCAT KRB5_LINKFLAGS ${KRB5_LINKFLAGS} " -lkrb5support") - - # Search for each library needed using the directories given. - FOREACH(name ${KRB5_LIBRARY_NAMES}) - # Look for this library. - FIND_LIBRARY(KRB5_${name}_LIBRARY - NAMES ${name} - PATHS ${KRB5_LIBRARY_DIRS} - NO_DEFAULT_PATH - ) - FIND_LIBRARY(KRB5_${name}_LIBRARY NAMES ${name}) - MARK_AS_ADVANCED(KRB5_${name}_LIBRARY) - - # If any library is not found then the whole package is not found. - IF(NOT KRB5_${name}_LIBRARY) - SET(KRB5_FOUND 0) - ENDIF(NOT KRB5_${name}_LIBRARY) - - # Build an ordered list of all the libraries needed. - SET(KRB5_LIBRARIES ${KRB5_LIBRARIES} "${KRB5_${name}_LIBRARY}") - ENDFOREACH(name) - ELSE("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") - MESSAGE("Error running ${KRB5_C_CONFIG}: [${KRB5_C_CONFIG_RESULT}]") - SET(KRB5_FOUND 0) - ENDIF("${KRB5_C_CONFIG_RESULT}" MATCHES "^0$") -ENDIF(KRB5_FOUND) - -# Report the results. -IF(NOT KRB5_FOUND) - SET(KRB5_DIR_MESSAGE - "KRB5 was not found. Make sure the entries KRB5_* are set.") - IF(NOT KRB5_FIND_QUIETLY) - MESSAGE(STATUS "${KRB5_DIR_MESSAGE}") - ELSE(NOT KRB5_FIND_QUIETLY) - IF(KRB5_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${KRB5_DIR_MESSAGE}") - ENDIF(KRB5_FIND_REQUIRED) - ENDIF(NOT KRB5_FIND_QUIETLY) -ELSE(NOT KRB5_FOUND) - MESSAGE(STATUS "Found kerberos 5 headers: ${KRB5_INCLUDE_DIRS}") - MESSAGE(STATUS "Found kerberos 5 libs: ${KRB5_LIBRARIES}") -ENDIF(NOT KRB5_FOUND) diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake deleted file mode 100644 index 746cad7c3..000000000 --- a/cmake/FindLZ4.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Finds liblz4. -# -# This module defines: -# LZ4_FOUND -# LZ4_INCLUDE_DIR -# LZ4_LIBRARY -# - -find_path(LZ4_INCLUDE_DIR NAMES lz4.h) - -find_library(LZ4_LIBRARY_DEBUG NAMES lz4d) -find_library(LZ4_LIBRARY_RELEASE NAMES lz4) - -include(SelectLibraryConfigurations) -SELECT_LIBRARY_CONFIGURATIONS(LZ4) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - LZ4 DEFAULT_MSG - LZ4_LIBRARY LZ4_INCLUDE_DIR -) - -if (LZ4_FOUND) - message(STATUS "Found LZ4: ${LZ4_LIBRARY}") -endif() - -mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY) diff --git a/cmake/FindLibevent.cmake b/cmake/FindLibevent.cmake deleted file mode 100644 index 4d314af9a..000000000 --- a/cmake/FindLibevent.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Libevent includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Libevent) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Libevent_FOUND System has Libevent, include and lib dirs found -# Libevent_INCLUDE_DIR The Libevent includes directories. -# Libevent_LIBRARY The Libevent library. - -find_path(Libevent_INCLUDE_DIR NAMES event.h) -find_library(Libevent_LIBRARY NAMES libevent.a) - -if(Libevent_INCLUDE_DIR AND Libevent_LIBRARY) - set(Libevent_FOUND TRUE) - mark_as_advanced( - Libevent_INCLUDE_DIR - Libevent_LIBRARY - ) -endif() - -if(NOT Libevent_FOUND) - message(FATAL_ERROR "Libevent doesn't exist") -endif() - diff --git a/cmake/FindLibunwind.cmake b/cmake/FindLibunwind.cmake deleted file mode 100644 index 3be74fa8a..000000000 --- a/cmake/FindLibunwind.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# FindLibunwind -# ------------- -# -# Find Libunwind -# -# Find LibUnwind library -# -# :: -# -# LIBUNWIND_LIBRARY_DIR - Can be provided to advise the search -# -# Libunwind_FOUND - True if libunwind is found. -# LIBUNWIND_LIBRARIES - libunwind libraries to link against. - -find_library(LIBUNWIND_LIBRARY NAMES unwind libunwind.so.8 PATHS ${LIBUNWIND_LIBRARY_DIR}) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libunwind REQUIRED_VARS LIBUNWIND_LIBRARY) - -if (Libunwind_FOUND) - set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY}) -endif () - -mark_as_advanced( LIBUNWIND_LIBRARY ) diff --git a/cmake/FindMstch.cmake b/cmake/FindMstch.cmake deleted file mode 100644 index 6ed969b92..000000000 --- a/cmake/FindMstch.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# - Try to find Mstch includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Mstch) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Mstch_FOUND System has Mstch, include and lib dirs found -# Mstch_INCLUDE_DIR The Mstch includes directories. -# Mstch_LIBRARY The Mstch library. - -find_path(Mstch_INCLUDE_DIR NAMES mstch) -find_library(Mstch_LIBRARY NAMES libmstch.a) -message(STATUS "Mstch_INCLUDE_DIR = ${Mstch_INCLUDE_DIR} , Mstch_LIBRARY = ${Mstch_LIBRARY}") - -if(Mstch_INCLUDE_DIR AND Mstch_LIBRARY) - set(Mstch_FOUND TRUE) - mark_as_advanced( - Mstch_INCLUDE_DIR - Mstch_LIBRARY - ) -endif() - -if(NOT Mstch_FOUND) - message(FATAL_ERROR "Mstch doesn't exist") -endif() - diff --git a/cmake/FindPCHSupport.cmake b/cmake/FindPCHSupport.cmake deleted file mode 100644 index 04a36b1d9..000000000 --- a/cmake/FindPCHSupport.cmake +++ /dev/null @@ -1,95 +0,0 @@ -# This code is based on -# http://rosegarden.svn.sourceforge.net/viewvc/rosegarden/trunk/rosegarden/cmake_admin/FindPCHSupport.cmake?revision=7699&view=markup -# -# - Try to find precompiled headers support for GCC 3.4 and 4.x -# Once done this will define: -# -# Variable: -# PCHSupport_FOUND -# -# Macro: -# ADD_PRECOMPILED_HEADER - -IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - EXEC_PROGRAM( - ${CMAKE_CXX_COMPILER} - ARGS --version - OUTPUT_VARIABLE _compiler_output) - STRING(REGEX REPLACE ".* ([0-9]\\.[0-9]\\.[0-9]) .*" "\\1" - gcc_compiler_version ${_compiler_output}) - IF(gcc_compiler_version MATCHES "[4-9]\\.[0-9]\\.[0-9]") - SET(PCHSupport_FOUND TRUE) - MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version}) - ELSE() - IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") - SET(PCHSupport_FOUND TRUE) - MESSAGE("-- Found PCH Support: gcc compiler version is " ${gcc_compiler_version}) - ENDIF() - ENDIF() -ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - SET(PCHSupport_FOUND TRUE) -ENDIF() - - - -MACRO(ADD_PRECOMPILED_HEADER _targetName _input) - - GET_FILENAME_COMPONENT(_name ${_input} NAME) - SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}") - SET(_output "${CMAKE_CURRENT_SOURCE_DIR}/${_name}.gch") - STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) - SET(_compiler_FLAGS ${${_flags_var_name}}) - GET_DIRECTORY_PROPERTY(_directory_compile_options COMPILE_OPTIONS) - LIST(APPEND _compiler_FLAGS ${_directory_compile_options}) - - GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES) - SET(_system_INCLUDE_DIRS "/usr/include" "/usr/local/include") - FOREACH(item ${_directory_flags}) - # Exclude standard paths - LIST(FIND _system_INCLUDE_DIRS ${item} _index) - IF(NOT ${_index} EQUAL -1) - continue() - ENDIF() - - IF(item MATCHES "^${PROJECT_SOURCE_DIR}.*") - # Directories in this project - IF(item MATCHES "^${PROJECT_SOURCE_DIR}/.*third-party.*") - # third-party - LIST(APPEND _compiler_FLAGS "-isystem ${item}") - ELSE() - # Our own directories - LIST(APPEND _compiler_FLAGS "-I ${item}") - ENDIF() - ELSE() - # All of others - LIST(APPEND _compiler_FLAGS "-isystem ${item}") - ENDIF() - ENDFOREACH(item) - - GET_DIRECTORY_PROPERTY(_directory_flags COMPILE_DEFINITIONS) - FOREACH(item ${_directory_flags}) - IF(NOT ${item} MATCHES "^GIT_INFO_SHA") - LIST(APPEND _compiler_FLAGS "-D${item}") - ENDIF() - ENDFOREACH(item) - - SEPARATE_ARGUMENTS(_compiler_FLAGS) - MESSAGE("Precompile header file " ${_source} " into " ${_output}) - IF(CMAKE_CXX_EXTENSIONS OR NOT DEFINED CMAKE_CXX_EXTENSIONS) - SET(_cxx_standard "gnu++${CMAKE_CXX_STANDARD}") - ELSE() - SET(_cxx_standard "c++${CMAKE_CXX_STANDARD}") - ENDIF() - ADD_CUSTOM_COMMAND( - OUTPUT ${_output} - COMMAND ${CMAKE_CXX_COMPILER} - ${_compiler_FLAGS} - -x c++-header - -std=${_cxx_standard} - -o ${_output} ${_source} - MAIN_DEPENDENCY ${_source} - DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt) - ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output}) - ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch) - -ENDMACRO(ADD_PRECOMPILED_HEADER) diff --git a/cmake/FindProxygen.cmake b/cmake/FindProxygen.cmake deleted file mode 100644 index 9caef4893..000000000 --- a/cmake/FindProxygen.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# - Try to find Proxygen includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Proxygen) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Proxygen_FOUND System has Proxygen, include and lib dirs found -# Proxygen_INCLUDE_DIR The Proxygen includes directories. -# Proxygen_LIBRARY The Proxygen library. - -find_path(Proxygen_INCLUDE_DIR NAMES proxygen) -find_library(Proxygen_LIBRARY NAMES libproxygenlib.a) - -if(Proxygen_INCLUDE_DIR AND Proxygen_LIBRARY) - set(Proxygen_FOUND TRUE) - mark_as_advanced( - Proxygen_INCLUDE_DIR - Proxygen_LIBRARY - ) -endif(Proxygen_INCLUDE_DIR AND Proxygen_LIBRARY) - -if(NOT Proxygen_FOUND) - message(FATAL_ERROR "Proxygen doesn't exist") -endif() - - diff --git a/cmake/FindRocksdb.cmake b/cmake/FindRocksdb.cmake deleted file mode 100644 index 7160e18bf..000000000 --- a/cmake/FindRocksdb.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Rocksdb includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Rocksdb) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Rocksdb_FOUND System has Rocksdb, include and lib dirs found -# Rocksdb_INCLUDE_DIR The Rocksdb includes directories. -# Rocksdb_LIBRARY The Rocksdb library. - -find_path(Rocksdb_INCLUDE_DIR NAMES rocksdb) -find_library(Rocksdb_LIBRARY NAMES librocksdb.a) - -if(Rocksdb_INCLUDE_DIR AND Rocksdb_LIBRARY) - set(Rocksdb_FOUND TRUE) - mark_as_advanced( - Rocksdb_INCLUDE_DIR - Rocksdb_LIBRARY - ) -endif() - -if(NOT Rocksdb_FOUND) - message(FATAL_ERROR "Rocksdb doesn't exist") -endif() - diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake deleted file mode 100644 index bb7b5d199..000000000 --- a/cmake/FindSnappy.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Snappy includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Snappy) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Snappy_FOUND System has Snappy, include and lib dirs found -# Snappy_INCLUDE_DIR The Snappy includes directories. -# Snappy_LIBRARY The Snappy library. - -find_path(Snappy_INCLUDE_DIR NAMES snappy.h) -find_library(Snappy_LIBRARY NAMES libsnappy.a) - -if(Snappy_INCLUDE_DIR AND Snappy_LIBRARY) - set(Snappy_FOUND TRUE) - mark_as_advanced( - Snappy_INCLUDE_DIR - Snappy_LIBRARY - ) -endif() - -if(NOT Snappy_FOUND) - message(FATAL_ERROR "Snappy doesn't exist") -endif() - diff --git a/cmake/FindWangle.cmake b/cmake/FindWangle.cmake deleted file mode 100644 index d3e55e04a..000000000 --- a/cmake/FindWangle.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Wangle includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Wangle) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Wangle_FOUND System has Wangle, include and lib dirs found -# Wangle_INCLUDE_DIR The Wangle includes directories. -# Wangle_LIBRARY The Wangle library. - -find_path(Wangle_INCLUDE_DIR NAMES wangle) -find_library(Wangle_LIBRARY NAMES libwangle.a) - -if(Wangle_INCLUDE_DIR AND Wangle_LIBRARY) - set(Wangle_FOUND TRUE) - mark_as_advanced( - Wangle_INCLUDE_DIR - Wangle_LIBRARY - ) -endif() - -if(NOT Wangle_FOUND) - message(FATAL_ERROR "Wangle doesn't exist") -endif() - diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake deleted file mode 100644 index 1c49a8717..000000000 --- a/cmake/FindZstd.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - Try to find Zstd includes dirs and libraries -# -# Usage of this module as follows: -# -# find_package(Zstd) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# Variables defined by this module: -# -# Zstd_FOUND System has Zstd, include and lib dirs found -# Zstd_INCLUDE_DIR The Zstd includes directories. -# Zstd_LIBRARY The Zstd library. -# Zstd_BIN The Zstd binary. - -find_path(Zstd_INCLUDE_DIR NAMES zstd.h) -find_library(Zstd_LIBRARY NAMES libzstd.a) -find_program(Zstd_BIN NAMES zstd) - -if(Zstd_INCLUDE_DIR AND Zstd_LIBRARY AND Zstd_BIN) - set(Zstd_FOUND TRUE) - mark_as_advanced( - Zstd_INCLUDE_DIR - Zstd_LIBRARY - Zstd_BIN - ) -endif() - -if(NOT Zstd_FOUND) - message(FATAL_ERROR "Zstd doesn't exist") -endif() - - diff --git a/cmake/LinkerConfig.cmake b/cmake/LinkerConfig.cmake deleted file mode 100644 index f0a51d0bb..000000000 --- a/cmake/LinkerConfig.cmake +++ /dev/null @@ -1,22 +0,0 @@ -execute_process( - COMMAND - ld --version - COMMAND - head -1 - COMMAND - cut -d " " -f2 - OUTPUT_VARIABLE default_linker_type - OUTPUT_STRIP_TRAILING_WHITESPACE -) - -if ("${default_linker_type}" STREQUAL "ld") - set(default_linker_type "bfd") -endif() - -if (NOT DEFINED NEBULA_USE_LINKER) - set(NEBULA_USE_LINKER ${default_linker_type}) -endif() - -message(STATUS "NEBULA_USE_LINKER: ${NEBULA_USE_LINKER}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=${NEBULA_USE_LINKER}") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=${NEBULA_USE_LINKER}") diff --git a/src/codec/RowReaderV2.cpp b/src/codec/RowReaderV2.cpp index 043aec708..2e9423596 100644 --- a/src/codec/RowReaderV2.cpp +++ b/src/codec/RowReaderV2.cpp @@ -136,7 +136,7 @@ Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept { memcpy(reinterpret_cast(&dt.day), &data_[offset + sizeof(int16_t) + sizeof(int8_t)], sizeof(int8_t)); - return std::move(dt); + return dt; } case meta::cpp2::PropertyType::DATETIME: { DateTime dt; @@ -162,7 +162,7 @@ Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept { memcpy(reinterpret_cast(&dt.timezone), &data_[offset + sizeof(int16_t) + 5 * sizeof(int8_t) + sizeof(int32_t)], sizeof(int32_t)); - return std::move(dt); + return dt; } default: LOG(FATAL) << "Should not reach here"; diff --git a/src/codec/RowWriterV2.cpp b/src/codec/RowWriterV2.cpp index b52dc18db..bc3fab369 100644 --- a/src/codec/RowWriterV2.cpp +++ b/src/codec/RowWriterV2.cpp @@ -124,8 +124,10 @@ RowWriterV2::RowWriterV2(RowReader& reader) break; case Value::Type::DATE: set(i, v.moveDate()); + break; case Value::Type::DATETIME: set(i, v.moveDateTime()); + break; default: LOG(FATAL) << "Invalid data"; } @@ -256,10 +258,10 @@ WriteResult RowWriterV2::write(ssize_t index, bool v) noexcept { buf_[offset + 7] = 0; buf_[offset + 6] = 0; buf_[offset + 5] = 0; - buf_[offset + 4] = 0; + buf_[offset + 4] = 0; // fallthrough case meta::cpp2::PropertyType::INT32: buf_[offset + 3] = 0; - buf_[offset + 2] = 0; + buf_[offset + 2] = 0; // fallthrough case meta::cpp2::PropertyType::INT16: buf_[offset + 1] = 0; buf_[offset + 0] = v ? 0x01 : 0; diff --git a/src/codec/test/RowReaderV2Test.cpp b/src/codec/test/RowReaderV2Test.cpp index 1aa52a70e..99a2e05fc 100644 --- a/src/codec/test/RowReaderV2Test.cpp +++ b/src/codec/test/RowReaderV2Test.cpp @@ -110,11 +110,11 @@ TEST(RowReaderV2, encodedData) { encoded.append(3, 0); // Col 3 - encoded.append(8, 0xFF); + encoded.append(8, static_cast(0xFF)); // Col 4 encoded.append(1, 0x11).append(1, 0x22).append(1, 0x33).append(1, 0x44) - .append(1, 0x55).append(1, 0x66).append(1, 0x77).append(1, 0x88); + .append(1, 0x55).append(1, 0x66).append(1, 0x77).append(1, static_cast(0x88)); // Col 5 int32_t offset = 1 + schema.size(); // Header and data (no NULL flag) diff --git a/src/codec/test/RowWriterV2Test.cpp b/src/codec/test/RowWriterV2Test.cpp index d0e1bd1c4..5588c06dd 100644 --- a/src/codec/test/RowWriterV2Test.cpp +++ b/src/codec/test/RowWriterV2Test.cpp @@ -20,7 +20,7 @@ const std::string str = "Hello world!"; // NOLINT const std::string fixed = "Nebula Graph"; // NOLINT const Timestamp now = 1582183355; const Date date = {2020, 2, 20}; -const DateTime dt = {2020, 2, 20, 10, 30, 45, -8 * 3600}; +const DateTime dt = {2020, 2, 20, 10, 30, 45, -8 * 3600, 0}; const Value sVal("Hello world!"); const Value iVal(64); diff --git a/src/mock/MockData.cpp b/src/mock/MockData.cpp index 3ff3716b6..f3afe6165 100644 --- a/src/mock/MockData.cpp +++ b/src/mock/MockData.cpp @@ -105,8 +105,7 @@ std::vector MockData::players_ = { {"Amare Stoudemire", 37, false, 14, 2002, 2016, 846, 18.9, 4 } }; -// Player name, team name, start year, end year, team career(years), games, average scores -// player source type(default value "trade"), champions in team(nullable) + std::vector MockData::serves_ = { {"Tim Duncan", "Spurs", 1997, 2016, 19, 1392, 19.0, "zzzzz", 5}, {"Tony Parker", "Spurs", 2001, 2018, 17, 1198, 16.6, "trade", 4}, @@ -277,6 +276,7 @@ std::vector MockData::serves_ = { {"Luka Doncic", "Mavericks", 2018, 2020, 2, 126, 24.4 }, }; + std::vector MockData::teammates_ = { {"Tim Duncan", "Tony Parker", "Spurs", 2001, 2016}, {"Tim Duncan", "Manu Ginobili", "Spurs", 2002, 2016}, diff --git a/src/mock/MockData.h b/src/mock/MockData.h index c532a3879..aeabe62a9 100644 --- a/src/mock/MockData.h +++ b/src/mock/MockData.h @@ -54,7 +54,7 @@ struct Serve { int teamCareer_; int teamGames_; double teamAvgScore_; - std::string type_; + std::string type_{""}; int champions_{0}; }; diff --git a/src/storage/test/IndexWriteTest.cpp b/src/storage/test/IndexWriteTest.cpp index 97da477ec..9babd0c34 100644 --- a/src/storage/test/IndexWriteTest.cpp +++ b/src/storage/test/IndexWriteTest.cpp @@ -63,7 +63,7 @@ TEST(IndexTest, SimpleVerticesTest) { nebula::storage::cpp2::NewTag newTag; newTag.set_tag_id(3); const Date date = {2020, 2, 20}; - const DateTime dt = {2020, 2, 20, 10, 30, 45, -8 * 3600}; + const DateTime dt = {2020, 2, 20, 10, 30, 45, 0, -8 * 3600}; std::vector props; props.emplace_back(Value(true)); props.emplace_back(Value(1L)); @@ -352,10 +352,10 @@ TEST(IndexTest, VerticesValueTest) { } /** - * Alter tag test. + * Alter tag test. * If a tag is attached to an index. allows to add new columns. * Test the old index work well. - * And then create new index with newly added columns. + * And then create new index with newly added columns. * Test the all indexes works well. **/ TEST(IndexTest, AlterTagIndexTest) { @@ -447,7 +447,7 @@ TEST(IndexTest, AlterTagIndexTest) { nebula::storage::cpp2::NewTag newTag; newTag.set_tag_id(tagId); const Date date = {2020, 2, 20}; - const DateTime dt = {2020, 2, 20, 10, 30, 45, -8 * 3600}; + const DateTime dt = {2020, 2, 20, 10, 30, 45, 0, -8 * 3600}; std::vector props; props.emplace_back(Value(true)); props.emplace_back(Value(1L));