diff --git a/CMakeLists.txt b/CMakeLists.txt index 581dc75ba1a..863b7f04b16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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/) diff --git a/contrib/libpoco/cmake/FindMySQL.cmake b/contrib/libpoco/cmake/FindMySQL.cmake index c8a9b1b8c57..dc220e6d968 100644 --- a/contrib/libpoco/cmake/FindMySQL.cmake +++ b/contrib/libpoco/cmake/FindMySQL.cmake @@ -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 diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 1bf53b59e43..fc5b866caf2 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -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 diff --git a/dbms/src/Client/CMakeLists.txt b/dbms/src/Client/CMakeLists.txt index bd21cd7930a..c44305382f9 100644 --- a/dbms/src/Client/CMakeLists.txt +++ b/dbms/src/Client/CMakeLists.txt @@ -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) diff --git a/dbms/src/Common/tests/CMakeLists.txt b/dbms/src/Common/tests/CMakeLists.txt index fd6544fa026..4a1279eadf6 100644 --- a/dbms/src/Common/tests/CMakeLists.txt +++ b/dbms/src/Common/tests/CMakeLists.txt @@ -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) diff --git a/dbms/src/IO/tests/CMakeLists.txt b/dbms/src/IO/tests/CMakeLists.txt index 90042f23684..d444bdbfbff 100644 --- a/dbms/src/IO/tests/CMakeLists.txt +++ b/dbms/src/IO/tests/CMakeLists.txt @@ -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() diff --git a/dbms/src/Interpreters/tests/CMakeLists.txt b/dbms/src/Interpreters/tests/CMakeLists.txt index e6d58b25571..e8b6e7af23c 100644 --- a/dbms/src/Interpreters/tests/CMakeLists.txt +++ b/dbms/src/Interpreters/tests/CMakeLists.txt @@ -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}) diff --git a/doc/build_osx.md b/doc/build_osx.md index 2521d1453b3..fad610544e5 100644 --- a/doc/build_osx.md +++ b/doc/build_osx.md @@ -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 diff --git a/libs/libcommon/CMakeLists.txt b/libs/libcommon/CMakeLists.txt index a3c484127d6..7f131f6de35 100644 --- a/libs/libcommon/CMakeLists.txt +++ b/libs/libcommon/CMakeLists.txt @@ -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}) diff --git a/libs/libcommon/src/tests/CMakeLists.txt b/libs/libcommon/src/tests/CMakeLists.txt index cb8b62802d3..d81fc17768c 100644 --- a/libs/libcommon/src/tests/CMakeLists.txt +++ b/libs/libcommon/src/tests/CMakeLists.txt @@ -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) diff --git a/libs/libmysqlxx/CMakeLists.txt b/libs/libmysqlxx/CMakeLists.txt index aad35dbcfe3..c51d7f8243a 100644 --- a/libs/libmysqlxx/CMakeLists.txt +++ b/libs/libmysqlxx/CMakeLists.txt @@ -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) diff --git a/utils/compressor/CMakeLists.txt b/utils/compressor/CMakeLists.txt index 09c9e3ceaa4..376e6e17293 100644 --- a/utils/compressor/CMakeLists.txt +++ b/utils/compressor/CMakeLists.txt @@ -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) diff --git a/utils/wikistat-loader/CMakeLists.txt b/utils/wikistat-loader/CMakeLists.txt index 002edf06712..dc24f03a84a 100644 --- a/utils/wikistat-loader/CMakeLists.txt +++ b/utils/wikistat-loader/CMakeLists.txt @@ -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}) diff --git a/utils/zookeeper-create-entry-to-download-part/CMakeLists.txt b/utils/zookeeper-create-entry-to-download-part/CMakeLists.txt index 0d80fcf9b6c..d95f3c59c05 100644 --- a/utils/zookeeper-create-entry-to-download-part/CMakeLists.txt +++ b/utils/zookeeper-create-entry-to-download-part/CMakeLists.txt @@ -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}) diff --git a/utils/zookeeper-dump-tree/CMakeLists.txt b/utils/zookeeper-dump-tree/CMakeLists.txt index c041a8a64e8..46b9d1f7a3c 100644 --- a/utils/zookeeper-dump-tree/CMakeLists.txt +++ b/utils/zookeeper-dump-tree/CMakeLists.txt @@ -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}) diff --git a/utils/zookeeper-remove-by-list/CMakeLists.txt b/utils/zookeeper-remove-by-list/CMakeLists.txt index 82e5d2a21b3..13203f6805d 100644 --- a/utils/zookeeper-remove-by-list/CMakeLists.txt +++ b/utils/zookeeper-remove-by-list/CMakeLists.txt @@ -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})