Skip to content

Commit

Permalink
Merge pull request #17 from oblivioncth/dev
Browse files Browse the repository at this point in the history
Merge to master for v0.2.2
  • Loading branch information
oblivioncth committed Jul 24, 2023
2 parents f5dda21 + 128129c commit f15fd78
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 144 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build-qi-qmp-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [gcc, clang]
compiler: [clang]
lib_linkage: [shared, static]
include:
- os: ubuntu-20.04
compiler: gcc
c_comp: gcc-10
cxx_comp: g++-10
qt_comp: clang12
- os: ubuntu-20.04
compiler: clang
c_comp: clang-12
Expand All @@ -36,6 +31,13 @@ jobs:
c_comp: gcc-12
cxx_comp: g++-12
qt_comp: clang14
lib_linkage: shared
- os: ubuntu-22.04
compiler: gcc
c_comp: gcc-12
cxx_comp: g++-12
qt_comp: clang14
lib_linkage: static
- os: ubuntu-22.04
compiler: clang
c_comp: clang-14
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-pull-request-merge-reaction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Zip up release artifacts
shell: pwsh
run: |
$artifact_folders = Get-ChildItem -Directory -Path "${{ env.artifacts_path }}"
$artifact_folders = Get-ChildItem -Directory -Path "${{ env.artifacts_path }}" -Exclude "github-pages"
foreach($art_dir in $artifact_folders)
{
$name = $art_dir.name
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ cmake_minimum_required(VERSION 3.23.0...3.25.0)
# Project
# NOTE: DON'T USE TRAILING ZEROS IN VERSIONS
project(QI-QMP
VERSION 0.2.1
VERSION 0.2.2
LANGUAGES CXX
DESCRIPTION "Qt-based Interface for QEMU Machine Protocol"
)

# Get helper scripts
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FetchOBCMake.cmake)
fetch_ob_cmake("v0.3")
fetch_ob_cmake("v0.3.2")

