Skip to content

Commit

Permalink
Fix GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Nov 18, 2023
1 parent 0e09e03 commit 2583cdd
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
steps:
- name: Install dependencies (GNU/Linux)
if: runner.os == 'linux'
run: sudo apt-get install --yes clang-format
run: sudo apt-get install --yes clang-format libcurl4-openssl-dev

# See https://github.com/actions/runner-images/issues/8659
- name: Workaround Clang issue (GNU/Linux)
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
cmake_minimum_required(VERSION 3.24)

# Needs to happen before the first call to "project()".
if(WIN32)
include(cmake/VCPKG.cmake)
endif()

project(hydra VERSION 0.0.1 LANGUAGES CXX
DESCRIPTION "A convenience networking library for modern C++")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
Expand Down
16 changes: 16 additions & 0 deletions cmake/VCPKG.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if(DEFINED ENV{VCPKG_ROOT})
set(VCPKG_CMAKE_TOOLCHAIN $ENV{VCPKG_ROOT})
cmake_path(APPEND VCPKG_CMAKE_TOOLCHAIN scripts buildsystems vcpkg.cmake)
else()
# Attempt to find vcpkg from standard locations
find_file(VCPKG_CMAKE_TOOLCHAIN
NAMES scripts/buildsystems/vcpkg.cmake
PATHS C:/src/vcpkg C:/dev/vcpkg C:/vcpkg
NO_DEFAULT_PATH)
endif()
if(EXISTS "${VCPKG_CMAKE_TOOLCHAIN}")
message(STATUS "Using VCPKG toolchain: ${VCPKG_CMAKE_TOOLCHAIN}")
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_CMAKE_TOOLCHAIN}" CACHE STRING "VCPKG toolchain file")
else()
message(FATAL_ERROR "Could NOT find VCPKG")
endif()
10 changes: 9 additions & 1 deletion src/http/include/sourcemeta/hydra/http_status.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#ifndef SOURCEMETA_HYDRA_HTTP_STATUS_H
#define SOURCEMETA_HYDRA_HTTP_STATUS_H

#if defined(__EMSCRIPTEN__) || defined(__Unikraft__)
#define SOURCEMETA_HYDRA_HTTP_EXPORT
#else
#include "http_export.h"
#endif

#include <cstdint> // std::uint16_t
#include <ostream> // std::ostream

Expand Down Expand Up @@ -81,7 +87,9 @@ enum class Status : std::uint16_t {
NETWORK_AUTHENTICATION_REQUIRED = 511
};

auto operator<<(std::ostream &stream, const Status value) -> std::ostream &;
auto SOURCEMETA_HYDRA_HTTP_EXPORT operator<<(std::ostream &stream,
const Status value)
-> std::ostream &;

} // namespace sourcemeta::hydra::http

Expand Down
5 changes: 0 additions & 5 deletions src/http/stream_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,6 @@ auto Stream::send() -> std::future<Status> {
handle_curl(curl_easy_setopt(this->internal->handle, CURLOPT_HTTPHEADER,
this->internal->headers));

// This tells libcurl the maximum time any cached certificate store it has in
// memory may be kept and reused for new connections.
handle_curl(curl_easy_setopt(this->internal->handle, CURLOPT_CA_CACHE_TIMEOUT,
604800L));

handle_curl(curl_easy_setopt(this->internal->handle, CURLOPT_WRITEFUNCTION,
callback_on_body));
handle_curl(
Expand Down
3 changes: 3 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dependencies": [ "curl" ]
}

0 comments on commit 2583cdd

Please sign in to comment.