Hyperion Light 2 (#1428)

* Hyperion Light - Have EffectEngine as component

* Hyperion light - Build switches for LED Devices (Serial, Network)

* Fix file uri generation

* Fix missing guard for Windows

* Fix file uri generation

* Update jsonschema and checkschema

* Allow to provide cmake build args to docker build
This commit is contained in:
LordGrey
2022-02-11 20:36:15 +01:00
committed by GitHub
parent 9e4b58d5c6
commit 5078688dc8
47 changed files with 1920 additions and 938 deletions

View File

@@ -26,18 +26,21 @@ endif()
add_subdirectory(leddevice)
add_subdirectory(utils)
add_subdirectory(effectengine)
add_subdirectory(grabber)
add_subdirectory(webserver)
add_subdirectory(db)
add_subdirectory(api)
add_subdirectory(python)
add_subdirectory(ssdp)
if(ENABLE_AVAHI)
add_subdirectory(bonjour)
endif()
if(ENABLE_EFFECTENGINE)
add_subdirectory(effectengine)
add_subdirectory(python)
endif()
if(ENABLE_CEC)
add_subdirectory(cec)
endif()

View File

@@ -224,6 +224,7 @@ void API::setVideoMode(VideoMode mode, hyperion::Components callerComp)
QMetaObject::invokeMethod(_hyperion, "setVideoMode", Qt::QueuedConnection, Q_ARG(VideoMode, mode));
}
#if defined(ENABLE_EFFECTENGINE)
bool API::setEffect(const EffectCmdData &dat, hyperion::Components callerComp)
{
int res;
@@ -238,6 +239,7 @@ bool API::setEffect(const EffectCmdData &dat, hyperion::Components callerComp)
return res >= 0;
}
#endif
void API::setSourceAutoSelect(bool state, hyperion::Components callerComp)
{
@@ -358,6 +360,7 @@ QString API::setInstanceName(quint8 index, const QString &name)
return NO_AUTH;
}
#if defined(ENABLE_EFFECTENGINE)
QString API::deleteEffect(const QString &name)
{
if (_adminAuthorized)
@@ -379,6 +382,7 @@ QString API::saveEffect(const QJsonObject &data)
}
return NO_AUTH;
}
#endif
bool API::saveSettings(const QJsonObject &data)
{

View File

@@ -185,12 +185,14 @@ proceed:
handleColorCommand(message, command, tan);
else if (command == "image")
handleImageCommand(message, command, tan);
#if defined(ENABLE_EFFECTENGINE)
else if (command == "effect")
handleEffectCommand(message, command, tan);
else if (command == "create-effect")
handleCreateEffectCommand(message, command, tan);
else if (command == "delete-effect")
handleDeleteEffectCommand(message, command, tan);
#endif
else if (command == "sysinfo")
handleSysInfoCommand(message, command, tan);
else if (command == "serverinfo")
@@ -275,6 +277,7 @@ void JsonAPI::handleImageCommand(const QJsonObject &message, const QString &comm
sendSuccessReply(command, tan);
}
#if defined(ENABLE_EFFECTENGINE)
void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &command, int tan)
{
emit forwardJsonMessage(message);
@@ -305,6 +308,7 @@ void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const QStrin
const QString res = API::deleteEffect(message["name"].toString());
res.isEmpty() ? sendSuccessReply(command, tan) : sendErrorReply(res, command, tan);
}
#endif
void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, int tan)
{
@@ -332,7 +336,9 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command,
system["domainName"] = data.domainName;
system["isUserAdmin"] = data.isUserAdmin;
system["qtVersion"] = data.qtVersion;
#if defined(ENABLE_EFFECTENGINE)
system["pyVersion"] = data.pyVersion;
#endif
info["system"] = system;
QJsonObject hyperion;
@@ -485,6 +491,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
info["adjustment"] = adjustmentArray;
#if defined(ENABLE_EFFECTENGINE)
// collect effect info
QJsonArray effects;
const std::list<EffectDefinition> &effectsDefinitions = _hyperion->getEffects();
@@ -499,6 +506,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
}
info["effects"] = effects;
#endif
// get available led devices
QJsonObject ledDevices;
@@ -596,6 +604,10 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
services.append("cec");
#endif
#if defined(ENABLE_EFFECTENGINE)
services.append("effectengine");
#endif
#if defined(ENABLE_FORWARDER)
services.append("forwarder");
#endif
@@ -701,6 +713,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
}
info["transform"] = transformArray;
#if defined(ENABLE_EFFECTENGINE)
// ACTIVE EFFECT INFO
QJsonArray activeEffects;
for (const ActiveEffectDefinition &activeEffectDefinition : _hyperion->getActiveEffects())
@@ -717,6 +730,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
}
}
info["activeEffects"] = activeEffects;
#endif
// ACTIVE STATIC LED COLOR
QJsonArray activeLedColors;
@@ -1036,6 +1050,7 @@ void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &
alldevices = LedDeviceWrapper::getLedDeviceSchemas();
properties.insert("alldevices", alldevices);
#if defined(ENABLE_EFFECTENGINE)
// collect all available effect schemas
QJsonArray schemaList;
const std::list<EffectSchema>& effectsSchemas = _hyperion->getEffectSchemas();
@@ -1056,6 +1071,7 @@ void JsonAPI::handleSchemaGetCommand(const QJsonObject &message, const QString &
schemaList.append(schema);
}
properties.insert("effectSchemas", schemaList);
#endif
schemaJson.insert("properties", properties);

