Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some build issue #21

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
**/node_modules
debian/tmp/usr
debian/.debhelper
debian/libocppi-dev
debian/libocppi0
debian/debhelper-build-stamp
debian/files
debian/libocppi-dev.debhelper.log
debian/libocppi-dev.substvars
debian/libocppi0.debhelper.log
debian/libocppi0.substvars
obj-x86_64-linux-gnu
/build*
/debian/.debhelper
/debian/debhelper-build-stamp
/debian/files
/debian/libocppi-dev
/debian/libocppi-dev.debhelper.log
/debian/libocppi-dev.substvars
/debian/libocppi0
/debian/libocppi0.debhelper.log
/debian/libocppi0.substvars
/debian/tmp/usr
/obj-x86_64-linux-gnu
node_modules/
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ CPMFindPackage(
EXCLUDE_FROM_ALL ON)

CPMFindPackage(
NAME Boost COMPONENTS headers
NAME Boost COMPONENTS process
VERSION 1.74.0
GITHUB_REPOSITORY "boostorg/boost"
GIT_TAG "boost-1.74.0"
GIT_TAG "boost-1.81.0"
GIT_SHALLOW ON
EXCLUDE_FROM_ALL ON)

if(NOT TARGET Boost::process)
add_library(Boost::process ALIAS Boost::headers)
endif()

