From e90b71ce62b7744bb18ffc7823b1e895786ffb0a Mon Sep 17 00:00:00 2001 From: Lukas Senionis Date: Fri, 4 Oct 2024 04:42:16 +0300 Subject: [PATCH] fix(boost)!: migrate boost to 1.86 (#3256) --- .codeql-prebuild-cpp-Windows.sh | 1 + .github/workflows/CI.yml | 1 + cmake/dependencies/Boost_Sunshine.cmake | 8 ++++---- src/platform/common.h | 8 ++++---- src/platform/linux/misc.cpp | 4 ++-- src/platform/macos/misc.mm | 4 ++-- src/platform/windows/display_base.cpp | 4 ++-- src/platform/windows/misc.cpp | 4 ++-- src/process.cpp | 12 ++++++------ src/process.h | 12 ++++++------ src/system_tray.cpp | 2 +- 11 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.codeql-prebuild-cpp-Windows.sh b/.codeql-prebuild-cpp-Windows.sh index f4c7f54d..b0c7b4cc 100644 --- a/.codeql-prebuild-cpp-Windows.sh +++ b/.codeql-prebuild-cpp-Windows.sh @@ -7,6 +7,7 @@ pacman --noconfirm -Syu # install dependencies dependencies=( "git" + "mingw-w64-ucrt-x86_64-boost" "mingw-w64-ucrt-x86_64-cmake" "mingw-w64-ucrt-x86_64-cppwinrt" "mingw-w64-ucrt-x86_64-curl-winssl" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3c7b477a..57e3f3dc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1021,6 +1021,7 @@ jobs: update: true install: >- git + mingw-w64-ucrt-x86_64-boost mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-cppwinrt mingw-w64-ucrt-x86_64-curl-winssl diff --git a/cmake/dependencies/Boost_Sunshine.cmake b/cmake/dependencies/Boost_Sunshine.cmake index 6615a389..72ab5443 100644 --- a/cmake/dependencies/Boost_Sunshine.cmake +++ b/cmake/dependencies/Boost_Sunshine.cmake @@ -3,7 +3,7 @@ # include_guard(GLOBAL) -set(BOOST_VERSION 1.85) +set(BOOST_VERSION 1.86) set(BOOST_COMPONENTS filesystem locale @@ -15,7 +15,7 @@ if(BOOST_USE_STATIC) set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103 endif() -find_package(Boost ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS}) +find_package(Boost CONFIG ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS}) if(NOT Boost_FOUND) message(STATUS "Boost v${BOOST_VERSION}.x package not found in the system. Falling back to FetchContent.") include(FetchContent) @@ -39,9 +39,9 @@ if(NOT Boost_FOUND) set(BOOST_INCLUDE_LIBRARIES ${BOOST_COMPONENTS}) set(BOOST_URL - "https://github.com/boostorg/boost/releases/download/boost-1.85.0/boost-1.85.0-cmake.tar.xz") + "https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz") set(BOOST_HASH - "MD5=BADEA970931766604D4D5F8F4090B176") + "MD5=D02759931CEDC02ADED80402906C5EB6") if(CMAKE_VERSION VERSION_LESS "3.24.0") FetchContent_Declare( diff --git a/src/platform/common.h b/src/platform/common.h index 5c319dce..368bc733 100644 --- a/src/platform/common.h +++ b/src/platform/common.h @@ -47,13 +47,13 @@ namespace boost { namespace filesystem { class path; } - namespace process { + namespace process::inline v1 { class child; class group; template class basic_environment; typedef basic_environment environment; - } // namespace process + } // namespace process::inline v1 } // namespace boost #endif namespace video { @@ -597,8 +597,8 @@ namespace platf { bool needs_encoder_reenumeration(); - boost::process::child - run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::environment &env, FILE *file, std::error_code &ec, boost::process::group *group); + boost::process::v1::child + run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::v1::environment &env, FILE *file, std::error_code &ec, boost::process::v1::group *group); enum class thread_priority_e : int { low, ///< Low priority diff --git a/src/platform/linux/misc.cpp b/src/platform/linux/misc.cpp index 3ac9670a..b7a57c33 100644 --- a/src/platform/linux/misc.cpp +++ b/src/platform/linux/misc.cpp @@ -15,7 +15,7 @@ // lib includes #include #include -#include +#include #include #include #include @@ -269,7 +269,7 @@ namespace platf { auto working_dir = boost::filesystem::path(std::getenv("HOME")); std::string cmd = R"(xdg-open ")" + url + R"(")"; - boost::process::environment _env = boost::this_process::environment(); + boost::process::v1::environment _env = boost::this_process::environment(); std::error_code ec; auto child = run_command(false, false, cmd, working_dir, _env, nullptr, ec, nullptr); if (ec) { diff --git a/src/platform/macos/misc.mm b/src/platform/macos/misc.mm index 6eca7d2e..5366fdb2 100644 --- a/src/platform/macos/misc.mm +++ b/src/platform/macos/misc.mm @@ -23,7 +23,7 @@ #include "src/platform/common.h" #include -#include +#include using namespace std::literals; namespace fs = std::filesystem; @@ -197,7 +197,7 @@ namespace platf { boost::filesystem::path working_dir; std::string cmd = R"(open ")" + url + R"(")"; - boost::process::environment _env = boost::this_process::environment(); + boost::process::v1::environment _env = boost::this_process::environment(); std::error_code ec; auto child = run_command(false, false, cmd, working_dir, _env, nullptr, ec, nullptr); if (ec) { diff --git a/src/platform/windows/display_base.cpp b/src/platform/windows/display_base.cpp index 7058b77b..d4731c0e 100644 --- a/src/platform/windows/display_base.cpp +++ b/src/platform/windows/display_base.cpp @@ -7,9 +7,9 @@ #include #include -#include +#include -// We have to include boost/process.hpp before display.h due to WinSock.h, +// We have to include boost/process/v1.hpp before display.h due to WinSock.h, // but that prevents the definition of NTSTATUS so we must define it ourself. typedef long NTSTATUS; diff --git a/src/platform/windows/misc.cpp b/src/platform/windows/misc.cpp index 657807fa..21fe8b90 100644 --- a/src/platform/windows/misc.cpp +++ b/src/platform/windows/misc.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include // prevent clang format from "optimizing" the header include order @@ -1071,7 +1071,7 @@ namespace platf { */ void open_url(const std::string &url) { - boost::process::environment _env = boost::this_process::environment(); + boost::process::v1::environment _env = boost::this_process::environment(); auto working_dir = boost::filesystem::path(); std::error_code ec; diff --git a/src/process.cpp b/src/process.cpp index 6ab6b317..c6cf48b2 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -57,7 +57,7 @@ namespace proc { } void - terminate_process_group(boost::process::child &proc, boost::process::group &group, std::chrono::seconds exit_timeout) { + terminate_process_group(boost::process::v1::child &proc, boost::process::v1::group &group, std::chrono::seconds exit_timeout) { if (group.valid() && platf::process_group_running((std::uintptr_t) group.native_handle())) { if (exit_timeout.count() > 0) { // Request processes in the group to exit gracefully @@ -98,7 +98,7 @@ namespace proc { } boost::filesystem::path - find_working_directory(const std::string &cmd, boost::process::environment &env) { + find_working_directory(const std::string &cmd, boost::process::v1::environment &env) { // Parse the raw command string into parts to get the actual command portion #ifdef _WIN32 auto parts = boost::program_options::split_winmain(cmd); @@ -120,7 +120,7 @@ namespace proc { // If the cmd path is not an absolute path, resolve it using our PATH variable boost::filesystem::path cmd_path(parts.at(0)); if (!cmd_path.is_absolute()) { - cmd_path = boost::process::search_path(parts.at(0)); + cmd_path = boost::process::v1::search_path(parts.at(0)); if (cmd_path.empty()) { BOOST_LOG(error) << "Unable to find executable ["sv << parts.at(0) << "]. Is it in your PATH?"sv; return boost::filesystem::path(); @@ -301,8 +301,8 @@ namespace proc { std::error_code ec; placebo = false; terminate_process_group(_process, _process_group, _app.exit_timeout); - _process = boost::process::child(); - _process_group = boost::process::group(); + _process = boost::process::v1::child(); + _process_group = boost::process::v1::group(); for (; _app_prep_it != _app_prep_begin; --_app_prep_it) { auto &cmd = *(_app_prep_it - 1); @@ -403,7 +403,7 @@ namespace proc { } std::string - parse_env_val(boost::process::native_environment &env, const std::string_view &val_raw) { + parse_env_val(boost::process::v1::native_environment &env, const std::string_view &val_raw) { auto pos = std::begin(val_raw); auto dollar = std::find(pos, std::end(val_raw), '$'); diff --git a/src/process.h b/src/process.h index 29abaa88..2b0ba8b9 100644 --- a/src/process.h +++ b/src/process.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include "config.h" #include "platform/common.h" @@ -68,7 +68,7 @@ namespace proc { KITTY_DEFAULT_CONSTR_MOVE_THROW(proc_t) proc_t( - boost::process::environment &&env, + boost::process::v1::environment &&env, std::vector &&apps): _app_id(0), _env(std::move(env)), @@ -99,7 +99,7 @@ namespace proc { private: int _app_id; - boost::process::environment _env; + boost::process::v1::environment _env; std::vector _apps; ctx_t _app; std::chrono::steady_clock::time_point _app_launch_time; @@ -107,8 +107,8 @@ namespace proc { // If no command associated with _app_id, yet it's still running bool placebo {}; - boost::process::child _process; - boost::process::group _process_group; + boost::process::v1::child _process; + boost::process::v1::group _process_group; file_t _pipe; std::vector::const_iterator _app_prep_it; @@ -143,7 +143,7 @@ namespace proc { * @param exit_timeout The timeout to wait for the process group to gracefully exit. */ void - terminate_process_group(boost::process::child &proc, boost::process::group &group, std::chrono::seconds exit_timeout); + terminate_process_group(boost::process::v1::child &proc, boost::process::v1::group &group, std::chrono::seconds exit_timeout); extern proc_t proc; } // namespace proc diff --git a/src/system_tray.cpp b/src/system_tray.cpp index e949ff57..d742816d 100644 --- a/src/system_tray.cpp +++ b/src/system_tray.cpp @@ -33,7 +33,7 @@ // lib includes #include "tray/src/tray.h" #include - #include + #include // local includes #include "confighttp.h"