View File

@@ -39,7 +39,11 @@ JsonCB::JsonCB(QObject* parent)
, _prioMuxer(nullptr)
{
_availableCommands << "components-update" << "sessions-update" << "priorities-update" << "imageToLedMapping-update"
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "leds-update" << "instance-update" << "token-update";
<< "adjustment-update" << "videomode-update" << "settings-update" << "leds-update" << "instance-update" << "token-update";
#if defined(ENABLE_EFFECTENGINE)
_availableCommands << "effects-update";
#endif
}
bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
@@ -102,6 +106,7 @@ bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
connect(_hyperion, &Hyperion::newVideoMode, this, &JsonCB::handleVideoModeChange, Qt::UniqueConnection);
}
#if defined(ENABLE_EFFECTENGINE)
if(type == "effects-update")
{
if(unsubscribe)
@@ -109,6 +114,7 @@ bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
else
connect(_hyperion, &Hyperion::effectListUpdated, this, &JsonCB::handleEffectListChange, Qt::UniqueConnection);
}
#endif
if(type == "settings-update")
{
@@ -367,6 +373,7 @@ void JsonCB::handleVideoModeChange(VideoMode mode)
doCallback("videomode-update", QVariant(data));
}
#if defined(ENABLE_EFFECTENGINE)
void JsonCB::handleEffectListChange()
{
QJsonArray effectList;
@@ -384,6 +391,7 @@ void JsonCB::handleEffectListChange()
effects["effects"] = effectList;
doCallback("effects-update", QVariant(effects));
}
#endif
void JsonCB::handleSettingsChange(settings::type type, const QJsonDocument& data)
{

View File

@@ -8,18 +8,17 @@
#include <effectengine/EffectModule.h>
#include <utils/Logger.h>
#include <hyperion/Hyperion.h>
#include <hyperion/PriorityMuxer.h>
// python utils
#include <python/PythonProgram.h>
const int Effect::ENDLESS = -1;
Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData)
: QThread()
, _hyperion(hyperion)
, _priority(priority)
, _timeout(timeout)
, _isEndless(timeout <= ENDLESS)
, _isEndless(timeout <= PriorityMuxer::ENDLESS)
, _script(script)
, _name(name)
, _args(args)

View File

@@ -22,7 +22,6 @@ target_link_libraries(hyperion
blackborder
hyperion-utils
leddevice
effectengine
database
${QT_LIBRARIES}
)
@@ -31,6 +30,10 @@ if(ENABLE_BOBLIGHT_SERVER)
target_link_libraries(hyperion boblightserver)
endif()
if(ENABLE_EFFECTENGINE)
target_link_libraries(hyperion effectengine)
endif()
if(ENABLE_FLATBUF_SERVER)
target_link_libraries(hyperion flatbufserver)
endif()

View File