CPMFindPackage(
NAME spdlog
VERSION 1.10.0
Expand Down
4 changes: 2 additions & 2 deletions cmake/PFL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function(pfl_init)
cmake_parse_arguments(PFL_INIT "" "INSTALL;ENABLE_TESTING;BUILD_EXAMPLES"
"EXTERNALS" ${ARGN})

message(STATUS "PFL: --==Version: v0.2.3==--")
message(STATUS "PFL: --==Version: v0.2.4==--")

set(PFL_ENABLE_TESTING
${PFL_INIT_ENABLE_TESTING}
Expand Down Expand Up @@ -100,7 +100,7 @@ function(pfl_add_libraries)
add_subdirectory(libs/${LIB})
endforeach()

if(PFL_INSTALL)
if(NOT PFL_INSTALL)
return()
endif()

Expand Down
2 changes: 1 addition & 1 deletion libs/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ pfl_add_library(
tl::expected
spdlog::spdlog
PRIVATE
Boost::headers)
Boost::process)
46 changes: 33 additions & 13 deletions libs/cli/examples/using-crun/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
#include <unistd.h>

#include <iostream>

#include "ocppi/cli/crun/Crun.hpp"
#include "ocppi/runtime/ContainerID.hpp"
#include "ocppi/runtime/Signal.hpp"
#include "ocppi/runtime/state/types/Generators.hpp"
#include "ocppi/runtime/state/types/State.hpp"
#include "spdlog/cfg/env.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/sinks/systemd_sink.h"
#include "spdlog/spdlog.h"
#include <stdio.h> // for FILE, stderr
#include <unistd.h> // for isatty

#include <exception> // for exception, rethrow_exce...
#include <iostream> // for operator<<, char_traits
#include <memory> // for shared_ptr, make_shared
#include <string> // for operator<<
#include <string_view> // for operator<<, string_view
#include <utility> // for move
#include <vector> // for vector

#include <bits/types/struct_FILE.h> // for _IO_FILE

#include "nlohmann/json.hpp" // for basic_json
#include "nlohmann/json_fwd.hpp" // for json
#include "ocppi/cli/CLI.hpp" // for CLI
#include "ocppi/cli/crun/Crun.hpp" // for Crun
#include "ocppi/runtime/ContainerID.hpp" // IWYU pragma: keep
#include "ocppi/runtime/Signal.hpp" // IWYU pragma: keep
#include "ocppi/runtime/state/types/Generators.hpp" // IWYU pragma: keep
#include "spdlog/common.h" // for trace
#include "spdlog/logger.h" // for logger
#include "spdlog/sinks/stdout_color_sinks.h" // for stderr_color_sink_mt
#include "spdlog/sinks/systemd_sink.h" // for systemd_sink_mt
#include "tl/expected.hpp" // for expected

namespace spdlog
{
namespace sinks
{
class sink;
} // namespace sinks
} // namespace spdlog

void printException(std::string_view msg, std::exception_ptr ptr) noexcept
try {
Expand Down
11 changes: 8 additions & 3 deletions libs/cli/include/ocppi/cli/CLI.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#pragma once

#include <experimental/propagate_const>
#include <filesystem> // for path
#include <memory> // for shared_ptr

#include "ocppi/runtime/Runtime.hpp"
#include "spdlog/logger.h"
#include "ocppi/runtime/Runtime.hpp" // for Runtime

namespace spdlog
{
class logger;
} // namespace spdlog

namespace ocppi::cli
{
Expand Down
35 changes: 34 additions & 1 deletion libs/cli/include/ocppi/cli/crun/Crun.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
#pragma once

#include "ocppi/cli/CLI.hpp"
#include <exception> // for exception_ptr
#include <filesystem> // for path
#include <memory> // for make_shared, shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector

#include "ocppi/cli/CLI.hpp" // for CLI
#include "tl/expected.hpp" // for expected

namespace ocppi
{
namespace runtime
{
class ContainerID;
class CreateOption;
class DeleteOption;
class ExecOption;
class KillOption;
class Signal;
class StartOption;
class StateOption;
namespace state
{
namespace types
{
struct State;
} // namespace types
} // namespace state
} // namespace runtime
} // namespace ocppi
namespace spdlog
{
class logger;
} // namespace spdlog

namespace ocppi::cli::crun
{
Expand Down
32 changes: 31 additions & 1 deletion libs/cli/include/ocppi/cli/runc/Runc.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
#pragma once

#include "ocppi/cli/CLI.hpp"
#include <exception> // for exception_ptr
#include <filesystem> // for path
#include <memory> // for unique_ptr
#include <vector> // for vector

#include <experimental/propagate_const> // for propagate_const

#include "ocppi/cli/CLI.hpp" // for CLI
#include "tl/expected.hpp" // for expected

namespace ocppi
{
namespace runtime
{
class ContainerID;
class CreateOption;
class DeleteOption;
class KillOption;
class Signal;
class StartOption;
class StateOption;
namespace state
{
namespace types
{
struct State;
} // namespace types
} // namespace state
} // namespace runtime
} // namespace ocppi

namespace ocppi::cli::runc
{
Expand Down Expand Up @@ -40,6 +69,7 @@ class Runc : public CLI {

protected:
struct impl;

friend struct impl;
std::experimental::propagate_const<std::unique_ptr<impl>> pImpl;
};
Expand Down
32 changes: 31 additions & 1 deletion libs/cli/include/ocppi/cli/youki/Youki.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
#pragma once

#include "ocppi/cli/CLI.hpp"
#include <exception> // for exception_ptr
#include <filesystem> // for path
#include <memory> // for unique_ptr
#include <vector> // for vector

#include <experimental/propagate_const> // for propagate_const

#include "ocppi/cli/CLI.hpp" // for CLI
#include "tl/expected.hpp" // for expected

namespace ocppi
{
namespace runtime
{
class ContainerID;
class CreateOption;
class DeleteOption;
class KillOption;
class Signal;
class StartOption;
class StateOption;
namespace state
{
namespace types
{
struct State;
} // namespace types
} // namespace state
} // namespace runtime
} // namespace ocppi

namespace ocppi::cli::youki
{
Expand Down Expand Up @@ -40,6 +69,7 @@ class Youki : public CLI {

protected:
struct impl;

friend struct impl;
std::experimental::propagate_const<std::unique_ptr<impl>> pImpl;
};
Expand Down
10 changes: 9 additions & 1 deletion libs/cli/src/ocppi/cli/CLI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include "ocppi/cli/CLI.hpp"

#include <utility>
#include <errno.h> // for ENOENT

#include <system_error> // for generic_category, system_error
#include <utility> // for move

namespace spdlog
{
class logger;
} // namespace spdlog

namespace ocppi::cli
{
Expand Down
44 changes: 31 additions & 13 deletions libs/cli/src/ocppi/cli/crun/Crun.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
#include "ocppi/cli/crun/Crun.hpp"

#include <iostream>
#include <system_error>

#include "boost/process/args.hpp"
#include "boost/process/io.hpp"
#include "boost/process/pipe.hpp"
#include "boost/process/system.hpp"
#include "ocppi/cli/CommandFailedError.hpp"
#include "ocppi/cli/format.hpp"
#include "ocppi/runtime/ContainerID.hpp"
#include "ocppi/runtime/Signal.hpp"
#include "ocppi/runtime/state/types/Generators.hpp"
#include "spdlog/spdlog.h"
#include <algorithm> // for max
#include <initializer_list> // for initializer_list
#include <list> // for list, operator!=
#include <map> // for operator!=, operator==
#include <type_traits> // for remove_reference<>::type
#include <utility> // for move

#include "boost/process/args.hpp" // for args, args_
#include "boost/process/io.hpp" // for std_out, std_out_
#include "boost/process/pipe.hpp" // for ipstream
#include "boost/process/system.hpp" // for system
#include "nlohmann/json.hpp" // for basic_json, basic_jso...
#include "nlohmann/json_fwd.hpp" // for json
#include "ocppi/cli/CommandFailedError.hpp" // for CommandFailedError
#include "ocppi/cli/format.hpp" // IWYU pragma: keep
#include "ocppi/runtime/ContainerID.hpp" // for ContainerID
#include "ocppi/runtime/CreateOption.hpp" // for CreateOption
#include "ocppi/runtime/DeleteOption.hpp" // for DeleteOption
#include "ocppi/runtime/ExecOption.hpp" // for ExecOption
#include "ocppi/runtime/KillOption.hpp" // for KillOption
#include "ocppi/runtime/Signal.hpp" // for Signal
#include "ocppi/runtime/StartOption.hpp" // for StartOption
#include "ocppi/runtime/StateOption.hpp" // for StateOption
#include "ocppi/runtime/state/types/Generators.hpp" // IWYU pragma: keep
#include "ocppi/runtime/state/types/State.hpp" // for State
#include "spdlog/spdlog.h" // for SPDLOG_LOGGER_DEBUG

namespace spdlog
{
class logger;
} // namespace spdlog

namespace ocppi::cli::crun
{
Expand Down
17 changes: 15 additions & 2 deletions libs/runtime/include/ocppi/runtime/Runtime.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#pragma once

#include "ocppi/runtime/ExecOption.hpp"
#include "ocppi/runtime/SpecRuntime.hpp"
#include <exception> // for exception_ptr
#include <string> // for string
#include <vector> // for vector

#include "ocppi/runtime/SpecRuntime.hpp" // for SpecRuntime
#include "tl/expected.hpp" // for expected

namespace ocppi
{
namespace runtime
{
class ContainerID;
class ExecOption;
} // namespace runtime
} // namespace ocppi

namespace ocppi::runtime
{
Expand Down
24 changes: 17 additions & 7 deletions libs/runtime/include/ocppi/runtime/config/ConfigLoader.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
#pragma once

#include <bitset> // for bitset, bitset<>::reference
#include <cstddef> // for size_t
#include <exception> // for exception
#include <exception> // for exception_ptr
#include <iosfwd> // for istream
#include <list>
#include <optional> // for optional

#include "ocppi/runtime/config/types/Config.hpp"
#include "tl/expected.hpp"
#include "tl/expected.hpp" // for expected

namespace ocppi
{
namespace runtime
{
namespace config
{
namespace types
{
struct Config;
} // namespace types
} // namespace config
} // namespace runtime
} // namespace ocppi

namespace ocppi::runtime::config
{

struct ConfigLoader {
[[nodiscard]]
auto load(std::istream &in) const noexcept
-> tl::expected<types::Config, std::exception_ptr>;
};
Expand Down
Loading
Loading