Skip to content

Commit

Permalink
update cmake and path
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Nov 20, 2024
1 parent ab90c27 commit 069e61c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fetch-depth: 2

- name: Configure cmake
run: cmake -B${{github.workspace}}/build -DCOVERAGE_TEST=ON -DCINATRA_ENABLE_SSL=ON -DCMAKE_BUILD_TYPE=Debug
run: cmake -B${{github.workspace}}/build -DCOVERAGE_TEST=ON -DENABLE_SSL=ON -DCINATRA_ENABLE_SSL=ON -DCMAKE_BUILD_TYPE=Debug

- name: Build with ${{ matrix.compiler }}
run: cmake --build ${{github.workspace}}/build --config Debug
Expand Down
4 changes: 0 additions & 4 deletions cmake/develop.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ if (ENABLE_SSL)
message(STATUS "Use SSL")
endif()

if(ENABLE_GZIP)
add_definitions(-DCINATRA_ENABLE_GZIP)
endif()

if(ENABLE_CLIENT_SSL)
add_definitions(-DCINATRA_ENABLE_CLIENT_SSL)
endif()
Expand Down
7 changes: 6 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ if(ENABLE_METRIC_JSON)
)
endif()

find_package(ZLIB)
if (ZLIB_FOUND)
add_definitions(-DCINATRA_ENABLE_GZIP)
endif ()

option(SKIP_TIME_TEST "skip time tests" OFF)
if(SKIP_TIME_TEST)
message(STATUS "skip time tests")
Expand All @@ -27,7 +32,7 @@ endif()

add_test(NAME ${project_name} COMMAND test_cinatra)

if (ENABLE_GZIP)
if (ZLIB_FOUND)
target_link_libraries(${project_name} ${ZLIB_LIBRARIES})
endif()

Expand Down
8 changes: 4 additions & 4 deletions tests/test_cinatra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1484,8 +1484,8 @@ TEST_CASE("test coro_http_client multipart upload") {
#ifdef CINATRA_ENABLE_SSL
TEST_CASE("test ssl upload") {
coro_http_server server(1, 8091);
server.init_ssl("../openssl_files/server.crt", "../openssl_files/server.key",
"test");
server.init_ssl("../../include/cinatra/server.crt",
"../../include/cinatra/server.key", "test");
server.set_http_handler<cinatra::PUT>(
"/upload",
[](coro_http_request &req,
Expand Down Expand Up @@ -1556,8 +1556,8 @@ TEST_CASE("test ssl upload") {
}

cinatra::coro_http_server server1(1, 9002);
server1.init_ssl("../openssl_files/server.crt", "../openssl_files/server.key",
"test");
server1.init_ssl("../../include/cinatra/server.crt",
"../../include/cinatra/server.key", "test");
server1.set_http_handler<cinatra::GET, cinatra::PUT>(
"/chunked",
[](coro_http_request &req,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_coro_http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,8 @@ TEST_CASE("test websocket with different message size") {
TEST_CASE("test ssl server") {
cinatra::coro_http_server server(1, 9001);
std::cout << std::filesystem::current_path() << "\n";
server.init_ssl("../openssl_files/server.crt", "../openssl_files/server.key",
"test");
server.init_ssl("../../include/cinatra/server.crt",
"../../include/cinatra/server.key", "test");
server.set_http_handler<GET, POST>(
"/ssl", [](coro_http_request &req, coro_http_response &resp) {
resp.set_status_and_content(status_type::ok, "ssl");
Expand Down

0 comments on commit 069e61c

Please sign in to comment.