: More specific usage of static libraries. [#METR-21516]

This commit is contained in:
Vladimir Chebotarev 2016-11-09 21:48:54 +03:00
parent a13af437d3
commit cdaece7dfa
16 changed files with 45 additions and 31 deletions

View File

@ -172,6 +172,18 @@ find_library (ICUUC libicuuc.a HINTS ${ICU_HINTS})
find_library (ICUDATA libicudata.a HINTS ${ICU_HINTS})
set (ICU_LIBS ${ICUI18N} ${ICUUC} ${ICUDATA})
# 3. boost
set (BOOST_HINTS "/usr/local/opt/boost/lib")
find_library (BOOST_PROGRAM_OPTIONS_LIB libboost_program_options.a HINTS ${BOOST_HINTS})
find_library (BOOST_SYSTEM_LIB libboost_system.a HINTS ${BOOST_HINTS})
find_library (BOOST_FILESYSTEM_LIB libboost_filesystem.a HINTS ${BOOST_HINTS})
find_library (BOOST_REGEX_LIB libboost_regex.a HINTS ${BOOST_HINTS})
find_library (BOOST_THREAD_LIB libboost_thread.a HINTS ${BOOST_HINTS})
# 4. ltdl
set (LTDL_HINTS "/usr/local/opt/libtool/lib")
find_library (LTDL_LIB libltdl.a HINTS ${LTDL_HINTS})
# Directory for Yandex specific files
SET(CLICKHOUSE_PRIVATE_DIR ${ClickHouse_SOURCE_DIR}/private/)

View File

@ -20,7 +20,7 @@ if (WIN32)
add_definitions(-DDBUG_OFF)
endif (CMAKE_BUILD_TYPE STREQUAL Debug)
find_library(MYSQL_LIB NAMES mysqlclient
find_library(MYSQL_LIB NAMES libmysqlclient.a
PATHS
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
@ -28,7 +28,7 @@ if (WIN32)
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
else (WIN32)
find_library(MYSQL_LIB NAMES mysqlclient_r
find_library(MYSQL_LIB NAMES libmysqlclient_r.a
PATHS
/usr/lib/mysql
/usr/local/lib/mysql

View File

@ -19,7 +19,7 @@ endif()
if (DISABLE_MONGODB)
add_definitions(-D DISABLE_MONGODB)
else()
set (LINK_MONGOCLIENT libmongoclient.a ${OPENSSL_LIBS} libboost_thread.a)
set (LINK_MONGOCLIENT libmongoclient.a ${OPENSSL_LIBS} ${BOOST_THREAD_LIB})
endif()
if (DISABLE_LIBTCMALLOC)
@ -1014,13 +1014,13 @@ target_link_libraries(dbms
${LINK_LIBRARIES_ONLY_ON_X86_64}
re2 re2_st
libcrypto.a
libboost_system.a
${BOOST_SYSTEM_LIB}
${LINK_MONGOCLIENT}
libboost_regex.a
${BOOST_REGEX_LIB}
PocoData
PocoDataODBC
${APPLE_ICONV_LIB}
dl libltdl.a)
dl ${LTDL_LIB})
add_dependencies (dbms
common

View File

@ -21,8 +21,8 @@ endif()
add_executable(clickhouse-client Client.cpp)
add_executable(clickhouse-benchmark Benchmark.cpp)
target_link_libraries (clickhouse-client dbms ${LINE_EDITING_LIBS} libboost_program_options.a)
target_link_libraries (clickhouse-benchmark dbms libboost_program_options.a)
target_link_libraries (clickhouse-client dbms ${LINE_EDITING_LIBS} ${BOOST_PROGRAM_OPTIONS_LIB})
target_link_libraries (clickhouse-benchmark dbms ${BOOST_PROGRAM_OPTIONS_LIB})
INSTALL(TARGETS clickhouse-client RUNTIME DESTINATION bin COMPONENT clickhouse-client)
INSTALL(FILES config.xml DESTINATION /etc/clickhouse-client COMPONENT clickhouse-client)

View File

@ -32,7 +32,7 @@ add_executable (simple_cache simple_cache.cpp)
target_link_libraries (simple_cache common)
add_executable (compact_array compact_array.cpp)
target_link_libraries (compact_array dbms libboost_filesystem.a)
target_link_libraries (compact_array dbms ${BOOST_FILESYSTEM_LIB})
add_executable (radix_sort radix_sort.cpp)
target_link_libraries (radix_sort dbms)

View File

@ -65,8 +65,8 @@ target_link_libraries (io_operators dbms)
if (NOT APPLE)
add_executable(write_buffer_aio write_buffer_aio.cpp)
target_link_libraries (write_buffer_aio dbms libboost_filesystem.a)
target_link_libraries (write_buffer_aio dbms ${BOOST_FILESYSTEM_LIB})
add_executable(read_buffer_aio read_buffer_aio.cpp)
target_link_libraries (read_buffer_aio dbms libboost_filesystem.a)
target_link_libraries (read_buffer_aio dbms ${BOOST_FILESYSTEM_LIB})
endif()

View File

@ -50,4 +50,4 @@ add_executable (in_join_subqueries_preprocessor in_join_subqueries_preprocessor.
target_link_libraries (in_join_subqueries_preprocessor dbms)
add_executable (users users.cpp)
target_link_libraries (users dbms libboost_filesystem.a)
target_link_libraries (users dbms ${BOOST_FILESYSTEM_LIB})

View File

@ -3,10 +3,6 @@
Build should work on Mac OS X 10.12. If you're using earlier version, you can try to build ClickHouse using Gentoo Prefix and clang sl in this instruction.
With appropriate changes, build should work on any other OS X distribution.
## Install Xcode
Use App Store.
## Install Homebrew
```
@ -28,7 +24,7 @@ brew install boost --cc=gcc-6
## Install required libraries
```
brew install icu4c mysql openssl unixodbc
brew install icu4c mysql openssl unixodbc glib libtool
```
## Install optional libraries

View File

@ -78,12 +78,15 @@ else()
SET(RT_LIBRARIES "librt.a")
endif()
set (GLIB_HINTS "/usr/local/opt/glib/lib")
find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS})
target_link_libraries (
common
pocoext
${MALLOC_LIBRARIES}
pthread
libglib-2.0.a
${GLIB_LIB}
${ICU_LIBS}
${RT_LIBRARIES})

View File

@ -9,17 +9,17 @@ add_executable (json_test json_test.cpp)
add_executable (strong_typedef strong_typedef.cpp)
if (APPLE)
SET(RT_LIBRARIES "")
set (RT_LIBRARIES "")
else()
SET(RT_LIBRARIES "rt")
set (RT_LIBRARIES "rt")
endif()
target_link_libraries (date_lut_init common ${ICU_LIBS} dl)
target_link_libraries (date_lut2 common ${ICU_LIBS} dl)
target_link_libraries (date_lut3 common ${ICU_LIBS} dl)
target_link_libraries (date_lut4 common ${ICU_LIBS} dl)
target_link_libraries (multi_version dbms libboost_system.a ${RT_LIBRARIES})
target_link_libraries (json_test dbms libboost_system.a ${RT_LIBRARIES})
target_link_libraries (multi_version dbms ${BOOST_SYSTEM_LIB} ${RT_LIBRARIES})
target_link_libraries (json_test dbms ${BOOST_SYSTEM_LIB} ${RT_LIBRARIES})
target_link_libraries (strong_typedef common)
add_check (json_test)

View File

@ -26,16 +26,18 @@ add_library (mysqlxx
add_dependencies (mysqlxx common)
target_link_libraries (mysqlxx common libmysqlclient.a ${OPENSSL_LIBS} libz.a dl)
set (MYSQL_HINTS "/usr/local/opt/mysql/lib")
find_library (MYSQLCLIENT_LIB libmysqlclient.a HINTS ${MYSQL_HINTS})
target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBS} libz.a dl)
ADD_CUSTOM_COMMAND(
add_custom_command(
TARGET mysqlxx
POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/patch.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Patching mysqlclient library.")
IF(TESTS)
if(TESTS)
add_subdirectory (src/tests)
ENDIF(TESTS)
endif(TESTS)

View File

@ -1,5 +1,5 @@
add_executable (compressor main.cpp)
target_link_libraries (compressor dbms libboost_program_options.a)
target_link_libraries (compressor dbms ${BOOST_PROGRAM_OPTIONS_LIB})
INSTALL(TARGETS compressor RUNTIME DESTINATION bin COMPONENT compressor)

View File

@ -1,2 +1,2 @@
add_executable (wikistat-loader main.cpp ${SRCS})
target_link_libraries (wikistat-loader dbms libboost_program_options.a)
target_link_libraries (wikistat-loader dbms ${BOOST_PROGRAM_OPTIONS_LIB})

View File

@ -1,2 +1,2 @@
add_executable (zookeeper-create-entry-to-download-part main.cpp ${SRCS})
target_link_libraries (zookeeper-create-entry-to-download-part zkutil dbms libboost_program_options.a)
target_link_libraries (zookeeper-create-entry-to-download-part zkutil dbms ${BOOST_PROGRAM_OPTIONS_LIB})

View File

@ -1,2 +1,2 @@
add_executable (zookeeper-dump-tree main.cpp ${SRCS})
target_link_libraries (zookeeper-dump-tree zkutil dbms libboost_program_options.a)
target_link_libraries (zookeeper-dump-tree zkutil dbms ${BOOST_PROGRAM_OPTIONS_LIB})

View File

@ -1,2 +1,3 @@
add_executable (zookeeper-remove-by-list main.cpp ${SRCS})
target_link_libraries (zookeeper-remove-by-list zkutil dbms libboost_program_options.a)
target_link_libraries (zookeeper-remove-by-list zkutil dbms ${BOOST_PROGRAM_OPTIONS_LIB})