mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor/Create APT/DNF Repository (#1648)
This commit is contained in:
@@ -1,32 +1,94 @@
|
||||
# Define the current source locations
|
||||
|
||||
if(ENABLE_EFFECTENGINE)
|
||||
# Include the python directory. Also include the parent (which is for example /usr/include)
|
||||
# which may be required when it is not includes by the (cross-) compiler by default.
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
|
||||
add_compile_definitions(PYTHON_VERSION_MAJOR_MINOR=${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
|
||||
else()
|
||||
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
|
||||
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
|
||||
add_definitions(-DPYTHON_VERSION_MAJOR_MINOR=${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils)
|
||||
|
||||
FILE ( GLOB_RECURSE Utils_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
|
||||
|
||||
list(APPEND Utils_SOURCES "${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h")
|
||||
|
||||
if ( NOT ENABLE_PROFILER )
|
||||
LIST ( REMOVE_ITEM Utils_SOURCES ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
|
||||
if(ENABLE_PROFILER)
|
||||
set(PROFILER ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp)
|
||||
endif()
|
||||
|
||||
add_library(hyperion-utils
|
||||
${Utils_SOURCES}
|
||||
# Global defines/signal sharing
|
||||
${CMAKE_SOURCE_DIR}/include/utils/global_defines.h
|
||||
${CMAKE_SOURCE_DIR}/include/utils/GlobalSignals.h
|
||||
# JSON Schema Checker
|
||||
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonFactory.h
|
||||
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonUtils.h
|
||||
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonSchemaChecker.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp
|
||||
# Color ARGB/BGR/RGB/RGBA/RGBW etc. structures
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorArgb.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorArgb.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorBgr.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorBgr.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorRgb.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgb.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorRgba.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgba.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorRgbScalar.h
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorRgbw.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgbw.cpp
|
||||
# Image declaration
|
||||
${CMAKE_SOURCE_DIR}/include/utils/Image.h
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ImageData.h
|
||||
# Image resampler
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ImageResampler.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ImageResampler.cpp
|
||||
# Color transformation (saturation/luminance) of RGB colors
|
||||
${CMAKE_SOURCE_DIR}/include/utils/ColorSys.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorSys.cpp
|
||||
# Color transformation (saturation/value) of Okhsv colors
|
||||
${CMAKE_SOURCE_DIR}/include/utils/OkhsvTransform.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/OkhsvTransform.cpp
|
||||
# Signal handler
|
||||
${CMAKE_SOURCE_DIR}/include/utils/DefaultSignalHandler.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/DefaultSignalHandler.cpp
|
||||
# File utilities
|
||||
${CMAKE_SOURCE_DIR}/include/utils/FileUtils.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/FileUtils.cpp
|
||||
# JSON utilities
|
||||
${CMAKE_SOURCE_DIR}/include/utils/JsonUtils.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/JsonUtils.cpp
|
||||
# Logger
|
||||
${CMAKE_SOURCE_DIR}/include/utils/Logger.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/Logger.cpp
|
||||
# IP adress/Port checker
|
||||
${CMAKE_SOURCE_DIR}/include/utils/NetOrigin.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/NetOrigin.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/NetUtils.h
|
||||
# Process namespace (Hyperion restart)
|
||||
${CMAKE_SOURCE_DIR}/include/utils/Process.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/Process.cpp
|
||||
# Rgb single color adjustment/correction
|
||||
${CMAKE_SOURCE_DIR}/include/utils/RgbChannelAdjustment.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbChannelAdjustment.cpp
|
||||
# Color conversion/transformation
|
||||
${CMAKE_SOURCE_DIR}/include/utils/RgbToRgbw.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbToRgbw.cpp
|
||||
${CMAKE_SOURCE_DIR}/include/utils/RgbTransform.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbTransform.cpp
|
||||
# System info class
|
||||
${CMAKE_SOURCE_DIR}/include/utils/SysInfo.h
|
||||
${CMAKE_SOURCE_DIR}/libsrc/utils/SysInfo.cpp
|
||||
# Grabber pixel formats enumeration
|
||||
${CMAKE_SOURCE_DIR}/include/utils/PixelFormat.h
|
||||
# Grabber playing modes enumeration
|
||||
${CMAKE_SOURCE_DIR}/include/utils/VideoMode.h
|
||||
# Grabber video standards enumeration
|
||||
${CMAKE_SOURCE_DIR}/include/utils/VideoStandard.h
|
||||
# SettingsManager utilities
|
||||
${CMAKE_SOURCE_DIR}/include/utils/settings.h
|
||||
# Qt string utilities
|
||||
${CMAKE_SOURCE_DIR}/include/utils/QStringUtils.h
|
||||
# QThread sleep class
|
||||
${CMAKE_SOURCE_DIR}/include/utils/Sleep.h
|
||||
# Wait event loop function
|
||||
${CMAKE_SOURCE_DIR}/include/utils/WaitTime.h
|
||||
# Weak connection
|
||||
${CMAKE_SOURCE_DIR}/include/utils/WeakConnect.h
|
||||
# Semver namespace
|
||||
${CMAKE_SOURCE_DIR}/include/utils/version.hpp
|
||||
# Utility methods for Hyperion class
|
||||
${CMAKE_SOURCE_DIR}/include/utils/hyperion.h
|
||||
# Oklab color space
|
||||
${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h
|
||||
# Performance tester
|
||||
${PROFILER}
|
||||
)
|
||||
|
||||
target_link_libraries(hyperion-utils
|
||||
|
@@ -1,93 +1,92 @@
|
||||
#ifdef _WIN32
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <utils/Logger.h>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
namespace Process {
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <utils/Logger.h>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
namespace Process
|
||||
{
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
|
||||
{
|
||||
return QSTRING_CSTR(QString());
|
||||
}
|
||||
};
|
||||
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
|
||||
{
|
||||
return QSTRING_CSTR(QString());
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#include <utils/Process.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Process.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <csignal>
|
||||
#include <csignal>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
|
||||
namespace Process {
|
||||
|
||||
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
std::cout << std::endl
|
||||
<< " *******************************************" << std::endl
|
||||
<< " * hyperion will restart now *" << std::endl
|
||||
<< " *******************************************" << std::endl << std::endl;
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
|
||||
{
|
||||
char buffer[128];
|
||||
QString result;
|
||||
|
||||
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
|
||||
if (pipe)
|
||||
namespace Process
|
||||
{
|
||||
while (!feof(pipe.get()))
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
if (fgets(buffer, 128, pipe.get()) != nullptr)
|
||||
result += buffer;
|
||||
}
|
||||
}
|
||||
return QSTRING_CSTR(result);
|
||||
}
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
};
|
||||
std::cout << std::endl
|
||||
<< " *******************************************" << std::endl
|
||||
<< " * hyperion will restart now *" << std::endl
|
||||
<< " *******************************************" << std::endl << std::endl;
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
|
||||
{
|
||||
char buffer[128];
|
||||
QString result;
|
||||
|
||||
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
|
||||
if (pipe)
|
||||
{
|
||||
while (!feof(pipe.get()))
|
||||
{
|
||||
if (fgets(buffer, 128, pipe.get()) != nullptr)
|
||||
result += buffer;
|
||||
}
|
||||
}
|
||||
return QSTRING_CSTR(result);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user