Make OpenSSL an optional dependency for tests

This commit is contained in:
Mohammad Nejati
2026-02-27 07:56:32 +00:00
committed by Mohammad Nejati
parent 9ad3b6831f
commit a74967f06a
8 changed files with 80 additions and 12 deletions
+42
View File
@@ -541,6 +541,48 @@ jobs:
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error
posix-cmake-test-no-openssl:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE ..
- name: Build tests
run: |
cd ../boost-root/__build__
cmake --build . --target tests -j $(nproc)
- name: Run tests
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error
windows-cmake-subdir:
strategy:
fail-fast: false
+14 -12
View File
@@ -8,19 +8,19 @@
# Official repository: https://github.com/boostorg/beast
#
if(BOOST_BEAST_IS_ROOT)
if (BOOST_BEAST_IS_ROOT)
set(EXCLUDE_TESTS_FROM_ALL)
else()
else ()
set(EXCLUDE_TESTS_FROM_ALL EXCLUDE_FROM_ALL)
endif()
endif ()
if(NOT TARGET tests)
if (NOT TARGET tests)
add_custom_target(tests ${EXCLUDE_TESTS_FROM_ALL})
set_property(TARGET tests PROPERTY FOLDER Dependencies)
endif()
endif ()
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(OpenSSL)
# boost_beast_lib_asio
add_library(boost_beast_lib_asio STATIC lib_asio.cpp)
@@ -35,12 +35,14 @@ target_compile_definitions(boost_beast_lib_asio PUBLIC
target_link_libraries(boost_beast_lib_asio PUBLIC Boost::asio Threads::Threads)
set_target_properties(boost_beast_lib_asio PROPERTIES FOLDER "static-libs")
# boost_beast_lib_asio_ssl
add_library(boost_beast_lib_asio_ssl STATIC lib_asio_ssl.cpp)
source_group("" FILES boost_beast_lib_asio_ssl.cpp)
target_link_libraries(boost_beast_lib_asio_ssl PUBLIC boost_beast_lib_asio)
target_link_libraries(boost_beast_lib_asio_ssl PUBLIC OpenSSL::SSL OpenSSL::Crypto)
set_target_properties(boost_beast_lib_asio_ssl PROPERTIES FOLDER "static-libs")
if (OPENSSL_FOUND)
# boost_beast_lib_asio_ssl
add_library(boost_beast_lib_asio_ssl STATIC lib_asio_ssl.cpp)
source_group("" FILES boost_beast_lib_asio_ssl.cpp)
target_link_libraries(boost_beast_lib_asio_ssl PUBLIC boost_beast_lib_asio)
target_link_libraries(boost_beast_lib_asio_ssl PUBLIC OpenSSL::SSL OpenSSL::Crypto)
set_target_properties(boost_beast_lib_asio_ssl PROPERTIES FOLDER "static-libs")
endif ()
# boost_beast_lib_beast
add_library(boost_beast_lib_beast STATIC lib_beast.cpp)
+4
View File
@@ -15,6 +15,10 @@ add_subdirectory(ssl)
add_subdirectory(websocket)
add_subdirectory(zlib)
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
add_executable(boost_beast_tests_self_contained
Jamfile
core.cpp
+4
View File
@@ -8,6 +8,10 @@
# Official repository: https://github.com/boostorg/beast
#
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
add_executable(boost_beast_tests__experimental
Jamfile
_test_detail_stream_state.cpp
+4
View File
@@ -7,6 +7,10 @@
# Official repository: https://github.com/boostorg/beast
#
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
add_executable (boost_beast_tests_ssl
Jamfile
ssl_stream.cpp)
+4
View File
@@ -8,6 +8,10 @@
# Official repository: https://github.com/boostorg/beast
#
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS Jamfile *.cpp *.hpp)
add_executable(boost_beast_tests_websocket ${PFILES})
+4
View File
@@ -8,6 +8,10 @@
# Official repository: https://github.com/boostorg/beast
#
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS Jamfile *.cpp *.ipp *.hpp)
add_executable(boost_beast_tests_doc ${PFILES})
+4
View File
@@ -8,6 +8,10 @@
# Official repository: https://github.com/boostorg/beast
#
if (NOT TARGET boost_beast_lib_asio_ssl)
return()
endif ()
add_executable(boost_beast_tests_example_common
Jamfile
root_certificates.cpp