# Initialize project according to standard rules
include(OB/Project)
Expand Down Expand Up @@ -53,7 +53,7 @@ set(QI_QMP_QX_COMPONENTS

include(OB/FetchQx)
ob_fetch_qx(
REF "v0.5"
REF "v0.5.1"
COMPONENTS
${QI_QMP_QX_COMPONENTS}
)
Expand Down
17 changes: 10 additions & 7 deletions doc/cmake/file_templates/mainpage.md.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QI-QMP {#mainpage}
==============
==================
QI-QMP is a minuscule C++ library, which utilizes Qt, that provides an interface to QEMU instances via the [QEMU Machine Protocol](https://wiki.qemu.org/Documentation/QMP). In other words, this library implements the client side of QMP for C++.

The interface takes the form of the library's sole class, `Qmpi`.
Expand All @@ -22,7 +22,7 @@ Packaging
----------
QI-QMP is provided as a CMake package composed of a single library and accompanying public header file.

#### Package Components:
### Package Components:

- `Qmpi` - The main library

Expand Down Expand Up @@ -95,6 +95,9 @@ QObject::connect(&iQemu, &Qmpi::responseReceived, [](QJsonValue data, std::any c
QObject::connect(&iQemu, &Qmpi::errorResponseReceived, [](QString errorClass, QString desc, std::any context){
qDebug() << "Command " << std::any_cast<QString>(context) << " threw the error: [" << errorClass << "] " << desc;
});

iQemu.connectToHost();
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Building From Source
Expand All @@ -107,27 +110,27 @@ If newer to working with Qt, it is easiest to build from within Qt creator as it

The CMake project is designed to be used with multi-configuration generators such as Visual Studio or Ninja Multi-Config (recommended), and may require some tweaking to work with single configuration generators.

#### CMake Options:
### CMake Options:

- `QI_QMP_DOCS` - Set to `ON` in order to generate the documentation target (OFF)
- `BUILD_SHARED_LIBS` - Build QI-QMP as a shared library instead of a static one (OFF)

#### CMake Targets:
### CMake Targets:

- `all` - Effectively an alias for the `qi_qmp_qmpi` target, also builds documentation if enabled
- `install` - Installs the build output into `CMAKE_INSTALL_PREFIX`
- `qi_qmp_docs` - Builds the QI-QMP documentation
- `qi_qmp_qmpi` - Builds the project's sole library

#### CMake Install Components:
### CMake Install Components:

- `qi_qmp` - Installs top-level files (README.md, CMake package configuration files, etc.)
- `qi_qmp_docs` - Installs documentation
- `qi_qmp_qmpi` - Installs the built library

If QI-QMP is configured as a sub-project, its install components are automatically removed from the default install component, as to not pollute the install directory of the top-level project. They can still be installed by directly referencing their component names as shown above.

#### Documentation:
### Documentation:
In order for the `qi_qmp_docs` target to be generated the CMake cache variable **QI_QMP_DOCS** must be set to *ON* when CMake is invoked:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake.exe (...) -D QI_QMP_DOCS=ON
Expand Down Expand Up @@ -174,7 +177,7 @@ The path for this documentation varies depending on how you obtained Qt, but is
# By default on Windows <QT_SOFTWARE> is C:\Program Files\Qt
# On Linux it is often /usr/local/Qt

#### Package
### Package
By default, the CMakeLists project configures CPack to create an artifact ZIP containing the binaries/archives for the library configurations, as well as documentation.

The following is the general build process required to successfully generate this package via a shadow build on Windows. Adjust the configuration as you see fit::
Expand Down
58 changes: 6 additions & 52 deletions lib/include/qi-qmp/qmpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,6 @@ class QI_QMP_QMPI_EXPORT Qmpi : public QObject
std::any context;
};

//-Class Variables-----------------------------------------------------------------------------------------------------------
private:
/*! @cond */
class JsonKeys
{
public:
static inline const QString GREETING = "QMP";
class Greeting
{
public:
static inline const QString VERSION = "version";
static inline const QString CAPABILITIES = "capabilities";
};

static inline const QString RETURN = "return";
static inline const QString ERROR = "error";
class Error
{
public:
static inline const QString CLASS = "class";
static inline const QString DESCRIPTION = "desc";
};

static inline const QString EVENT = "event";
class Event
{
public:
static inline const QString DATA = "data";
static inline const QString TIMESTAMP = "timestamp";
class Timestamp
{
public:
static inline const QString SECONDS = "seconds";
static inline const QString MICROSECONDS = "microseconds";
};
};

static inline const QString EXECUTE = "execute";
class Execute
{
public:
static inline const QString ARGUMENTS = "arguments";
};
};
/*! @endcond */
static inline const QString NEGOTIATION_COMMAND = "qmp_capabilities";

//-Instance Variables--------------------------------------------------------------------------------------------------------
private:
// Network
Expand Down Expand Up @@ -122,11 +75,11 @@ class QI_QMP_QMPI_EXPORT Qmpi : public QObject
void propagate();

// Message Processing
void processServerMessage(const QJsonObject& msg);
bool processGreetingMessage(const QJsonObject& greeting);
bool processReturnMessage(const QJsonObject& ret);
bool processErrorMessage(const QJsonObject& error);
bool processEventMessage(const QJsonObject& event);
void processServerMessage(const QJsonObject& jMsg);
bool processGreetingMessage(const QJsonObject& jGreeting);
bool processSuccessMessage(const QJsonObject& jSuccess);
bool processErrorMessage(const QJsonObject& jError);
bool processEventMessage(const QJsonObject& jEvent);

public:
// Info
Expand Down Expand Up @@ -170,6 +123,7 @@ private slots:
void communicationErrorOccurred(Qmpi::CommunicationError error); // Will disconnect after
void errorResponseReceived(QString errorClass, QString description, std::any context); // Will not disconnect after
void stateChanged(Qmpi::State state);
void commandQueueExhausted();
};

#endif // QMPI_H
Loading

0 comments on commit f15fd78

Please sign in to comment.