diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 0000000..af829ba --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,25 @@ +name: ci-windows + +on: [pull_request, workflow_dispatch] + +jobs: + ci-windows-2025: + name: windows-2025 + runs-on: windows-2025 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Dependencies + run: | + vcpkg install curl:x64-windows + vcpkg install libuv + - name: Build + run: | + mkdir Release + cd Release + cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake -DLIFT_BUILD_EXAMPLES=OFF .. + cmake --build . --config Release + - name: Test + run: | + cd Release + ctest --build-config Release -VV diff --git a/CMakeLists.txt b/CMakeLists.txt index 4358df3..5e9ed19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) project(lifthttp CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -9,12 +9,23 @@ option(LIFT_CODE_COVERAGE "Enable code coverage, tests must also be enabled. De option(LIFT_RUN_GITCONFIG "Set the githooks directory to auto format code and update the readme, Default=OFF." OFF) if(NOT DEFINED LIFT_USER_LINK_LIBRARIES) - set( - LIFT_USER_LINK_LIBRARIES - curl z uv pthread dl stdc++fs - CACHE STRING - "Override ${PROJECT_NAME} required link libraries, defaults to [curl z uv pthread dl stdc++fs]. If changed all defaults must be accounted for manually." - ) + if(MSVC) + find_package(libuv REQUIRED) + find_package(CURL REQUIRED) + set( + LIFT_USER_LINK_LIBRARIES + CURL::libcurl z libuv::uv pthread dl stdc++fs + CACHE STRING + "Override ${PROJECT_NAME} required link libraries, defaults to [CURL::libcurl z libuv::uv pthread dl stdc++fs]. If changed all defaults must be accounted for manually." + ) + else() + set( + LIFT_USER_LINK_LIBRARIES + curl z uv pthread dl stdc++fs + CACHE STRING + "Override ${PROJECT_NAME} required link libraries, defaults to [curl z uv pthread dl stdc++fs]. If changed all defaults must be accounted for manually." + ) + endif() endif() message("${PROJECT_NAME} LIFT_BUILD_EXAMPLES = ${LIFT_BUILD_EXAMPLES}") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6578524..ded941d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) project(liblifthttp_examples CXX) ### readme ### diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5997fbf..74facfb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) project(liblifthttp_tests) option(LIFT_LOCALHOST_TESTS "Define ON if running tests locally." OFF) diff --git a/test/test_resolve_host.cpp b/test/test_resolve_host.cpp index 9d9c98e..2b777b0 100644 --- a/test/test_resolve_host.cpp +++ b/test/test_resolve_host.cpp @@ -25,7 +25,13 @@ TEST_CASE("resolve_host client") lift::resolve_host{"testhostname", nginx_port, service_ip_address}, lift::resolve_host{"herpderp.com", nginx_port, service_ip_address}}; - lift::client client{lift::client::options{.resolve_hosts = std::move(rhosts)}}; + lift::client client{lift::client::options{ + std::nullopt, + std::nullopt, + std::nullopt, + std::move(rhosts), + nullptr, + }}; auto on_complete = [&](lift::request_ptr, lift::response response) -> void { diff --git a/test/test_timesup.cpp b/test/test_timesup.cpp index 2e62dd1..11ba61e 100644 --- a/test/test_timesup.cpp +++ b/test/test_timesup.cpp @@ -7,7 +7,13 @@ TEST_CASE("Timesup single request") { - lift::client client{lift::client::options{.connect_timeout = std::chrono::seconds{1}}}; + lift::client client{lift::client::options{ + std::nullopt, + std::nullopt, + std::chrono::seconds{1}, + std::nullopt, + nullptr + }}; auto r = std::make_unique( "http://www.reddit.com", // should be slow enough /shrug