mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge branch 'master' of github.com:yandex/ClickHouse
This commit is contained in:
commit
d1141ff03b
1
.gitignore
vendored
1
.gitignore
vendored
@ -187,6 +187,7 @@ debian/files
|
||||
dbms/src/Server/data/*
|
||||
dbms/src/Server/metadata/*
|
||||
dbms/src/Server/status
|
||||
dbms/src/Interpreters/CompilerIncludes.h
|
||||
config-9001.xml
|
||||
|
||||
*-preprocessed.xml
|
||||
|
@ -79,6 +79,13 @@ if (USE_STATIC_LIBRARIES)
|
||||
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif ()
|
||||
|
||||
# Don't skip the full RPATH for the build tree to get working binaries
|
||||
# without running `make install`.
|
||||
set (CMAKE_SKIP_BUILD_RPATH OFF)
|
||||
|
||||
# The RPATH to be used when installing
|
||||
set (CMAKE_INSTALL_RPATH "")
|
||||
|
||||
if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "amd64.*|x86_64.*|AMD64.*")
|
||||
option (USE_INTERNAL_MEMCPY "Use internal implementation of 'memcpy' function instead of provided by libc. Only for x86_64." ON)
|
||||
|
||||
|
19
cmake/find_gtest.cmake
Normal file
19
cmake/find_gtest.cmake
Normal file
@ -0,0 +1,19 @@
|
||||
option (USE_INTERNAL_GTEST_LIBRARY "Set to FALSE to use system Google Test instead of bundled" ${NOT_UNBUNDLED})
|
||||
|
||||
if (USE_INTERNAL_GTEST_LIBRARY AND NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/googletest/googletets/CMakeLists.txt")
|
||||
message (WARNING "submodule contrib/googletest is missing. to fix try run: \n git submodule update --init --recursive")
|
||||
set (USE_INTERNAL_GTEST_LIBRARY 0)
|
||||
endif ()
|
||||
|
||||
if (NOT USE_INTERNAL_GTEST_LIBRARY)
|
||||
find_library (GTEST_LIBRARY gtest_main)
|
||||
find_path (GTEST_INCLUDE_DIR NAMES /gtest/gtest.h PATHS ${GTEST_INCLUDE_PATHS})
|
||||
endif ()
|
||||
|
||||
if (GTEST_LIBRARY AND GTEST_INCLUDE_DIR)
|
||||
else ()
|
||||
set (USE_INTERNAL_GTEST_LIBRARY 1)
|
||||
set (GTEST_LIBRARY gtest_main)
|
||||
endif ()
|
||||
|
||||
message (STATUS "Using gtest: ${GTEST_INCLUDE_DIR} : ${GTEST_LIBRARY}")
|
@ -88,6 +88,9 @@ list (APPEND dbms_headers
|
||||
list (APPEND dbms_sources src/TableFunctions/TableFunctionFactory.cpp)
|
||||
list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h)
|
||||
|
||||
if (USE_EMBEDDED_COMPILER)
|
||||
list (APPEND dbms_headers ${CMAKE_CURRENT_SOURCE_DIR}/src/Interpreters/CompilerIncludes.h)
|
||||
endif ()
|
||||
|
||||
list(REMOVE_ITEM clickhouse_common_io_sources
|
||||
src/Common/StringUtils.cpp)
|
||||
|
16
dbms/scripts/gen-compiler-includes.sh
Executable file
16
dbms/scripts/gen-compiler-includes.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Generates the list of -isystem includes from gcc or clang compiler
|
||||
# Usage: ./gen-includes.sh [COMPILER]
|
||||
#
|
||||
|
||||
# Set locale to C to capture GCC's "search starts here" text in English
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
export LC_MESSAGES=C
|
||||
CC=$1 || cc
|
||||
if test -z "$CC"; then CC=cc; fi
|
||||
|
||||
echo "" | $CC -x c++ -E -Wp,-v - 2>&1|
|
||||
sed -n '/#include <...> search starts here:/,/End of search list./p' |
|
||||
sed -e '1d;$d' -e 's/^[ \t ]*/" -isystem /;s/$/"/'
|
@ -5,12 +5,21 @@ else ()
|
||||
set (PATH_SHARE "/usr/share" CACHE STRING "")
|
||||
endif ()
|
||||
|
||||
if (USE_EMBEDDED_COMPILER)
|
||||
# Generate CompilerIncludes.h which contains all
|
||||
# `-isystem` includes for bundled clickhouse-clang
|
||||
add_custom_command(OUTPUT CompilerIncludes.h
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/dbms/scripts/gen-compiler-includes.sh
|
||||
${PROJECT_BINARY_DIR}/dbms/src/Server/clickhouse-clang
|
||||
> ${CMAKE_CURRENT_BINARY_DIR}/CompilerIncludes.h
|
||||
DEPENDS clickhouse-clang)
|
||||
endif ()
|
||||
|
||||
set (INTERNAL_COMPILER_EXECUTABLE "clickhouse-clang" CACHE STRING "")
|
||||
set (INTERNAL_LINKER_EXECUTABLE "clickhouse-lld" CACHE STRING "")
|
||||
set (INTERNAL_COMPILER_NO_WARNING OFF CACHE INTERNAL "")
|
||||
set (INTERNAL_COMPILER_HEADERS "${PATH_SHARE}/clickhouse/headers" CACHE STRING "")
|
||||
set (INTERNAL_COMPILER_HEADERS_ROOT "${INTERNAL_COMPILER_HEADERS}" CACHE STRING "")
|
||||
set (INTERNAL_COMPILER_CUSTOM_ROOT ON CACHE INTERNAL "")
|
||||
|
||||
set (INTERNAL_COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_INTERNAL_COMPILER} -x c++ -march=native -fPIC -fvisibility=hidden -fno-implement-inlines -nostdinc -nostdinc++ -Wno-unused-command-line-argument -Bprefix=${PATH_SHARE}/clickhouse -isysroot=${INTERNAL_COMPILER_HEADERS_ROOT}" CACHE STRING "")
|
||||
string(REPLACE "-no-pie" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS})
|
||||
|
@ -222,23 +222,10 @@ void Compiler::compile(
|
||||
INTERNAL_COMPILER_EXECUTABLE
|
||||
" " INTERNAL_COMPILER_FLAGS
|
||||
|
||||
|
||||
#if INTERNAL_COMPILER_CUSTOM_ROOT
|
||||
/// To get correct order merge this results carefully:
|
||||
/// echo | clang -x c++ -E -Wp,-v -
|
||||
/// echo | g++ -x c++ -E -Wp,-v -
|
||||
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include/c++/*"
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include/" CMAKE_LIBRARY_ARCHITECTURE "/c++/*"
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include/c++/*/backward"
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include/clang/*/include" /// if compiler is clang (from package)
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/local/lib/clang/*/include" /// if clang installed manually
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/lib/gcc/" CMAKE_LIBRARY_ARCHITECTURE "/*/include-fixed"
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/lib/gcc/" CMAKE_LIBRARY_ARCHITECTURE "/*/include"
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/local/include" /// if something installed manually
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include/" CMAKE_LIBRARY_ARCHITECTURE
|
||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/include"
|
||||
#endif
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
/// Contains `echo "" | clickhouse-clang -x c++ -E -Wp,-v -`
|
||||
#include "CompilerIncludes.h"
|
||||
#endif /* USE_EMBEDDED_COMPILER */
|
||||
" -I " INTERNAL_COMPILER_HEADERS "/dbms/src/"
|
||||
" -I " INTERNAL_COMPILER_HEADERS "/contrib/libcityhash/include/"
|
||||
" -I " INTERNAL_COMPILER_HEADERS "/contrib/libpcg-random/include/"
|
||||
|
@ -1,16 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#cmakedefine CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#if !defined(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
#define CMAKE_LIBRARY_ARCHITECTURE ""
|
||||
#endif
|
||||
#cmakedefine PATH_SHARE "@PATH_SHARE@"
|
||||
#cmakedefine INTERNAL_COMPILER_FLAGS "@INTERNAL_COMPILER_FLAGS@"
|
||||
#cmakedefine INTERNAL_COMPILER_EXECUTABLE "@INTERNAL_COMPILER_EXECUTABLE@"
|
||||
#cmakedefine INTERNAL_LINKER_EXECUTABLE "@INTERNAL_LINKER_EXECUTABLE@"
|
||||
#cmakedefine INTERNAL_COMPILER_HEADERS "@INTERNAL_COMPILER_HEADERS@"
|
||||
#cmakedefine INTERNAL_COMPILER_HEADERS_ROOT "@INTERNAL_COMPILER_HEADERS_ROOT@"
|
||||
#cmakedefine01 INTERNAL_COMPILER_CUSTOM_ROOT
|
||||
#cmakedefine01 USE_EMBEDDED_COMPILER
|
||||
#cmakedefine INTERNAL_DOUBLE_CONVERSION_INCLUDE_DIR "@INTERNAL_DOUBLE_CONVERSION_INCLUDE_DIR@"
|
||||
#cmakedefine INTERNAL_Poco_Foundation_INCLUDE_DIR "@INTERNAL_Poco_Foundation_INCLUDE_DIR@"
|
||||
#cmakedefine INTERNAL_Poco_Util_INCLUDE_DIR "@INTERNAL_Poco_Util_INCLUDE_DIR@"
|
||||
|
@ -46,6 +46,10 @@ target_link_libraries (clickhouse-format-lib clickhouse_common_io ${Boost_PROGRA
|
||||
if (USE_EMBEDDED_COMPILER)
|
||||
link_directories (${LLVM_LIBRARY_DIRS})
|
||||
add_subdirectory ("Compiler-${LLVM_VERSION}")
|
||||
# Link clickhouse-clang binary even if CLICKHOUSE_SPLIT_BINARY is OFF
|
||||
# in order to get system include paths for Interpreters/Compiler.cpp
|
||||
add_executable (clickhouse-clang clickhouse-clang.cpp)
|
||||
target_link_libraries (clickhouse-clang clickhouse-compiler-lib)
|
||||
endif ()
|
||||
|
||||
if (CLICKHOUSE_SPLIT_BINARY)
|
||||
@ -70,8 +74,7 @@ if (CLICKHOUSE_SPLIT_BINARY)
|
||||
set (CLICKHOUSE_ALL_TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-extract-from-config clickhouse-format)
|
||||
|
||||
if (USE_EMBEDDED_COMPILER)
|
||||
add_executable (clickhouse-clang clickhouse-clang.cpp)
|
||||
target_link_libraries (clickhouse-clang clickhouse-compiler-lib)
|
||||
# clickhouse-clang is linked above
|
||||
add_executable (clickhouse-lld clickhouse-lld.cpp)
|
||||
target_link_libraries (clickhouse-lld clickhouse-compiler-lib)
|
||||
install (TARGETS clickhouse-clang clickhouse-lld RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
||||
|
@ -7,13 +7,15 @@ else ()
|
||||
include (${ClickHouse_SOURCE_DIR}/cmake/add_check.cmake)
|
||||
endif ()
|
||||
|
||||
include (${PROJECT_SOURCE_DIR}/cmake/find_gtest.cmake)
|
||||
|
||||
# Google Test from sources
|
||||
add_subdirectory(${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
|
||||
# avoid problems with <regexp.h>
|
||||
target_compile_definitions (gtest INTERFACE GTEST_HAS_POSIX_RE=0)
|
||||
target_include_directories (gtest INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/googletest/include)
|
||||
|
||||
if (USE_INTERNAL_GTEST_LIBRARY)
|
||||
# Google Test from sources
|
||||
add_subdirectory(${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
|
||||
# avoid problems with <regexp.h>
|
||||
target_compile_definitions (gtest INTERFACE GTEST_HAS_POSIX_RE=0)
|
||||
target_include_directories (gtest INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/googletest/include)
|
||||
endif ()
|
||||
|
||||
macro(grep_gtest_sources BASE_DIR DST_VAR)
|
||||
# Cold match files that are not in tests/ directories
|
||||
|
Loading…
Reference in New Issue
Block a user