mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Embedded compiler: development [#CLICKHOUSE-3396].
This commit is contained in:
parent
5074301f8d
commit
6d84a88629
@ -12,9 +12,7 @@ endif ()
|
|||||||
|
|
||||||
set (INTERNAL_COMPILER_NO_WARNING OFF CACHE BOOL "")
|
set (INTERNAL_COMPILER_NO_WARNING OFF CACHE BOOL "")
|
||||||
|
|
||||||
#original string:
|
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 " CACHE STRING "")
|
||||||
# -x c++ -std=gnu++1y -O3 -g -Wall -Werror -Wnon-virtual-dtor -march=native -msse4 -mpopcnt -D NDEBUG -D_GLIBCXX_USE_CXX11_ABI=0 -shared -fPIC -fvisibility=hidden -fno-implement-inlines
|
|
||||||
set (INTERNAL_COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_INTERNAL_COMPILER} -x c++ -march=native -shared -fPIC -fvisibility=hidden -fno-implement-inlines " CACHE STRING "")
|
|
||||||
string(REPLACE "-no-pie" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS})
|
string(REPLACE "-no-pie" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS})
|
||||||
if (INTERNAL_COMPILER_NO_WARNING)
|
if (INTERNAL_COMPILER_NO_WARNING)
|
||||||
string (REPLACE "-Wall" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS})
|
string (REPLACE "-Wall" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS})
|
||||||
|
@ -203,6 +203,7 @@ void Compiler::compile(
|
|||||||
|
|
||||||
std::string prefix = path + "/" + file_name;
|
std::string prefix = path + "/" + file_name;
|
||||||
std::string cpp_file_path = prefix + ".cpp";
|
std::string cpp_file_path = prefix + ".cpp";
|
||||||
|
std::string o_file_path = prefix + ".o";
|
||||||
std::string so_file_path = prefix + ".so";
|
std::string so_file_path = prefix + ".so";
|
||||||
std::string so_tmp_file_path = prefix + ".so.tmp";
|
std::string so_tmp_file_path = prefix + ".so.tmp";
|
||||||
|
|
||||||
@ -217,8 +218,8 @@ void Compiler::compile(
|
|||||||
|
|
||||||
/// Slightly unconvenient.
|
/// Slightly unconvenient.
|
||||||
command <<
|
command <<
|
||||||
|
"("
|
||||||
INTERNAL_COMPILER_EXECUTABLE
|
INTERNAL_COMPILER_EXECUTABLE
|
||||||
" -fuse-ld=" INTERNAL_LINKER_EXECUTABLE
|
|
||||||
" " INTERNAL_COMPILER_FLAGS
|
" " INTERNAL_COMPILER_FLAGS
|
||||||
#if INTERNAL_COMPILER_CUSTOM_ROOT
|
#if INTERNAL_COMPILER_CUSTOM_ROOT
|
||||||
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/local/include/"
|
" -isystem " INTERNAL_COMPILER_HEADERS_ROOT "/usr/local/include/"
|
||||||
@ -237,8 +238,15 @@ void Compiler::compile(
|
|||||||
" -I " INTERNAL_Boost_INCLUDE_DIRS
|
" -I " INTERNAL_Boost_INCLUDE_DIRS
|
||||||
" -I " INTERNAL_COMPILER_HEADERS "/libs/libcommon/include/"
|
" -I " INTERNAL_COMPILER_HEADERS "/libs/libcommon/include/"
|
||||||
" " << additional_compiler_flags <<
|
" " << additional_compiler_flags <<
|
||||||
" -o " << so_tmp_file_path << " " << cpp_file_path
|
" -c -o " << o_file_path << " " << cpp_file_path
|
||||||
<< " 2>&1 || echo Exit code: $?";
|
<< " 2>&1"
|
||||||
|
") && ("
|
||||||
|
INTERNAL_LINKER_EXECUTABLE
|
||||||
|
" -shared"
|
||||||
|
" -o " << so_tmp_file_path
|
||||||
|
<< " " << o_file_path
|
||||||
|
<< " 2>&1"
|
||||||
|
") || echo Return code: $?";
|
||||||
|
|
||||||
std::string compile_result;
|
std::string compile_result;
|
||||||
|
|
||||||
@ -253,6 +261,7 @@ void Compiler::compile(
|
|||||||
|
|
||||||
/// If there was an error before, the file with the code remains for viewing.
|
/// If there was an error before, the file with the code remains for viewing.
|
||||||
Poco::File(cpp_file_path).remove();
|
Poco::File(cpp_file_path).remove();
|
||||||
|
Poco::File(o_file_path).remove();
|
||||||
|
|
||||||
Poco::File(so_tmp_file_path).renameTo(so_file_path);
|
Poco::File(so_tmp_file_path).renameTo(so_file_path);
|
||||||
SharedLibraryPtr lib(new SharedLibrary(so_file_path));
|
SharedLibraryPtr lib(new SharedLibrary(so_file_path));
|
||||||
|
@ -82,6 +82,9 @@ bool isClickhouseApp(const std::string & app_suffix, std::vector<char *> & argv)
|
|||||||
|
|
||||||
int main(int argc_, char ** argv_)
|
int main(int argc_, char ** argv_)
|
||||||
{
|
{
|
||||||
|
if (argc_ >= 2 && 0 == strcmp(argv_[1], "-cc1"))
|
||||||
|
return mainEntryClickHouseClang(argc_, argv_);
|
||||||
|
|
||||||
#if USE_TCMALLOC
|
#if USE_TCMALLOC
|
||||||
/** Without this option, tcmalloc returns memory to OS too frequently for medium-sized memory allocations
|
/** Without this option, tcmalloc returns memory to OS too frequently for medium-sized memory allocations
|
||||||
* (like IO buffers, column vectors, hash tables, etc.),
|
* (like IO buffers, column vectors, hash tables, etc.),
|
||||||
|
Loading…
Reference in New Issue
Block a user