Skip to content

Commit

Permalink
fix(boost)!: migrate boost to 1.86 (#3256)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogTheFrog authored Oct 4, 2024
1 parent 2c050d1 commit e90b71c
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 29 deletions.
1 change: 1 addition & 0 deletions .codeql-prebuild-cpp-Windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmake/dependencies/Boost_Sunshine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
include_guard(GLOBAL)

set(BOOST_VERSION 1.85)
set(BOOST_VERSION 1.86)
set(BOOST_COMPONENTS
filesystem
locale
Expand All @@ -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)
Expand All @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions src/platform/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ namespace boost {
namespace filesystem {
class path;
}
namespace process {
namespace process::inline v1 {
class child;
class group;
template <typename Char>
class basic_environment;
typedef basic_environment<char> environment;
} // namespace process
} // namespace process::inline v1
} // namespace boost
#endif
namespace video {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/platform/linux/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// lib includes
#include <arpa/inet.h>
#include <boost/asio/ip/address.hpp>
#include <boost/process.hpp>
#include <boost/process/v1.hpp>
#include <dlfcn.h>
#include <fcntl.h>
#include <ifaddrs.h>
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/platform/macos/misc.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "src/platform/common.h"

#include <boost/asio/ip/address.hpp>
#include <boost/process.hpp>
#include <boost/process/v1.hpp>

using namespace std::literals;
namespace fs = std::filesystem;
Expand Down Expand Up @@ -197,7 +197,7 @@
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/platform/windows/display_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <thread>

#include <boost/algorithm/string/join.hpp>
#include <boost/process.hpp>
#include <boost/process/v1.hpp>

// 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;

Expand Down
4 changes: 2 additions & 2 deletions src/platform/windows/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <boost/algorithm/string.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/process.hpp>
#include <boost/process/v1.hpp>
#include <boost/program_options/parsers.hpp>

// prevent clang format from "optimizing" the header include order
Expand Down Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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), '$');

Expand Down
12 changes: 6 additions & 6 deletions src/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <optional>
#include <unordered_map>

#include <boost/process.hpp>
#include <boost/process/v1.hpp>

#include "config.h"
#include "platform/common.h"
Expand Down Expand Up @@ -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<ctx_t> &&apps):
_app_id(0),
_env(std::move(env)),
Expand Down Expand Up @@ -99,16 +99,16 @@ namespace proc {
private:
int _app_id;

boost::process::environment _env;
boost::process::v1::environment _env;
std::vector<ctx_t> _apps;
ctx_t _app;
std::chrono::steady_clock::time_point _app_launch_time;

// 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<cmd_t>::const_iterator _app_prep_it;
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/system_tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// lib includes
#include "tray/src/tray.h"
#include <boost/filesystem.hpp>
#include <boost/process/environment.hpp>
#include <boost/process/v1/environment.hpp>

// local includes
#include "confighttp.h"
Expand Down

0 comments on commit e90b71c

Please sign in to comment.