diff --git a/.github/workflows/lint_and_test_cpp.yaml b/.github/workflows/lint_and_test_cpp.yaml index f3dc28d389..1f5af4ee2d 100644 --- a/.github/workflows/lint_and_test_cpp.yaml +++ b/.github/workflows/lint_and_test_cpp.yaml @@ -654,8 +654,6 @@ jobs: name: macOS needs: cpp_clang_format_linter runs-on: macos-12 - env: - OPENSSL_ROOT_DIR: /usr/local/opt/openssl steps: - name: Install Softwares run: | @@ -680,7 +678,7 @@ jobs: run: | export JAVA_HOME="${JAVA_HOME_8_X64}" mkdir -p build - cmake -DCMAKE_BUILD_TYPE=Release -B build/ -DMACOS_OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DROCKSDB_PORTABLE=1 + cmake -DCMAKE_BUILD_TYPE=Release -B build/ -DROCKSDB_PORTABLE=1 cmake --build build/ -j $(sysctl -n hw.physicalcpu) - name: Compilation run: | diff --git a/cmake_modules/BaseFunctions.cmake b/cmake_modules/BaseFunctions.cmake index 0147b50298..ad4133e0bc 100644 --- a/cmake_modules/BaseFunctions.cmake +++ b/cmake_modules/BaseFunctions.cmake @@ -348,16 +348,15 @@ function(dsn_setup_thirdparty_libs) message (STATUS "JAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY}") link_libraries(${JAVA_JVM_LIBRARY}) + find_package(OpenSSL REQUIRED) + include_directories(${OPENSSL_INCLUDE_DIR}) + link_libraries(${OPENSSL_CRYPTO_LIBRARY}) + link_libraries(${OPENSSL_SSL_LIBRARY}) + link_directories(${THIRDPARTY_INSTALL_DIR}/lib) if (NOT APPLE) link_directories(${THIRDPARTY_INSTALL_DIR}/lib64) endif() - - if (APPLE) - include_directories(SYSTEM ${MACOS_OPENSSL_ROOT_DIR}/include) - link_directories(${MACOS_OPENSSL_ROOT_DIR}/lib) - message (STATUS "MACOS_OPENSSL_ROOT_DIR: ${MACOS_OPENSSL_ROOT_DIR}") - endif() endfunction(dsn_setup_thirdparty_libs) function(dsn_common_setup) diff --git a/run.sh b/run.sh index 2672094f7c..ab5e9852df 100755 --- a/run.sh +++ b/run.sh @@ -226,10 +226,6 @@ function run_build() CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Release" fi - if [ "$(uname)" == "Darwin" ]; then - CMAKE_OPTIONS="${CMAKE_OPTIONS} -DMACOS_OPENSSL_ROOT_DIR=/usr/local/opt/openssl" - fi - if [ ! -z "${SANITIZER}" ]; then CMAKE_OPTIONS="${CMAKE_OPTIONS} -DSANITIZER=${SANITIZER}" fi diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index def16ec26c..9a8b2c44b0 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -51,7 +51,6 @@ set(MY_PROJ_LIBS PocoFoundation PocoNetSSL PocoJSON - crypto hashtable hdfs rocksdb) diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index 16c4ff4836..108c111298 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -57,9 +57,7 @@ set(MY_PROJ_LIBS PocoFoundation PocoNetSSL PocoJSON - crypto gtest - ssl hdfs) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 1127a868ef..c3cbc3db88 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -31,7 +31,7 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) -set(MY_PROJ_LIBS dsn_http crypto rocksdb) +set(MY_PROJ_LIBS dsn_http rocksdb) # Extra files that will be installed set(MY_BINPLACES "") diff --git a/src/zookeeper/CMakeLists.txt b/src/zookeeper/CMakeLists.txt index 5e39d70ef0..c6d99a55d9 100644 --- a/src/zookeeper/CMakeLists.txt +++ b/src/zookeeper/CMakeLists.txt @@ -34,7 +34,7 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS zookeeper hashtable ssl crypto) +set(MY_PROJ_LIBS zookeeper hashtable) # Extra files that will be installed set(MY_BINPLACES "") diff --git a/src/zookeeper/test/CMakeLists.txt b/src/zookeeper/test/CMakeLists.txt index 6179f8d1ec..5a06fa6933 100644 --- a/src/zookeeper/test/CMakeLists.txt +++ b/src/zookeeper/test/CMakeLists.txt @@ -39,8 +39,6 @@ set(MY_PROJ_LIBS zookeeper hashtable gtest - ssl - crypto rocksdb) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 4f00ccbf45..a47a357fbd 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -27,11 +27,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") endif () endif () -if (APPLE) - if ("${MACOS_OPENSSL_ROOT_DIR}" STREQUAL "") - message(FATAL_ERROR "OpenSSL root should be set for MacOS") - endif() -endif() +find_package(OpenSSL REQUIRED) include(ExternalProject) include(CheckCXXCompilerFlag) @@ -204,7 +200,6 @@ ExternalProject_Add(poco https://github.com/pocoproject/poco/archive/refs/tags/poco-1.11.1-release.tar.gz URL_MD5 a96210b60a675c4a8183ad1f2099d549 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TP_OUTPUT} - -DOPENSSL_ROOT_DIR=${MACOS_OPENSSL_ROOT_DIR} -DENABLE_MONGODB=OFF -DENABLE_PDF=OFF -DENABLE_DATA=OFF @@ -230,7 +225,7 @@ ExternalProject_Add(fds URL_MD5 f7e0f86534f7b15c2a9b349f5cb45503 PATCH_COMMAND patch -p1 < ${TP_DIR}/fix_fds_for_macos.patch CMAKE_ARGS -DPOCO_INCLUDE=${TP_OUTPUT}/include - -DMACOS_OPENSSL_INCLUDE_DIR=${MACOS_OPENSSL_ROOT_DIR}/include + -DMACOS_OPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR} -DPOCO_LIB=${TP_OUTPUT}/lib -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}