Split lib dbms to dbms + dbms_common_io

This commit is contained in:
proller 2017-11-17 22:19:49 +03:00
parent fcc8c27970
commit aa3dd03389
14 changed files with 98 additions and 81 deletions

View File

@ -64,6 +64,13 @@ option (ENABLE_TESTS "Enables tests" ON)
option (USE_STATIC_LIBRARIES "Set to FALSE to use shared libraries" ON)
option (MAKE_STATIC_LIBRARIES "Set to FALSE to make shared libraries" ${USE_STATIC_LIBRARIES})
if (NOT MAKE_STATIC_LIBRARIES)
option (SPLIT_SHARED_LIBRARIES "DEV ONLY. Keep all internal libs as separate .so for faster link" OFF)
endif ()
if (SPLIT_SHARED_LIBRARIES)
set (SPLIT_SHARED SHARED)
endif ()
if (USE_STATIC_LIBRARIES)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif ()

View File

@ -4,6 +4,9 @@
get_property (dirs1 TARGET dbms PROPERTY INCLUDE_DIRECTORIES)
list(APPEND dirs ${dirs1})
get_property (dirs1 TARGET dbms_common_io PROPERTY INCLUDE_DIRECTORIES)
list(APPEND dirs ${dirs1})
get_property (dirs1 TARGET common PROPERTY INCLUDE_DIRECTORIES)
list(APPEND dirs ${dirs1})

View File

