Skip to content

Commit

Permalink
Merge fb370ab into 1b6a4f4
Browse files Browse the repository at this point in the history
  • Loading branch information
gittiver authored May 7, 2024
2 parents 1b6a4f4 + fb370ab commit d4a641b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
matrix:
os: [ ubuntu-latest,
windows-latest,
ubuntu-20.04,
macos-latest,
ubuntu-20.04,
macos-11
]
# ubuntu-18.04 does not work due to compile error on asio
Expand Down Expand Up @@ -55,21 +55,24 @@ jobs:
if [ "$RUNNER_OS" == "Windows" ]; then
cmake \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCROW_FEATURES="ssl;compression" \
-DCROW_ENABLE_SSL=ON \
-DCROW_ENABLE_COMPRESSION=ON \
-DCROW_AMALGAMATE=ON \
-DCROW_BUILD_TESTS=ON \
-B build
elif [ "$RUNNER_OS" == "macOS" ]; then
LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" \
cmake \
-DCROW_FEATURES="ssl;compression" \
-DCROW_ENABLE_SSL=ON \
-DCROW_ENABLE_COMPRESSION=ON \
-DCROW_AMALGAMATE=ON \
-DCROW_BUILD_TESTS=ON \
-B build
else
cmake \
-DCROW_FEATURES="ssl;compression" \
-DCROW_ENABLE_SSL=ON \
-DCROW_ENABLE_COMPRESSION=ON \
-DCROW_AMALGAMATE=ON \
-DCROW_BUILD_TESTS=ON \
-B build
Expand Down
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ option(CROW_INSTALL "Add install step for Crow" ON )
option(CROW_USE_BOOST "Use Boost.Asio for Crow" OFF)

# Possible values: ssl, compression
option(CROW_FEATURES "Enable features extending Crow's abilities" "")
#option(CROW_FEATURES "Enable features extending Crow's abilities" "")
option(CROW_ENABLE_SSL "Enable Crow's SSL feature" OFF)
option(CROW_ENABLE_COMPRESSION "Enable Crow's Compression feature" OFF)


#####################################
# Define Targets
Expand Down Expand Up @@ -80,13 +83,13 @@ endif()

target_compile_definitions(Crow INTERFACE "")

if("compression" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_COMPRESSION)
find_package(ZLIB REQUIRED)
target_link_libraries(Crow INTERFACE ZLIB::ZLIB)
target_compile_definitions(Crow INTERFACE CROW_ENABLE_COMPRESSION)
endif()

if("ssl" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_SSL)
find_package(OpenSSL REQUIRED)
target_link_libraries(Crow INTERFACE OpenSSL::SSL)
target_compile_definitions(Crow INTERFACE CROW_ENABLE_SSL)
Expand Down Expand Up @@ -119,11 +122,11 @@ if(CROW_BUILD_TESTS)
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest
)

if(NOT "compression" IN_LIST CROW_FEATURES)
message(STATUS "Compression tests are omitted. (Configure with CROW_FEATURES containing 'compression' to enable them)")
if(NOT CROW_ENABLE_COMPRESSION)
message(STATUS "Compression tests are omitted. (Configure with CROW_ENABLE_COMPRESSION to enable them)")
endif()
if(NOT "ssl" IN_LIST CROW_FEATURES)
message(STATUS "SSL tests are omitted. (Configure with CROW_FEATURES containing 'ssl' to enable them)")
if(NOT CROW_ENABLE_SSL)
message(STATUS "SSL tests are omitted. (Configure with CROW_ENABLE_SSL to enable them)")
else()
if(NOT MSVC)
add_test(
Expand Down
8 changes: 4 additions & 4 deletions cmake/CrowConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ if(NOT DEFINED CROW_FEATURES)
set(CROW_FEATURES ${CROW_INSTALLED_FEATURES})
endif()

if("compression" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_COMPRESSION)
find_dependency(ZLIB)
endif()

if("ssl" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_SSL)
find_dependency(OpenSSL)
endif()

Expand All @@ -38,12 +38,12 @@ endif()
list(REMOVE_ITEM _CROW_ILL "ZLIB::ZLIB" "OpenSSL::SSL")
list(REMOVE_ITEM _CROW_ICD "CROW_ENABLE_SSL" "CROW_ENABLE_COMPRESSION")

if("compression" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_COMPRESSION)
list(APPEND _CROW_ILL "ZLIB::ZLIB")
list(APPEND _CROW_ICD "CROW_ENABLE_COMPRESSION")
endif()

if("ssl" IN_LIST CROW_FEATURES)
if(CROW_ENABLE_SSL)
list(APPEND _CROW_ILL "OpenSSL::SSL")
list(APPEND _CROW_ICD "CROW_ENABLE_SSL")
endif()
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ add_subdirectory(template)
add_subdirectory(multi_file)
add_subdirectory(external_definition)
if(NOT MSVC)
if ("ssl" IN_LIST CROW_FEATURES)
if (CROW_ENABLE_SSL)
add_subdirectory(ssl)
endif()
endif()
Expand Down

0 comments on commit d4a641b

Please sign in to comment.