Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(thirdparty): find and use OpenSSL by CMake functions #1679

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/lint_and_test_cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Expand Down
11 changes: 5 additions & 6 deletions cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ set(MY_PROJ_LIBS
PocoFoundation
PocoNetSSL
PocoJSON
crypto
hashtable
hdfs
rocksdb)
Expand Down
2 changes: 0 additions & 2 deletions src/meta/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
2 changes: 1 addition & 1 deletion src/zookeeper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
2 changes: 0 additions & 2 deletions src/zookeeper/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ set(MY_PROJ_LIBS
zookeeper
hashtable
gtest
ssl
crypto
rocksdb)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
Expand Down
9 changes: 2 additions & 7 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down
Loading