@@ -28,8 +28,10 @@
#include <hyperion/MultiColorAdjustment.h>
#include "LinearColorSmoothing.h"
#if defined(ENABLE_EFFECTENGINE)
// effect engine includes
#include <effectengine/EffectEngine.h>
#endif
// settingsManagaer
#include <hyperion/SettingsManager.h>
@@ -56,7 +58,9 @@ Hyperion::Hyperion(quint8 instance, bool readonlyMode)
, _raw2ledAdjustment(hyperion::createLedColorsAdjustment(static_cast<int>(_ledString.leds().size()), getSetting(settings::COLOR).object()))
, _ledDeviceWrapper(nullptr)
, _deviceSmooth(nullptr)
#if defined(ENABLE_EFFECTENGINE)
, _effectEngine(nullptr)
#endif
#if defined(ENABLE_FORWARDER)
, _messageForwarder(nullptr)
#endif
@@ -148,10 +152,11 @@ void Hyperion::start()
}
#endif
#if defined(ENABLE_EFFECTENGINE)
// create the effect engine; needs to be initialized after smoothing!
_effectEngine = new EffectEngine(this);
connect(_effectEngine, &EffectEngine::effectListUpdated, this, &Hyperion::effectListUpdated);
#endif
// initial startup effect
hyperion::handleInitialEffect(this, getSetting(settings::FGEFFECT).object());
@@ -197,7 +202,11 @@ void Hyperion::freeObjects()
#endif
delete _captureCont;
#if defined(ENABLE_EFFECTENGINE)
delete _effectEngine;
#endif
delete _raw2ledAdjustment;
#if defined(ENABLE_FORWARDER)
@@ -233,8 +242,10 @@ void Hyperion::handleSettingsUpdate(settings::type type, const QJsonDocument& co
{
const QJsonArray leds = config.array();
#if defined(ENABLE_EFFECTENGINE)
// stop and cache all running effects, as effects depend heavily on LED-layout
_effectEngine->cacheRunningEffects();
#endif
// ledstring, img processor, muxer, ledGridSize (effect-engine image based effects), _ledBuffer and ByteOrder of ledstring
_ledString = hyperion::createLedString(leds, hyperion::createColorOrder(getSetting(settings::DEVICE).object()));
@@ -258,8 +269,10 @@ void Hyperion::handleSettingsUpdate(settings::type type, const QJsonDocument& co
delete _raw2ledAdjustment;
_raw2ledAdjustment = hyperion::createLedColorsAdjustment(static_cast<int>(_ledString.leds().size()), getSetting(settings::COLOR).object());
#if defined(ENABLE_EFFECTENGINE)
// start cached effects
_effectEngine->startCachedEffects();
#endif
}
else if(type == settings::DEVICE)
{
@@ -370,11 +383,13 @@ bool Hyperion::setInput(int priority, const std::vector<ColorRgb>& ledColors, in
{
if(_muxer->setInput(priority, ledColors, timeout_ms))
{
#if defined(ENABLE_EFFECTENGINE)
// clear effect if this call does not come from an effect
if(clearEffect)
{
_effectEngine->channelCleared(priority);
}
#endif
// if this priority is visible, update immediately
if(priority == _muxer->getCurrentPriority())
@@ -397,11 +412,13 @@ bool Hyperion::setInputImage(int priority, const Image<ColorRgb>& image, int64_t
if(_muxer->setInputImage(priority, image, timeout_ms))
{
#if defined(ENABLE_EFFECTENGINE)
// clear effect if this call does not come from an effect
if(clearEffect)
{
_effectEngine->channelCleared(priority);
}
#endif
// if this priority is visible, update immediately
if(priority == _muxer->getCurrentPriority())
@@ -421,11 +438,13 @@ bool Hyperion::setInputInactive(quint8 priority)
void Hyperion::setColor(int priority, const std::vector<ColorRgb> &ledColors, int timeout_ms, const QString &origin, bool clearEffects)
{
#if defined(ENABLE_EFFECTENGINE)
// clear effect if this call does not come from an effect
if (clearEffects)
{
_effectEngine->channelCleared(priority);
}
#endif
// create full led vector from single/multiple colors
size_t size = _ledString.leds().size();
@@ -478,15 +497,20 @@ bool Hyperion::clear(int priority, bool forceClearAll)
{
_muxer->clearAll(forceClearAll);
#if defined(ENABLE_EFFECTENGINE)
// send clearall signal to the effect engine
_effectEngine->allChannelsCleared();
#endif
isCleared = true;
}
else
{
#if defined(ENABLE_EFFECTENGINE)
// send clear signal to the effect engine
// (outside the check so the effect gets cleared even when the effect is not sending colors)
_effectEngine->channelCleared(priority);
#endif
if (_muxer->clearInput(priority))
{
@@ -516,6 +540,7 @@ Hyperion::InputInfo Hyperion::getPriorityInfo(int priority) const
return _muxer->getInputInfo(priority);
}
#if defined(ENABLE_EFFECTENGINE)
QString Hyperion::saveEffect(const QJsonObject& obj)
{
return _effectEngine->saveEffect(obj);
@@ -541,11 +566,6 @@ std::list<EffectSchema> Hyperion::getEffectSchemas() const
return _effectEngine->getEffectSchemas();
}
QJsonObject Hyperion::getQJsonConfig() const
{
return _settingsManager->getSettings();
}
int Hyperion::setEffect(const QString &effectName, int priority, int timeout, const QString & origin)
{
return _effectEngine->runEffect(effectName, priority, timeout, origin);
@@ -555,6 +575,12 @@ int Hyperion::setEffect(const QString &effectName, const QJsonObject &args, int
{
return _effectEngine->runEffect(effectName, args, priority, timeout, pythonScript, origin, 0, imageData);
}
#endif
QJsonObject Hyperion::getQJsonConfig() const
{
return _settingsManager->getSettings();
}
void Hyperion::setLedMappingType(int mappingType)
{

View File

@@ -17,6 +17,7 @@ const int PriorityMuxer::BG_PRIORITY = 254;
const int PriorityMuxer::MANUAL_SELECTED_PRIORITY = 256;
const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max();
const int PriorityMuxer::TIMEOUT_NOT_ACTIVE_PRIO = -100;
const int PriorityMuxer::ENDLESS = -1;
PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
: QObject(parent)
@@ -37,7 +38,7 @@ PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
// init lowest priority info
_lowestPriorityInfo.priority = PriorityMuxer::LOWEST_PRIORITY;
_lowestPriorityInfo.timeoutTime_ms = -1;
_lowestPriorityInfo.timeoutTime_ms = PriorityMuxer::ENDLESS;
_lowestPriorityInfo.ledColors = std::vector<ColorRgb>(ledCount, {0, 0, 0});
_lowestPriorityInfo.componentId = hyperion::COMP_COLOR;
_lowestPriorityInfo.origin = "System";
@@ -45,7 +46,7 @@ PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
_activeInputs[PriorityMuxer::LOWEST_PRIORITY] = _lowestPriorityInfo;
// adapt to 1s interval for COLOR and EFFECT timeouts > -1
// adapt to 1s interval for COLOR and EFFECT timeouts > -1 (endless)
connect(_timer, &QTimer::timeout, this, &PriorityMuxer::timeTrigger);
_timer->setSingleShot(true);
_blockTimer->setSingleShot(true);

View File

@@ -3,7 +3,13 @@
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network SerialPort REQUIRED)
if ( ENABLE_DEV_NETWORK )
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)
endif()
if ( ENABLE_DEV_SERIAL )
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS SerialPort REQUIRED)
endif()
include_directories(
dev_hid
@@ -19,10 +25,6 @@ FILE ( GLOB Leddevice_SOURCES
"${CURRENT_HEADER_DIR}/*.h"
"${CURRENT_SOURCE_DIR}/*.h"
"${CURRENT_SOURCE_DIR}/*.cpp"
"${CURRENT_SOURCE_DIR}/dev_serial/*.h"
"${CURRENT_SOURCE_DIR}/dev_serial/*.cpp"
"${CURRENT_SOURCE_DIR}/dev_net/*.h"
"${CURRENT_SOURCE_DIR}/dev_net/*.cpp"
"${CURRENT_SOURCE_DIR}/dev_other/*.h"
"${CURRENT_SOURCE_DIR}/dev_other/*.cpp"
)
@@ -32,7 +34,23 @@ if ( ENABLE_OSX OR WIN32 )
list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.cpp")
endif()
if ( ENABLE_USB_HID )
if ( ENABLE_DEV_NETWORK )
FILE ( GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp")
endif()
if ( ENABLE_DEV_SERIAL )
FILE ( GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
endif()
if ( ENABLE_DEV_SPI )
FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
endif()
if ( ENABLE_DEV_TINKERFORGE )
FILE ( GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
endif()
if ( ENABLE_DEV_USB_HID )
find_package(libusb-1.0 REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/include/hidapi
@@ -41,15 +59,7 @@ if ( ENABLE_USB_HID )
FILE ( GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp")
endif()
if ( ENABLE_SPIDEV )
FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
endif()
if ( ENABLE_TINKERFORGE )
FILE ( GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
endif()
if ( ENABLE_WS281XPWM )
if ( ENABLE_DEV_WS281XPWM )
include_directories(../../dependencies/external/rpi_ws281x)
FILE ( GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp")
endif()
@@ -59,10 +69,12 @@ set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc )
SET( Leddevice_SOURCES
${Leddevice_SOURCES}
${LedDevice_RESOURCES}
${Leddevice_USB_HID_SOURCES}
${Leddevice_TINKER_SOURCES}
${Leddevice_SPI_SOURCES}
${Leddevice_NETWORK_SOURCES}
${Leddevice_PWM_SOURCES}
${Leddevice_SERIAL_SOURCES}
${Leddevice_SPI_SOURCES}
${Leddevice_TINKER_SOURCES}
${Leddevice_USB_HID_SOURCES}
)
# auto generate header file that include all available leddevice headers
@@ -86,24 +98,42 @@ target_link_libraries(leddevice
hyperion
hyperion-utils
${CMAKE_THREAD_LIBS_INIT}
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::SerialPort
ssdp
)
if(WIN32)
target_link_libraries(leddevice ws2_32)
endif()
if(ENABLE_TINKERFORGE)
if(ENABLE_DEV_NETWORK)
target_link_libraries(leddevice Qt${QT_VERSION_MAJOR}::Network ssdp)
if (NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
if (MBEDTLS_LIBRARIES)
include_directories(${MBEDTLS_INCLUDE_DIR})
target_link_libraries(leddevice ${MBEDTLS_LIBRARIES})
target_include_directories(leddevice PRIVATE ${MBEDTLS_INCLUDE_DIR})
endif (MBEDTLS_LIBRARIES)
endif ()
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
if (MBEDTLS_MAJOR EQUAL "3")
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
endif()
endif()
if(ENABLE_DEV_SERIAL)
target_link_libraries(leddevice Qt${QT_VERSION_MAJOR}::SerialPort)
endif()
if(ENABLE_DEV_TINKERFORGE)
target_link_libraries(leddevice tinkerforge)
endif()
if(ENABLE_WS281XPWM)
if(ENABLE_DEV_WS281XPWM)
target_link_libraries(leddevice ws281x)
endif()
if (ENABLE_USB_HID)
if (ENABLE_DEV_USB_HID)
if(APPLE)
target_link_libraries(leddevice ${LIBUSB_1_LIBRARIES} hidapi-mac)
else()
@@ -111,15 +141,3 @@ if (ENABLE_USB_HID)
endif()
endif()
if (NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
if (MBEDTLS_LIBRARIES)
include_directories(${MBEDTLS_INCLUDE_DIR})
target_link_libraries(leddevice ${MBEDTLS_LIBRARIES})
target_include_directories(leddevice PRIVATE ${MBEDTLS_INCLUDE_DIR})
endif (MBEDTLS_LIBRARIES)
endif ()
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
if (MBEDTLS_MAJOR EQUAL "3")
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
endif()

View File

@@ -1,15 +1,17 @@
# Define the current source locations
# 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})
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)
@@ -27,8 +29,11 @@ add_library(hyperion-utils
target_link_libraries(hyperion-utils
hyperion
python
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
)
if(ENABLE_EFFECTENGINE)
target_link_libraries(hyperion-utils python)
endif()

View File

@@ -1,5 +1,9 @@
#include "HyperionConfig.h"
#if defined(ENABLE_EFFECTENGINE)
// Python includes
#include <Python.h>
#endif
#include "utils/SysInfo.h"
#include "utils/FileUtils.h"
@@ -10,6 +14,9 @@
#include <QRegularExpressionMatch>
#include <iostream>
#ifndef _WIN32
#include <unistd.h>
#endif
#ifdef _WIN32
#include <shlobj_core.h>
@@ -32,7 +39,9 @@ SysInfo::SysInfo()
_sysinfo.isUserAdmin = isUserAdmin();
getCPUInfo();
_sysinfo.qtVersion = QT_VERSION_STR;
#if defined(ENABLE_EFFECTENGINE)
_sysinfo.pyVersion = PY_VERSION;
#endif
}
SysInfo::HyperionSysInfo SysInfo::get()