Skip to content

Commit 47ad338

Browse files
authored
Refactor CMake build files (ClickHouse#11390)
* Get rid of lib_name.cmake * Refactor Boost and HyperScan libraries * Refactor lz4 * Fix build with xxHash
1 parent fa7e0e0 commit 47ad338

File tree

53 files changed

+695
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+695
-417
lines changed

CMakeLists.txt

-6
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,16 @@ message (STATUS "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE
327327

328328
include (GNUInstallDirs)
329329
include (cmake/contrib_finder.cmake)
330-
include (cmake/lib_name.cmake)
331330

332331
find_contrib_lib(double-conversion) # Must be before parquet
333332
include (cmake/find/ssl.cmake)
334333
include (cmake/find/ldap.cmake) # after ssl
335334
include (cmake/find/icu.cmake)
336-
include (cmake/find/boost.cmake)
337335
include (cmake/find/zlib.cmake)
338336
include (cmake/find/zstd.cmake)
339337
include (cmake/find/ltdl.cmake) # for odbc
340338
include (cmake/find/termcap.cmake)
341339
# openssl, zlib before poco
342-
include (cmake/find/lz4.cmake)
343-
include (cmake/find/xxhash.cmake)
344340
include (cmake/find/sparsehash.cmake)
345341
include (cmake/find/re2.cmake)
346342
include (cmake/find/libgsasl.cmake)
@@ -358,7 +354,6 @@ include (cmake/find/hdfs3.cmake) # uses protobuf
358354
include (cmake/find/s3.cmake)
359355
include (cmake/find/base64.cmake)
360356
include (cmake/find/parquet.cmake)
361-
include (cmake/find/hyperscan.cmake)
362357
include (cmake/find/simdjson.cmake)
363358
include (cmake/find/rapidjson.cmake)
364359
include (cmake/find/fastops.cmake)
@@ -368,7 +363,6 @@ include (cmake/find/msgpack.cmake)
368363

369364
find_contrib_lib(cityhash)
370365
find_contrib_lib(farmhash)
371-
find_contrib_lib(metrohash)
372366
find_contrib_lib(btrie)
373367

374368
if (ENABLE_TESTS)

base/common/CMakeLists.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ endif()
4444

4545
target_include_directories(common PUBLIC .. ${CMAKE_CURRENT_BINARY_DIR}/..)
4646

47-
if (NOT USE_INTERNAL_BOOST_LIBRARY)
48-
target_include_directories (common SYSTEM BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
49-
endif ()
50-
5147
# Allow explicit fallback to readline
5248
if (NOT ENABLE_REPLXX AND ENABLE_READLINE)
5349
message (STATUS "Attempt to fallback to readline explicitly")
@@ -73,7 +69,8 @@ endif ()
7369
target_link_libraries (common
7470
PUBLIC
7571
${CITYHASH_LIBRARIES}
76-
${Boost_SYSTEM_LIBRARY}
72+
boost::headers_only
73+
boost::system
7774
FastMemcpy
7875
Poco::Net
7976
Poco::Net::SSL

base/mysqlxx/CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ else ()
3232
endif ()
3333
endif ()
3434

35-
target_link_libraries(mysqlxx PUBLIC common PRIVATE ${MYSQLCLIENT_LIBRARIES} PUBLIC ${Boost_SYSTEM_LIBRARY} PRIVATE ${ZLIB_LIBRARIES})
35+
target_link_libraries (mysqlxx
36+
PUBLIC
37+
common
38+
PRIVATE
39+
${MYSQLCLIENT_LIBRARIES}
40+
${ZLIB_LIBRARIES}
41+
)
42+
3643
if(OPENSSL_LIBRARIES)
3744
target_link_libraries(mysqlxx PRIVATE ${OPENSSL_LIBRARIES})
3845
endif()
46+
3947
target_link_libraries(mysqlxx PRIVATE ${PLATFORM_LIBRARIES})
4048

4149
if (NOT USE_INTERNAL_MYSQL_LIBRARY AND OPENSSL_INCLUDE_DIR)

cmake/Modules/Findmetrohash.cmake

-44
This file was deleted.

cmake/find/boost.cmake

-52
This file was deleted.

cmake/find/hyperscan.cmake

-35
This file was deleted.

cmake/find/lz4.cmake

-23
This file was deleted.

cmake/find/parquet.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ elseif(NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD)
6363
set(ARROW_LIBRARY arrow_shared)
6464
set(PARQUET_LIBRARY parquet_shared)
6565
if(USE_INTERNAL_PARQUET_LIBRARY_NATIVE_CMAKE)
66-
list(APPEND PARQUET_LIBRARY ${Boost_REGEX_LIBRARY})
66+
list(APPEND PARQUET_LIBRARY boost::regex)
6767
endif()
6868
set(THRIFT_LIBRARY thrift)
6969
endif()

cmake/find/xxhash.cmake

-22
This file was deleted.

cmake/lib_name.cmake

-4
This file was deleted.

cmake/print_include_directories.cmake

-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ if (TARGET double-conversion)
2121
list(APPEND dirs ${dirs1})
2222
endif ()
2323

24-
if (TARGET ${Boost_PROGRAM_OPTIONS_LIBRARY})
25-
get_property (dirs1 TARGET ${Boost_PROGRAM_OPTIONS_LIBRARY} PROPERTY INCLUDE_DIRECTORIES)
26-
list(APPEND dirs ${dirs1})
27-
endif ()
28-
2924
list(REMOVE_DUPLICATES dirs)
3025
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/include_directories.txt "")
3126
foreach (dir ${dirs})

contrib/CMakeLists.txt

+5-24
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
1616

1717
set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL 1)
1818

19+
add_subdirectory (boost-cmake)
1920
add_subdirectory (cctz-cmake)
2021
add_subdirectory (consistent-hashing-sumbur)
2122
add_subdirectory (consistent-hashing)
2223
add_subdirectory (croaring)
2324
add_subdirectory (FastMemcpy)
25+
add_subdirectory (hyperscan-cmake)
2426
add_subdirectory (jemalloc-cmake)
2527
add_subdirectory (libcpuid-cmake)
28+
add_subdirectory (libdivide)
29+
add_subdirectory (libmetrohash)
30+
add_subdirectory (lz4-cmake)
2631
add_subdirectory (murmurhash)
2732
add_subdirectory (replxx-cmake)
2833
add_subdirectory (ryu-cmake)
@@ -33,14 +38,6 @@ add_subdirectory (poco-cmake)
3338

3439
# TODO: refactor the contrib libraries below this comment.
3540

36-
if (USE_INTERNAL_BOOST_LIBRARY)
37-
add_subdirectory (boost-cmake)
38-
endif ()
39-
40-
if (USE_INTERNAL_LZ4_LIBRARY)
41-
add_subdirectory (lz4-cmake)
42-
endif ()
43-
4441
if (USE_INTERNAL_ZSTD_LIBRARY)
4542
add_subdirectory (zstd-cmake)
4643
endif ()
@@ -63,10 +60,6 @@ if (USE_INTERNAL_FARMHASH_LIBRARY)
6360
add_subdirectory (libfarmhash)
6461
endif ()
6562

66-
if (USE_INTERNAL_METROHASH_LIBRARY)
67-
add_subdirectory (libmetrohash)
68-
endif ()
69-
7063
if (USE_INTERNAL_BTRIE_LIBRARY)
7164
add_subdirectory (libbtrie)
7265
endif ()
@@ -294,18 +287,6 @@ if (USE_BASE64)
294287
add_subdirectory (base64-cmake)
295288
endif()
296289

297-
if (USE_INTERNAL_HYPERSCAN_LIBRARY)
298-
# The library is large - avoid bloat.
299-
if (USE_STATIC_LIBRARIES)
300-
add_subdirectory (hyperscan)
301-
target_compile_options (hs PRIVATE -g0)
302-
else ()
303-
set(BUILD_SHARED_LIBS 1 CACHE INTERNAL "")
304-
add_subdirectory (hyperscan)
305-
target_compile_options (hs_shared PRIVATE -g0)
306-
endif ()
307-
endif()
308-
309290
if (USE_SIMDJSON)
310291
add_subdirectory (simdjson-cmake)
311292
endif()

0 commit comments

Comments
 (0)