@ -36,6 +36,12 @@ set(dbms_headers)
set(dbms_sources)
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(dbms_common_io src/Common)
add_headers_and_sources(dbms_common_io src/Common/HashTable)
add_headers_and_sources(dbms_common_io src/Common/ZooKeeper)
add_headers_and_sources(dbms_common_io src/IO)
add_headers_and_sources(dbms src/Parsers)
add_headers_and_sources(dbms src/Analyzers)
add_headers_and_sources(dbms src/Core)
@ -46,20 +52,15 @@ add_headers_and_sources(dbms src/Dictionaries)
add_headers_and_sources(dbms src/Dictionaries/Embedded)
add_headers_and_sources(dbms src/Interpreters)
add_headers_and_sources(dbms src/Interpreters/ClusterProxy)
add_headers_and_sources(dbms src/Common)
add_headers_and_sources(dbms src/Common/HashTable)
add_headers_and_sources(dbms src/Common/ZooKeeper)
add_headers_and_sources(dbms src/IO)
add_headers_and_sources(dbms src/Columns)
add_headers_and_sources(dbms src/Storages)
add_headers_and_sources(dbms src/Storages/Distributed)
add_headers_and_sources(dbms src/Storages/MergeTree)
add_headers_and_sources(dbms src/Core)
add_headers_and_sources(dbms src/Client)
add_headers_only(dbms src/Server)
list (APPEND dbms_sources ${CONFIG_BUILD})
list (APPEND dbms_headers ${CONFIG_VERSION} ${CONFIG_COMMON})
list (APPEND dbms_common_io_sources ${CONFIG_BUILD})
list (APPEND dbms_common_io_headers ${CONFIG_VERSION} ${CONFIG_COMMON})
list (APPEND dbms_sources src/Functions/IFunction.cpp src/Functions/FunctionFactory.cpp src/Functions/FunctionHelpers.cpp)
list (APPEND dbms_headers src/Functions/IFunction.h src/Functions/FunctionFactory.h src/Functions/FunctionHelpers.h)
@ -91,19 +92,21 @@ list (APPEND dbms_sources src/TableFunctions/TableFunctionFactory.cpp)
list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h)
list(REMOVE_ITEM dbms_sources
list(REMOVE_ITEM dbms_common_io_sources
src/Common/StringUtils.cpp)
if (APPLE OR CMAKE_SYSTEM MATCHES "FreeBSD")
list(REMOVE_ITEM dbms_headers
list(REMOVE_ITEM dbms_common_io_headers
src/Common/AIO.h
src/IO/WriteBufferAIO.h
src/IO/ReadBufferAIO.h)
list(REMOVE_ITEM dbms_sources
list(REMOVE_ITEM dbms_common_io_sources
src/IO/ReadBufferAIO.cpp
src/IO/WriteBufferAIO.cpp)
endif()
add_library(dbms_common_io ${SPLIT_SHARED} ${dbms_common_io_headers} ${dbms_common_io_sources})
if (MAKE_STATIC_LIBRARIES)
add_library(dbms ${dbms_headers} ${dbms_sources})
else ()
@ -144,18 +147,22 @@ else()
set(PLATFORM_LIBS "")
endif()
target_link_libraries (dbms
target_link_libraries (dbms_common_io
common
${MYSQLXX_LIBRARY}
${FARMHASH_LIBRARIES}
${METROHASH_LIBRARIES}
${LINK_LIBRARIES_ONLY_ON_X86_64}
${LZ4_LIBRARY}
${ZSTD_LIBRARY}
${ZOOKEEPER_LIBRARY}
string_utils
${DOUBLE_CONVERSION_LIBRARIES}
)
target_link_libraries (dbms
dbms_common_io
${MYSQLXX_LIBRARY}
${FARMHASH_LIBRARIES}
${METROHASH_LIBRARIES}
string_utils
${ZLIB_LIBRARIES}
${LINK_LIBRARIES_ONLY_ON_X86_64}
${RE2_LIBRARY}
${RE2_ST_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY}
@ -203,16 +210,16 @@ if (NOT USE_INTERNAL_ZSTD_LIBRARY)
endif ()
target_include_directories (dbms PUBLIC ${DBMS_INCLUDE_DIR})
target_include_directories (dbms PUBLIC ${PCG_RANDOM_INCLUDE_DIR})
target_include_directories (dbms_common_io PUBLIC ${DBMS_INCLUDE_DIR})
target_include_directories (dbms_common_io PUBLIC ${PCG_RANDOM_INCLUDE_DIR})
target_include_directories (dbms_common_io BEFORE PUBLIC ${DOUBLE_CONVERSION_INCLUDE_DIR})
if (USE_RDKAFKA)
target_link_libraries (dbms ${RDKAFKA_LIBRARY})
endif ()
# only for copy_headers.sh:
target_include_directories (dbms BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
target_include_directories (dbms BEFORE PRIVATE ${DOUBLE_CONVERSION_INCLUDE_DIR})
# also for copy_headers.sh:
target_include_directories (dbms_common_io BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
if (ENABLE_TESTS)
add_subdirectory (tests)

View File

@ -26,6 +26,6 @@ list(REMOVE_ITEM clickhouse_aggregate_functions_headers
parseAggregateFunctionParameters.h
)
add_library(clickhouse_aggregate_functions ${clickhouse_aggregate_functions_sources})
add_library(clickhouse_aggregate_functions ${SPLIT_SHARED} ${clickhouse_aggregate_functions_sources})
target_link_libraries(clickhouse_aggregate_functions dbms)
target_include_directories (clickhouse_aggregate_functions BEFORE PRIVATE ${COMMON_INCLUDE_DIR})

View File

@ -1,20 +1,20 @@
add_executable(zkutil_test_commands zkutil_test_commands.cpp)
target_link_libraries(zkutil_test_commands dbms)
target_link_libraries(zkutil_test_commands dbms_common_io)
add_executable(zkutil_test_lock zkutil_test_lock.cpp)
target_link_libraries(zkutil_test_lock dbms)
target_link_libraries(zkutil_test_lock dbms_common_io)
add_executable(zkutil_expiration_test zkutil_expiration_test.cpp)
target_link_libraries(zkutil_expiration_test dbms)
target_link_libraries(zkutil_expiration_test dbms_common_io)
add_executable(zkutil_test_async zkutil_test_async.cpp)
target_link_libraries(zkutil_test_async dbms)
target_link_libraries(zkutil_test_async dbms_common_io)
add_executable(zkutil_zookeeper_holder zkutil_zookeeper_holder.cpp)
target_link_libraries(zkutil_zookeeper_holder dbms)
target_link_libraries(zkutil_zookeeper_holder dbms_common_io)
add_executable (zk_many_watches_reconnect zk_many_watches_reconnect.cpp)
target_link_libraries (zk_many_watches_reconnect dbms)
target_link_libraries (zk_many_watches_reconnect dbms_common_io)
add_executable (zkutil_test_multi_exception zkutil_test_multi_exception.cpp)
target_link_libraries (zkutil_test_multi_exception dbms gtest_main)
target_link_libraries (zkutil_test_multi_exception dbms_common_io gtest_main)

View File

@ -2,63 +2,63 @@ add_executable (hashes_test hashes_test.cpp)
target_link_libraries (hashes_test dbms)
add_executable (sip_hash sip_hash.cpp)
target_link_libraries (sip_hash dbms)
target_link_libraries (sip_hash dbms_common_io)
add_executable (sip_hash_perf sip_hash_perf.cpp)
target_link_libraries (sip_hash_perf dbms)
target_link_libraries (sip_hash_perf dbms_common_io)
add_executable (auto_array auto_array.cpp)
target_link_libraries (auto_array dbms)
target_link_libraries (auto_array dbms_common_io)
add_executable (lru_cache lru_cache.cpp)
target_link_libraries (lru_cache dbms)
target_link_libraries (lru_cache dbms_common_io)
add_executable (hash_table hash_table.cpp)
target_link_libraries (hash_table dbms)
target_link_libraries (hash_table dbms_common_io)
add_executable (small_table small_table.cpp)
target_link_libraries (small_table dbms)
target_link_libraries (small_table dbms_common_io)
add_executable (parallel_aggregation parallel_aggregation.cpp)
target_link_libraries (parallel_aggregation dbms)
target_link_libraries (parallel_aggregation dbms_common_io)
add_executable (parallel_aggregation2 parallel_aggregation2.cpp)
target_link_libraries (parallel_aggregation2 dbms)
target_link_libraries (parallel_aggregation2 dbms_common_io)
add_executable (int_hashes_perf int_hashes_perf.cpp AvalancheTest.cpp Random.cpp)
target_link_libraries (int_hashes_perf dbms)
target_link_libraries (int_hashes_perf dbms_common_io)
add_executable (simple_cache simple_cache.cpp)
target_include_directories (simple_cache PRIVATE ${DBMS_INCLUDE_DIR})
target_link_libraries (simple_cache common)
add_executable (compact_array compact_array.cpp)
target_link_libraries (compact_array dbms ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries (compact_array dbms_common_io ${Boost_FILESYSTEM_LIBRARY})
add_executable (radix_sort radix_sort.cpp)
target_link_libraries (radix_sort dbms)
target_link_libraries (radix_sort dbms_common_io)
add_executable (shell_command_test shell_command_test.cpp)
target_link_libraries (shell_command_test dbms)
target_link_libraries (shell_command_test dbms_common_io)
add_executable (arena_with_free_lists arena_with_free_lists.cpp)
target_link_libraries (arena_with_free_lists dbms)
target_link_libraries (arena_with_free_lists dbms_common_io)
add_executable (pod_array pod_array.cpp)
target_link_libraries (pod_array dbms)
target_link_libraries (pod_array dbms_common_io)
add_executable (thread_creation_latency thread_creation_latency.cpp)
target_link_libraries (thread_creation_latency dbms)
target_link_libraries (thread_creation_latency dbms_common_io)
add_executable (thread_pool thread_pool.cpp)
target_link_libraries (thread_pool dbms)
target_link_libraries (thread_pool dbms_common_io)
add_executable (array_cache array_cache.cpp)
target_link_libraries (array_cache dbms)
target_link_libraries (array_cache dbms_common_io)
add_executable (space_saving space_saving.cpp)
target_link_libraries (space_saving dbms)
target_link_libraries (space_saving dbms_common_io)
add_executable (integer_hash_tables_and_hashes integer_hash_tables_and_hashes.cpp)
target_include_directories (integer_hash_tables_and_hashes BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})
target_link_libraries (integer_hash_tables_and_hashes dbms)
target_link_libraries (integer_hash_tables_and_hashes dbms_common_io)

View File

@ -1,17 +1,17 @@
add_executable (exception exception.cpp)
target_link_libraries (exception dbms)
target_link_libraries (exception dbms_common_io)
add_executable (string_pool string_pool.cpp)
target_link_libraries (string_pool dbms)
target_link_libraries (string_pool dbms_common_io)
target_include_directories (string_pool BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})
add_executable (field field.cpp)
target_link_libraries (field dbms)
add_executable (move_field move_field.cpp)
target_link_libraries (move_field dbms)
target_link_libraries (move_field dbms_common_io)
add_executable (rvo_test rvo_test.cpp)
add_executable (string_ref_hash string_ref_hash.cpp)
target_link_libraries (string_ref_hash dbms)
target_link_libraries (string_ref_hash dbms_common_io)

View File

@ -68,7 +68,7 @@ add_headers_and_sources(clickhouse_functions ${ClickHouse_BINARY_DIR}/dbms/src/F
list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp DataTypeTraits.cpp FunctionHelpers.cpp)
list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h DataTypeTraits.h FunctionHelpers.h)
add_library(clickhouse_functions ${clickhouse_functions_sources})
add_library(clickhouse_functions ${SPLIT_SHARED} ${clickhouse_functions_sources})
target_link_libraries(clickhouse_functions dbms)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src)

View File

@ -2,83 +2,83 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR})
set(SRCS )
add_executable (read_buffer read_buffer.cpp ${SRCS})
target_link_libraries (read_buffer dbms)
target_link_libraries (read_buffer dbms_common_io)
add_executable (read_buffer_perf read_buffer_perf.cpp ${SRCS})
target_link_libraries (read_buffer_perf dbms)
target_link_libraries (read_buffer_perf dbms_common_io)
add_executable (read_float_perf read_float_perf.cpp ${SRCS})
target_link_libraries (read_float_perf dbms)
target_link_libraries (read_float_perf dbms_common_io)
add_executable (write_buffer write_buffer.cpp ${SRCS})
target_link_libraries (write_buffer dbms)
target_link_libraries (write_buffer dbms_common_io)
add_executable (write_buffer_perf write_buffer_perf.cpp ${SRCS})
target_link_libraries (write_buffer_perf dbms)
target_link_libraries (write_buffer_perf dbms_common_io)
add_executable (valid_utf8_perf valid_utf8_perf.cpp ${SRCS})
target_link_libraries (valid_utf8_perf dbms)
target_link_libraries (valid_utf8_perf dbms_common_io)
add_executable (valid_utf8 valid_utf8.cpp ${SRCS})
target_link_libraries (valid_utf8 dbms)
target_link_libraries (valid_utf8 dbms_common_io)
add_executable (compressed_buffer compressed_buffer.cpp ${SRCS})
target_link_libraries (compressed_buffer dbms)
target_link_libraries (compressed_buffer dbms_common_io)
add_executable (var_uint var_uint.cpp ${SRCS})
target_link_libraries (var_uint dbms)
target_link_libraries (var_uint dbms_common_io)
add_executable (read_escaped_string read_escaped_string.cpp ${SRCS})
target_link_libraries (read_escaped_string dbms)
target_link_libraries (read_escaped_string dbms_common_io)
add_executable (async_write async_write.cpp ${SRCS})
target_link_libraries (async_write dbms)
target_link_libraries (async_write dbms_common_io)
add_executable (parse_int_perf parse_int_perf.cpp ${SRCS})
target_link_libraries (parse_int_perf dbms)
target_link_libraries (parse_int_perf dbms_common_io)
add_executable (parse_int_perf2 parse_int_perf2.cpp ${SRCS})
target_link_libraries (parse_int_perf2 dbms)
target_link_libraries (parse_int_perf2 dbms_common_io)
add_executable (read_write_int read_write_int.cpp ${SRCS})
target_link_libraries (read_write_int dbms)
target_link_libraries (read_write_int dbms_common_io)
add_executable (mempbrk mempbrk.cpp ${SRCS})
target_link_libraries (mempbrk dbms)
target_link_libraries (mempbrk dbms_common_io)
add_executable (cached_compressed_read_buffer cached_compressed_read_buffer.cpp ${SRCS})
target_link_libraries (cached_compressed_read_buffer dbms)
target_link_libraries (cached_compressed_read_buffer dbms_common_io)
add_executable (o_direct_and_dirty_pages o_direct_and_dirty_pages.cpp ${SRCS})
target_link_libraries (o_direct_and_dirty_pages dbms)
target_link_libraries (o_direct_and_dirty_pages dbms_common_io)
add_executable (hashing_write_buffer hashing_write_buffer.cpp ${SRCS})
target_link_libraries (hashing_write_buffer dbms)
target_link_libraries (hashing_write_buffer dbms_common_io)
add_check(hashing_write_buffer)
add_executable (hashing_read_buffer hashing_read_buffer.cpp)
target_link_libraries (hashing_read_buffer dbms)
target_link_libraries (hashing_read_buffer dbms_common_io)
add_check (hashing_read_buffer)
add_executable (io_operators operators.cpp ${SRCS})
target_link_libraries (io_operators dbms)
target_link_libraries (io_operators dbms_common_io)
if (NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD")
add_executable(write_buffer_aio write_buffer_aio.cpp)
target_link_libraries (write_buffer_aio dbms ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries (write_buffer_aio dbms_common_io ${Boost_FILESYSTEM_LIBRARY})
add_executable(read_buffer_aio read_buffer_aio.cpp)
target_link_libraries (read_buffer_aio dbms ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries (read_buffer_aio dbms_common_io ${Boost_FILESYSTEM_LIBRARY})
endif ()
add_executable (zlib_buffers zlib_buffers.cpp ${SRCS})
target_link_libraries (zlib_buffers dbms)
target_link_libraries (zlib_buffers dbms_common_io)
add_executable (remote_read_write_buffer remote_read_write_buffer.cpp ${SRCS})
target_link_libraries (remote_read_write_buffer dbms)
target_link_libraries (remote_read_write_buffer dbms_common_io)
add_executable (limit_read_buffer limit_read_buffer.cpp ${SRCS})
target_link_libraries (limit_read_buffer dbms)
target_link_libraries (limit_read_buffer dbms_common_io)
add_executable (limit_read_buffer2 limit_read_buffer2.cpp ${SRCS})
target_link_libraries (limit_read_buffer2 dbms)
target_link_libraries (limit_read_buffer2 dbms_common_io)

View File

@ -1,5 +1,5 @@
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(storages_system .)
add_library(clickhouse_storages_system ${storages_system_headers} ${storages_system_sources})
add_library(clickhouse_storages_system ${SPLIT_SHARED} ${storages_system_headers} ${storages_system_sources})
target_link_libraries(clickhouse_storages_system dbms)

View File

@ -4,5 +4,5 @@ add_headers_and_sources(clickhouse_table_functions .)
list(REMOVE_ITEM clickhouse_table_functions_sources TableFunctionFactory.cpp)
list(REMOVE_ITEM clickhouse_table_functions_headers ITableFunction.h TableFunctionFactory.h)
add_library(clickhouse_table_functions ${clickhouse_table_functions_sources})
add_library(clickhouse_table_functions ${SPLIT_SHARED} ${clickhouse_table_functions_sources})
target_link_libraries(clickhouse_table_functions dbms clickhouse_storages_system ${Poco_Foundation_LIBRARY})