From 5078688dc8b1227c86a1a3fe45b7e7b8f5a3a067 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:36:15 +0100 Subject: [PATCH] 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 --- CMakeLists.txt | 176 ++-- HyperionConfig.h.in | 21 +- assets/webconfig/content/remote.html | 201 ++-- assets/webconfig/index.html | 2 +- assets/webconfig/js/content_effects.js | 233 +++-- assets/webconfig/js/content_index.js | 13 +- assets/webconfig/js/content_remote.js | 18 +- assets/webconfig/js/ui_utils.js | 5 +- bin/create_all_releases.sh | 20 +- bin/scripts/docker-compile.sh | 80 +- cmake/Dependencies.cmake | 180 ++-- dependencies/CMakeLists.txt | 245 ++--- include/api/API.h | 4 + include/api/JsonAPI.h | 2 + include/api/JsonCB.h | 2 + include/effectengine/Effect.h | 2 - include/effectengine/EffectEngine.h | 6 +- include/hyperion/BGEffectHandler.h | 8 +- include/hyperion/Hyperion.h | 22 +- include/hyperion/PriorityMuxer.h | 8 +- include/utils/SysInfo.h | 4 + include/utils/hyperion.h | 10 +- libsrc/CMakeLists.txt | 9 +- libsrc/api/API.cpp | 4 + libsrc/api/JsonAPI.cpp | 16 + libsrc/api/JsonCB.cpp | 10 +- libsrc/effectengine/Effect.cpp | 5 +- libsrc/hyperion/CMakeLists.txt | 5 +- libsrc/hyperion/Hyperion.cpp | 38 +- libsrc/hyperion/PriorityMuxer.cpp | 5 +- libsrc/leddevice/CMakeLists.txt | 90 +- libsrc/utils/CMakeLists.txt | 27 +- libsrc/utils/SysInfo.cpp | 9 + src/hyperion-remote/CMakeLists.txt | 5 +- src/hyperion-remote/JsonConnection.cpp | 4 + src/hyperion-remote/JsonConnection.h | 2 + src/hyperion-remote/hyperion-remote.cpp | 11 +- src/hyperiond/CMakeLists.txt | 31 +- src/hyperiond/hyperiond.cpp | 8 + src/hyperiond/hyperiond.h | 4 + src/hyperiond/main.cpp | 4 + src/hyperiond/systray.cpp | 15 +- src/hyperiond/systray.h | 4 + test/CMakeLists.txt | 9 +- test/jsonchecks/COPYING | 2 +- test/jsonchecks/checkschema.py | 13 +- test/jsonchecks/jsonschema.py | 1266 +++++++++++++++++------ 47 files changed, 1920 insertions(+), 938 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ed9447..51cf35ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,16 +38,6 @@ if ( CCACHE_FOUND ) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) -if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") - set(Python_ADDITIONAL_VERSIONS 3.5) - find_package(PythonInterp 3.5 REQUIRED) -else() - find_package(Python3 3.5 COMPONENTS Interpreter Development REQUIRED) - if(Python3_FOUND) - set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) - endif() -endif() - # Set build variables # Grabber SET ( DEFAULT_AMLOGIC OFF ) @@ -71,43 +61,47 @@ SET ( DEFAULT_FORWARDER ON ) SET ( DEFAULT_FLATBUF_CONNECT ON ) # LED-Devices -SET ( DEFAULT_SPIDEV OFF ) -SET ( DEFAULT_TINKERFORGE OFF ) -SET ( DEFAULT_USB_HID OFF ) -SET ( DEFAULT_WS281XPWM OFF ) +SET ( DEFAULT_DEV_NETWORK ON ) +SET ( DEFAULT_DEV_SERIAL ON ) +SET ( DEFAULT_DEV_SPI OFF ) +SET ( DEFAULT_DEV_TINKERFORGE OFF ) +SET ( DEFAULT_DEV_USB_HID OFF ) +SET ( DEFAULT_DEV_WS281XPWM OFF ) # Services SET ( DEFAULT_AVAHI ON ) +SET ( DEFAULT_EFFECTENGINE ON ) SET ( DEFAULT_EXPERIMENTAL OFF ) # Build -SET ( DEFAULT_TESTS OFF ) +SET ( DEFAULT_JSONCHECKS ON ) SET ( DEFAULT_DEPLOY_DEPENDENCIES ON ) SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF ) SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF ) +SET ( DEFAULT_TESTS OFF ) # Build Hyperion with a reduced set of functionality, overwrites other default values SET ( DEFAULT_HYPERION_LIGHT OFF ) IF ( ${CMAKE_SYSTEM} MATCHES "Linux" ) - SET ( DEFAULT_FB ON ) - SET ( DEFAULT_V4L2 ON ) - SET ( DEFAULT_SPIDEV ON ) - SET ( DEFAULT_TINKERFORGE ON ) - SET ( DEFAULT_USB_HID ON ) - SET ( DEFAULT_CEC ON ) + SET ( DEFAULT_FB ON ) + SET ( DEFAULT_V4L2 ON ) + SET ( DEFAULT_DEV_SPIV ON ) + SET ( DEFAULT_DEV_TINKERFORGE ON ) + SET ( DEFAULT_DEV_USB_HID ON ) + SET ( DEFAULT_CEC ON ) ELSEIF ( WIN32 ) SET ( DEFAULT_DX ON ) SET ( DEFAULT_MF ON ) ELSE() - SET ( DEFAULT_FB OFF ) - SET ( DEFAULT_V4L2 OFF ) - SET ( DEFAULT_SPIDEV OFF ) - SET ( DEFAULT_TINKERFORGE OFF ) - SET ( DEFAULT_USB_HID OFF ) - SET ( DEFAULT_CEC OFF ) + SET ( DEFAULT_FB OFF ) + SET ( DEFAULT_V4L2 OFF ) + SET ( DEFAULT_DEV_SPI OFF ) + SET ( DEFAULT_DEV_TINKERFORGE OFF ) + SET ( DEFAULT_DEV_USB_HID OFF ) + SET ( DEFAULT_CEC OFF ) ENDIF() if ( NOT DEFINED PLATFORM ) @@ -158,10 +152,10 @@ if ( "${PLATFORM}" MATCHES "osx" ) include_directories("/opt/X11/include/") SET ( DEFAULT_OSX ON ) - SET ( DEFAULT_USB_HID ON ) + SET ( DEFAULT_DEV_USB_HID ON ) elseif ( "${PLATFORM}" MATCHES "rpi" ) SET ( DEFAULT_DISPMANX ON ) - SET ( DEFAULT_WS281XPWM ON ) + SET ( DEFAULT_DEV_WS281XPWM ON ) elseif ( "${PLATFORM}" STREQUAL "amlogic" ) SET ( DEFAULT_AMLOGIC ON ) elseif ( "${PLATFORM}" STREQUAL "amlogic-dev" ) @@ -176,7 +170,7 @@ elseif ( "${PLATFORM}" MATCHES "x11" ) SET ( DEFAULT_XCB ON ) if ( "${PLATFORM}" STREQUAL "x11-dev" ) SET ( DEFAULT_AMLOGIC ON) - SET ( DEFAULT_WS281XPWM ON ) + SET ( DEFAULT_DEV_WS281XPWM ON ) endif() elseif ( "${PLATFORM}" STREQUAL "imx6" ) SET ( DEFAULT_FB ON ) @@ -221,6 +215,9 @@ if (HYPERION_LIGHT) # Disable Output Connectors SET ( DEFAULT_FORWARDER OFF ) SET ( DEFAULT_FLATBUF_CONNECT OFF ) + + # Disable Services + SET ( DEFAULT_EFFECTENGINE OFF ) endif() message(STATUS "Grabber options:") @@ -298,23 +295,32 @@ removeIndent() message(STATUS "LED-Device options:") addIndent(" - ") -option(ENABLE_SPIDEV "Enable the SPIDEV device" ${DEFAULT_SPIDEV} ) -message(STATUS "ENABLE_SPIDEV = ${ENABLE_SPIDEV}") +option(ENABLE_DEV_NETWORK "Enable the Network devices" ${DEFAULT_DEV_NETWORK} ) +message(STATUS "DEFAULT_DEV_NETWORK = ${DEFAULT_DEV_NETWORK}") -option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ${DEFAULT_TINKERFORGE}) -message(STATUS "ENABLE_TINKERFORGE = ${ENABLE_TINKERFORGE}") +option(ENABLE_DEV_SERIAL "Enable the Serial devices" ${DEFAULT_DEV_SERIAL} ) +message(STATUS "DEFAULT_DEV_SERIAL = ${DEFAULT_DEV_SERIAL}") -option(ENABLE_USB_HID "Enable the libusb and hid devices" ${DEFAULT_USB_HID} ) -message(STATUS "ENABLE_USB_HID = ${ENABLE_USB_HID}") +option(ENABLE_DEV_SPI "Enable the SPI device" ${DEFAULT_DEV_SPI} ) +message(STATUS "ENABLE_DEV_SPI = ${ENABLE_DEV_SPI}") -option(ENABLE_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_WS281XPWM} ) -message(STATUS "ENABLE_WS281XPWM = ${ENABLE_WS281XPWM}") +option(ENABLE_DEV_TINKERFORGE "Enable the TINKERFORGE device" ${DEFAULT_DEV_TINKERFORGE}) +message(STATUS "ENABLE_DEV_TINKERFORGE = ${ENABLE_DEV_TINKERFORGE}") + +option(ENABLE_DEV_USB_HID "Enable the libusb and hid devices" ${DEFAULT_DEV_USB_HID} ) +message(STATUS "ENABLE_DEV_USB_HID = ${ENABLE_DEV_USB_HID}") + +option(ENABLE_DEV_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_DEV_WS281XPWM} ) +message(STATUS "ENABLE_DEV_WS281XPWM = ${ENABLE_DEV_WS281XPWM}") removeIndent() message(STATUS "Services options:") addIndent(" - ") +option(ENABLE_EFFECTENGINE "Enable Effect-Engine" ${DEFAULT_EFFECTENGINE}) +message(STATUS "ENABLE_EFFECTENGINE = " ${ENABLE_EFFECTENGINE}) + option(ENABLE_AVAHI "Enable Zeroconf" ${DEFAULT_AVAHI}) message(STATUS "ENABLE_AVAHI = " ${ENABLE_AVAHI}) @@ -326,11 +332,8 @@ removeIndent() message(STATUS "Build options:") addIndent(" - ") -option(ENABLE_TESTS "Compile additional test applications" ${DEFAULT_TESTS}) -message(STATUS "ENABLE_TESTS = ${ENABLE_TESTS}") - -option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF) -message(STATUS "ENABLE_PROFILER = ${ENABLE_PROFILER}") +option(ENABLE_JSONCHECKS "Validate json schema files" ${DEFAULT_JSONCHECKS}) +message(STATUS "ENABLE_JSONCHECKS = ${ENABLE_JSONCHECKS}") option(ENABLE_DEPLOY_DEPENDENCIES "Deploy with dependencies" ${DEFAULT_DEPLOY_DEPENDENCIES}) message(STATUS "ENABLE_DEPLOY_DEPENDENCIES = ${ENABLE_DEPLOY_DEPENDENCIES}") @@ -342,6 +345,12 @@ message(STATUS "DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS = ${DEFAULT_USE_SYSTEM_FLATB message(STATUS "DEFAULT_USE_SYSTEM_MBEDTLS_LIBS = ${DEFAULT_USE_SYSTEM_MBEDTLS_LIBS}") message(STATUS "DEFAULT_USE_SYSTEM_PROTO_LIBS = ${DEFAULT_USE_SYSTEM_PROTO_LIBS}") +option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF) +message(STATUS "ENABLE_PROFILER = ${ENABLE_PROFILER}") + +option(ENABLE_TESTS "Compile additional test applications" ${DEFAULT_TESTS}) +message(STATUS "ENABLE_TESTS = ${ENABLE_TESTS}") + removeIndent() SET ( FLATBUFFERS_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/flatbuf ) @@ -350,40 +359,53 @@ SET ( FLATBUFFERS_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/flatbuf ) SET ( PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto ) SET ( PROTOBUF_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/proto ) -# check all json files -FILE ( GLOB_RECURSE HYPERION_SCHEMAS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/libsrc/*schema*.json ) -SET( JSON_FILES ${CMAKE_BINARY_DIR}/config/hyperion.config.json.default ${HYPERION_SCHEMAS}) +if(ENABLE_JSONCHECKS OR ENABLE_EFFECTENGINE) + if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") + set(Python_ADDITIONAL_VERSIONS 3.5) + find_package(PythonInterp 3.5 REQUIRED) + else() + find_package(Python3 3.5 COMPONENTS Interpreter Development REQUIRED) + if(Python3_FOUND) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + endif() + endif() +endif() -EXECUTE_PROCESS ( - COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkjson.py ${JSON_FILES} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE CHECK_JSON_FAILED -) -IF ( ${CHECK_JSON_FAILED} ) - MESSAGE (FATAL_ERROR "check of json files failed" ) -ENDIF () +if(ENABLE_JSONCHECKS) + # check all json files + FILE ( GLOB_RECURSE HYPERION_SCHEMAS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/libsrc/*schema*.json ) + SET( JSON_FILES ${CMAKE_BINARY_DIR}/config/hyperion.config.json.default ${HYPERION_SCHEMAS}) -EXECUTE_PROCESS ( - COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkeffects.py effects effects/schema - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE CHECK_EFFECTS_FAILED -) -IF ( ${CHECK_EFFECTS_FAILED} ) - MESSAGE (FATAL_ERROR "check of json effect files failed" ) -ENDIF () - -# for python 3 the checkschema.py file must be rewritten -# TODO on windows it can't resolve the path inside the file (Das System kann den angegebenen Pfad nicht finden: '\\schema\\schema-general.json') -IF (NOT WIN32) EXECUTE_PROCESS ( - COMMAND python test/jsonchecks/checkschema.py ${CMAKE_BINARY_DIR}/config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json + COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkjson.py ${JSON_FILES} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE CHECK_JSON_FAILED + ) + IF ( ${CHECK_JSON_FAILED} ) + MESSAGE (FATAL_ERROR "check of json files failed" ) + ENDIF () + + if(ENABLE_EFFECTENGINE) + EXECUTE_PROCESS ( + COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkeffects.py effects effects/schema + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE CHECK_EFFECTS_FAILED + ) + IF ( ${CHECK_EFFECTS_FAILED} ) + MESSAGE (FATAL_ERROR "check of json effect files failed" ) + ENDIF () + endif() + + EXECUTE_PROCESS ( + COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkschema.py ${CMAKE_BINARY_DIR}/config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE CHECK_CONFIG_FAILED ) -ENDIF() -IF ( ${CHECK_CONFIG_FAILED} ) - MESSAGE (FATAL_ERROR "check of json default config failed" ) -ENDIF () + + IF ( ${CHECK_CONFIG_FAILED} ) + MESSAGE (FATAL_ERROR "check of json default config failed" ) + ENDIF () +endif(ENABLE_JSONCHECKS) # Add project specific cmake modules (find, etc) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -481,7 +503,7 @@ endif() message( STATUS "CMAKE_PREFIX_PATH used: ${CMAKE_PREFIX_PATH}" ) # find QT libs -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Network SerialPort Sql Widgets REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Network Sql Widgets REQUIRED) message( STATUS "Found Qt Version: ${QT_VERSION}" ) if (${QT_VERSION_MAJOR} GREATER_EQUAL 6 ) @@ -494,7 +516,7 @@ IF ( "${QT_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" ) message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" ) ENDIF() -find_package(Qt${QT_VERSION_MAJOR} ${QT_VERSION} COMPONENTS Core Gui Network SerialPort Sql Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} ${QT_VERSION} COMPONENTS Core Gui Network Sql Widgets REQUIRED) message( STATUS "Qt version used: ${QT_VERSION}" ) @@ -519,10 +541,16 @@ add_subdirectory(resources) # remove generated files on make cleaan too LIST( APPEND GENERATED_QRC - ${CMAKE_BINARY_DIR}/EffectEngine.qrc ${CMAKE_BINARY_DIR}/WebConfig.qrc ${CMAKE_BINARY_DIR}/HyperionConfig.h ) + +if(ENABLE_EFFECTENGINE) +LIST( APPEND GENERATED_QRC + ${CMAKE_BINARY_DIR}/EffectEngine.qrc +) +endif () + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_QRC}" ) # enable C++11; MSVC doesn't have c++11 feature switch diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index 76ad6209..272da230 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -51,21 +51,30 @@ // Define to enable protocol buffer connect #cmakedefine ENABLE_PROTOBUF_CONNECT -// Define to enable the SPI-Device -#cmakedefine ENABLE_SPIDEV +// Define to enable the network devices +#cmakedefine ENABLE_DEV_NETWORK -// Define to enable the Tinkerforge device -#cmakedefine ENABLE_TINKERFORGE +// Define to enable the Serial devices +#cmakedefine ENABLE_DEV_SERIAL + +// Define to enable the SPI devices +#cmakedefine ENABLE_DEV_SPI + +// Define to enable the Tinkerforge devices +#cmakedefine ENABLE_DEV_TINKERFORGE // Define to enable the USB / HID devices -#cmakedefine ENABLE_USB_HID +#cmakedefine ENABLE_DEV_USB_HID // Define to enable the WS281x-PWM-via-DMA-device using jgarff's library -#cmakedefine ENABLE_WS281XPWM +#cmakedefine ENABLE_DEV_WS281XPWM // Define to enable AVAHI #cmakedefine ENABLE_AVAHI +// Define to enable EFFECTENGINE +#cmakedefine ENABLE_EFFECTENGINE + // Define to enable experimental features #cmakedefine ENABLE_EXPERIMENTAL diff --git a/assets/webconfig/content/remote.html b/assets/webconfig/content/remote.html index 7c39b19a..2d5a66fb 100644 --- a/assets/webconfig/content/remote.html +++ b/assets/webconfig/content/remote.html @@ -1,106 +1,107 @@
- + -
-
- -
-
+
+
+ +
+
-
-
-
-
Source selection
-
-
-
-
-
-
+
+
+
+
Source selection
+
+
+
+
+
+
-
-
-
Components control
-
-
-
-
-
-
+
+
+
Components control
+
+
+
+
+
+
-
-
-
-
Colors/Effects
-
- - - - - - - - - - - - - - - - - - - -
-
- - - -
-
- - -
- - -
- - -
- -
-
-
-
-
-
Mapping types
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
Colors/Effects
+
+ + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+ + +
+ + +
+ + +
+ +
+
+
+
+
+
Mapping types
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- + + diff --git a/assets/webconfig/index.html b/assets/webconfig/index.html index 9ebb0d80..fda46bbc 100644 --- a/assets/webconfig/index.html +++ b/assets/webconfig/index.html @@ -222,7 +222,7 @@
  • Capturing Hardware
  • Network
  • Remote Control
  • -
  • Effects Configurator
  • +
  • Effects Configurator
  • Support
  • System diff --git a/assets/webconfig/js/content_effects.js b/assets/webconfig/js/content_effects.js index 9dd57063..f32bfc11 100644 --- a/assets/webconfig/js/content_effects.js +++ b/assets/webconfig/js/content_effects.js @@ -1,72 +1,89 @@ -$(document).ready( function() { - performTranslation(); +$(document).ready(function () { + performTranslation(); - // update instance listing - updateHyperionInstanceListing(); + var EFFECTENGINE_ENABLED = (jQuery.inArray("effectengine", window.serverInfo.services) !== -1); - var oldEffects = []; - var effects_editor = null; - var confFgEff = window.serverConfig.foregroundEffect.effect; - var confBgEff = window.serverConfig.backgroundEffect.effect; - var foregroundEffect_editor = null; - var backgroundEffect_editor = null; + // update instance listing + updateHyperionInstanceListing(); - if(window.showOptHelp) - { - //foreground effect - $('#conf_cont').append(createRow('conf_cont_fge')); - $('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect')); + var oldEffects = []; + var effects_editor = null; + var confFgEff = window.serverConfig.foregroundEffect.effect; + var confBgEff = window.serverConfig.backgroundEffect.effect; + var foregroundEffect_editor = null; + var backgroundEffect_editor = null; + + if (!EFFECTENGINE_ENABLED) { + window.schema.foregroundEffect.properties.type.enum.splice(1, 1); + window.schema.foregroundEffect.properties.type.options.enum_titles.splice(1, 1); + window.schema.foregroundEffect.properties.type.default = "color"; + delete window.schema.foregroundEffect.properties.effect; + + window.schema.backgroundEffect.properties.type.enum.splice(1, 1); + window.schema.backgroundEffect.properties.type.options.enum_titles.splice(1, 1); + window.schema.backgroundEffect.properties.type.default = "color"; + delete window.schema.backgroundEffect.properties.effect; + } + + if (window.showOptHelp) { + //foreground effect + $('#conf_cont').append(createRow('conf_cont_fge')); + $('#conf_cont_fge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect')); $('#conf_cont_fge').append(createHelpTable(window.schema.foregroundEffect.properties, $.i18n("edt_conf_fge_heading_title"), "foregroundEffectHelpPanelId")); - //background effect - $('#conf_cont').append(createRow('conf_cont_bge')); - $('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect')); + //background effect + $('#conf_cont').append(createRow('conf_cont_bge')); + $('#conf_cont_bge').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect')); $('#conf_cont_bge').append(createHelpTable(window.schema.backgroundEffect.properties, $.i18n("edt_conf_bge_heading_title"), "backgroundEffectHelpPanelId")); - //effect path - if(storedAccess != 'default') - { - $('#conf_cont').append(createRow('conf_cont_ef')); - $('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects')); - $('#conf_cont_ef').append(createHelpTable(window.schema.effects.properties, $.i18n("edt_conf_effp_heading_title"))); - } - } - else - { - $('#conf_cont').addClass('row'); - $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect')); - $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect')); - if(storedAccess != 'default') - $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects')); - } + if (EFFECTENGINE_ENABLED) { + //effect path + if (storedAccess != 'default') { + $('#conf_cont').append(createRow('conf_cont_ef')); + $('#conf_cont_ef').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects')); + $('#conf_cont_ef').append(createHelpTable(window.schema.effects.properties, $.i18n("edt_conf_effp_heading_title"))); + } + } + } + else { + $('#conf_cont').addClass('row'); + $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_fge_heading_title"), 'editor_container_foregroundEffect', 'btn_submit_foregroundEffect')); + $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_bge_heading_title"), 'editor_container_backgroundEffect', 'btn_submit_backgroundEffect')); + if (EFFECTENGINE_ENABLED) { + if (storedAccess != 'default') + $('#conf_cont').append(createOptPanel('fa-spinner', $.i18n("edt_conf_effp_heading_title"), 'editor_container_effects', 'btn_submit_effects')); + } + } - if(storedAccess != 'default') - { - effects_editor = createJsonEditor('editor_container_effects', { - effects : window.schema.effects - }, true, true); + if (EFFECTENGINE_ENABLED) { + if (storedAccess != 'default') { + effects_editor = createJsonEditor('editor_container_effects', { + effects: window.schema.effects + }, true, true); - effects_editor.on('change',function() { - effects_editor.validate().length || window.readOnlyMode ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false); - }); + effects_editor.on('change', function () { + effects_editor.validate().length || window.readOnlyMode ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false); + }); - $('#btn_submit_effects').off().on('click',function() { - requestWriteConfig(effects_editor.getValue()); - }); - } + $('#btn_submit_effects').off().on('click', function () { + requestWriteConfig(effects_editor.getValue()); + }); + } + } - foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', { - foregroundEffect : window.schema.foregroundEffect - }, true, true); + foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', { + foregroundEffect: window.schema.foregroundEffect + }, true, true); - backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', { - backgroundEffect : window.schema.backgroundEffect - }, true, true); + backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', { + backgroundEffect: window.schema.backgroundEffect + }, true, true); - - foregroundEffect_editor.on('ready',function() { - updateEffectlist(); - }); + foregroundEffect_editor.on('ready', function () { + if (EFFECTENGINE_ENABLED) { + updateEffectlist(); + } + }); foregroundEffect_editor.on('change', function () { var foregroundEffectEnable = foregroundEffect_editor.getEditor("root.foregroundEffect.enable").getValue(); @@ -79,8 +96,8 @@ $(document).ready( function() { $('#foregroundEffectHelpPanelId').hide(); } - foregroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false); - }); + foregroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false); + }); backgroundEffect_editor.on('change', function () { var backgroundEffectEnable = backgroundEffect_editor.getEditor("root.backgroundEffect.enable").getValue(); @@ -93,62 +110,62 @@ $(document).ready( function() { $('#backgroundEffectHelpPanelId').hide(); } - backgroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false); - }); + backgroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false); + }); - $('#btn_submit_foregroundEffect').off().on('click',function() { - var value = foregroundEffect_editor.getValue(); - if(typeof value.foregroundEffect.effect == 'undefined') - value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect; - requestWriteConfig(value); - }); + $('#btn_submit_foregroundEffect').off().on('click', function () { + var value = foregroundEffect_editor.getValue(); + if (typeof value.foregroundEffect.effect == 'undefined') + value.foregroundEffect.effect = window.serverConfig.foregroundEffect.effect; + requestWriteConfig(value); + }); - $('#btn_submit_backgroundEffect').off().on('click',function() { - var value = backgroundEffect_editor.getValue(); - if(typeof value.backgroundEffect.effect == 'undefined') - value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect; - requestWriteConfig(value); - }); + $('#btn_submit_backgroundEffect').off().on('click', function () { + var value = backgroundEffect_editor.getValue(); + if (typeof value.backgroundEffect.effect == 'undefined') + value.backgroundEffect.effect = window.serverConfig.backgroundEffect.effect; + requestWriteConfig(value); + }); - //create introduction - if(window.showOptHelp) - { - createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects"); - createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect"); - createHint("intro", $.i18n('conf_effect_bgeff_intro'), "editor_container_backgroundEffect"); - } + //create introduction + if (window.showOptHelp) { + if (EFFECTENGINE_ENABLED) { + createHint("intro", $.i18n('conf_effect_path_intro'), "editor_container_effects"); + } + createHint("intro", $.i18n('conf_effect_fgeff_intro'), "editor_container_foregroundEffect"); + createHint("intro", $.i18n('conf_effect_bgeff_intro'), "editor_container_backgroundEffect"); + } - function updateEffectlist(){ - var newEffects = window.serverInfo.effects; - if (newEffects.length != oldEffects.length) - { - $('#root_foregroundEffect_effect').html(''); - var usrEffArr = []; - var sysEffArr = []; + function updateEffectlist() { + var newEffects = window.serverInfo.effects; + if (newEffects.length != oldEffects.length) { + $('#root_foregroundEffect_effect').html(''); + var usrEffArr = []; + var sysEffArr = []; - for(var i = 0; i < newEffects.length; i++) - { - var effectName = newEffects[i].name; - if(!/^\:/.test(newEffects[i].file)) - usrEffArr.push(effectName); - else - sysEffArr.push(effectName); - } - $('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets'))); - $('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets'))); - $('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html()); - oldEffects = newEffects; + for (var i = 0; i < newEffects.length; i++) { + var effectName = newEffects[i].name; + if (!/^\:/.test(newEffects[i].file)) + usrEffArr.push(effectName); + else + sysEffArr.push(effectName); + } + $('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets'))); + $('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets'))); + $('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html()); + oldEffects = newEffects; - $('#root_foregroundEffect_effect').val(confFgEff); - $('#root_backgroundEffect_effect').val(confBgEff); - } - } + $('#root_foregroundEffect_effect').val(confFgEff); + $('#root_backgroundEffect_effect').val(confBgEff); + } + } - //interval update - $(window.hyperion).on("cmd-effects-update", function(event){ - window.serverInfo.effects = event.response.data.effects - updateEffectlist(); - }); + //interval update + $(window.hyperion).on("cmd-effects-update", function (event) { + window.serverInfo.effects = event.response.data.effects + updateEffectlist(); + }); - removeOverlay(); + removeOverlay(); }); + diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index 878d6485..5a63f4ad 100644 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -228,6 +228,11 @@ $(document).ready(function () { $("#MenuItemGrabber").attr('style', 'display:none') $("#MenuItemInstCapture").attr('style', 'display:none') } + + //Hide effectsconfigurator menu entry, if effectengine is not available + if (jQuery.inArray("effectengine", window.serverInfo.services) === -1) { + $("#MenuItemEffectsConfig").attr('style', 'display:none') + } }); $(window.hyperion).on("cmd-adjustment-update", function (event) { @@ -312,14 +317,14 @@ $(document).ready(function () { window.scrollTo(0, 0); }); - $(window).scroll(function() { + $(window).scroll(function () { if ($(window).scrollTop() > 65) $("#navbar_brand_logo").css("display", "none"); else $("#navbar_brand_logo").css("display", ""); }); - $('#side-menu li a, #side-menu li ul li a').click(function() { + $('#side-menu li a, #side-menu li ul li a').click(function () { $('#side-menu').find('.active').toggleClass('inactive'); // find all active classes and set inactive; $(this).addClass('active'); }); @@ -370,8 +375,8 @@ function SwitchToMenuItem(target, item) { cl_object.addClass('in'); // Add class "in" to expand header in sidebar menu; if (item) { // Jump to div "item" if available. Time limit 3 seconds function scrollTo(counter) { - if(counter < 30) { - setTimeout(function() { + if (counter < 30) { + setTimeout(function () { counter++; if ($('#' + item).length) $('#' + item)[0].scrollIntoView(); diff --git a/assets/webconfig/js/content_remote.js b/assets/webconfig/js/content_remote.js index fcd94955..17e85c89 100644 --- a/assets/webconfig/js/content_remote.js +++ b/assets/webconfig/js/content_remote.js @@ -1,6 +1,8 @@ $(document).ready(function () { performTranslation(); + var EFFECTENGINE_ENABLED = (jQuery.inArray("effectengine", window.serverInfo.services) !== -1); + // update instance listing updateHyperionInstanceListing(); @@ -337,10 +339,13 @@ $(document).ready(function () { }); $("#remote_input_reseff, #remote_input_rescol").off().on("click", function () { - if (this.id == "remote_input_rescol") + if (this.id == "remote_input_rescol") { sendColor(); - else - sendEffect(); + } else { + if (EFFECTENGINE_ENABLED) { + sendEffect(); + } + } }); $("#remote_input_repimg").off().on("click", function () { @@ -365,7 +370,12 @@ $(document).ready(function () { updateInputSelect(); updateLedMapping(); updateVideoMode(); - updateEffectlist(); + if (EFFECTENGINE_ENABLED) { + updateEffectlist(); + } else { + $('#effect_row').hide(); + } + // interval updates diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index 35f78ac5..a33f4274 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -1232,7 +1232,9 @@ function getSystemInfo() { info += '- Kernel: ' + sys.kernelType + ' (' + sys.kernelVersion + ' (WS: ' + sys.wordSize + '))\n'; info += '- Root/Admin: ' + sys.isUserAdmin + '\n'; info += '- Qt Version: ' + sys.qtVersion + '\n'; - info += '- Python Version: ' + sys.pyVersion + '\n'; + if (jQuery.inArray("effectengine", window.serverInfo.services) !== -1) { + info += '- Python Version: ' + sys.pyVersion + '\n'; + } info += '- Browser: ' + navigator.userAgent; return info; } @@ -1349,3 +1351,4 @@ function isValidHostnameOrIP4(value) { function isValidHostnameOrIP(value) { return (isValidHostnameOrIP4(value) || isValidIPv6(value)); } + diff --git a/bin/create_all_releases.sh b/bin/create_all_releases.sh index b57c8abd..09cfc934 100755 --- a/bin/create_all_releases.sh +++ b/bin/create_all_releases.sh @@ -17,8 +17,8 @@ make_release() cd build-${RELEASE} - cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLATFORM=${PLATFORM} $@ -DCMAKE_BUILD_TYPE=Release -Wno-dev .. || exit 1 - #cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLATFORM=${PLATFORM} $@ -DCMAKE_BUILD_TYPE=Debug .. || exit 1 + cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=Release -Wno-dev $@ .. || exit 1 + #cmake -DCMAKE_INSTALL_PREFIX=/usr -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=Debug $@ .. || exit 1 make -j $(nproc) || exit 1 strip bin/* make package -j $(nproc) @@ -27,16 +27,14 @@ make_release() bin/create_release.sh . ${RELEASE} } -#export QTDIR="/opt/Qt/6.2.0/gcc_64" -#export QTDIR=="/opt/Qt/5.15.2/gcc_64" +#export QTDIR="/opt/Qt/6.2.2/gcc_64" +#export QTDIR="/opt/Qt/5.15.2/gcc_64" CMAKE_PROTOC_FLAG="-DIMPORT_PROTOC=../build-x86x64/protoc_export.cmake" CMAKE_FLATC_FLAG="-DIMPORT_FLATC=../build-x86x64/flatc_export.cmake" -make_release x86x64 x11 -#make_release x32 x11 -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-x32.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} -#make_release rpi rpi -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} -#make_release wetek wetek -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} -#make_release imx6 imx6 -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-imx6.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} - - +make_release x86x64 x11 $@ +#make_release x32 x11 $@ -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-x32.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} +#make_release rpi rpi $@ -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} +#make_release wetek wetek $@ -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} +#make_release imx6 imx6 $@ -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-imx6.cmake" ${CMAKE_PROTOC_FLAG} ${CMAKE_FLATC_FLAG} diff --git a/bin/scripts/docker-compile.sh b/bin/scripts/docker-compile.sh index 0be2596f..5381529a 100755 --- a/bin/scripts/docker-compile.sh +++ b/bin/scripts/docker-compile.sh @@ -23,6 +23,8 @@ BUILD_LOCAL=0 BUILD_INCREMENTAL=0 #Verbose output _VERBOSE=0 +#Additional args +BUILD_ARGS="" # get current path to this script, independent of calling pushd . > /dev/null @@ -62,20 +64,23 @@ echo "######################################################## ## Requires installed Docker: https://www.docker.com/ ## Without arguments it will compile Hyperion for Debian Buster (x86_64) and uses Hyperion code from GitHub repository. ## Supports Raspberry Pi (armv6l, armv7l) cross compilation (Debian Stretch/Buster) and native compilation (Raspbian Stretch/Buster) +## For all images and tags currently available, see https://github.com/orgs/hyperion-project/packages ## ## Homepage: https://www.hyperion-project.org ## Forum: https://hyperion-project.org/forum/ ######################################################## # These are possible arguments to modify the script behaviour with their default values # -# docker-compile.sh -h # Show this help message -# docker-compile.sh -i x86_64 # The docker image, one of x86_64 | armv6l | armv7l | rpi-raspbian -# docker-compile.sh -t buster # The docker tag, stretch, buster or bullseye -# docker-compile.sh -b Release # cmake Release or Debug build -# docker-compile.sh -p true # If true, build packages with CPack -# docker-compile.sh -l # Run build using local code files -# docker-compile.sh -c # Run incremental build, i.e. do not delete files created during previous build -# docker-compile.sh -f x11 # cmake PLATFORM parameter +# docker-compile.sh -h, --help # Show this help message +# docker-compile.sh -i, --image # The docker image, e.g., x86_64, armv6l, armv7l, aarch64, rpi-raspbian +# docker-compile.sh -t, --tag # The docker tag, e.g., stretch, buster, bullseye, bookworm +# docker-compile.sh -b, --type # Release or Debug build +# docker-compile.sh -p, --packages # If true, build packages with CPack +# docker-compile.sh -l, --local # Run build using local code files +# docker-compile.sh -c, --incremental # Run incremental build, i.e. do not delete files created during previous build +# docker-compile.sh -f, --platform # cmake PLATFORM parameter, e.g. x11, amlogic-dev +# docker-compile.sh -v, --verbose # Run the script in verbose mode +# docker-compile.sh -- args # Additonal cmake arguments, e.g., -DHYPERION_LIGHT=ON # More informations to docker tags at: https://github.com/Hyperion-Project/hyperion.docker-ci" } @@ -86,23 +91,54 @@ function log () { } echo "Compile Hyperion using a Docker container" +options=$(getopt -l "image:,tag:,type:,packages:,platform:,local,incremental,verbose,help" -o "i:t:b:p:f:lcvh" -a -- "$@") -while getopts i:t:b:p:f:lcvh option +eval set -- "$options" +while true do - case "${option}" - in - i) BUILD_IMAGE=${OPTARG};; - t) BUILD_TAG=${OPTARG};; - b) BUILD_TYPE=${OPTARG};; - p) BUILD_PACKAGES=${OPTARG};; - f) BUILD_PLATFORM=${OPTARG,,};; - l) BUILD_LOCAL=1;; - c) BUILD_INCREMENTAL=1;; - v) _VERBOSE=1;; - h) printHelp; exit 0;; - esac + case $1 in + -i|--image) + shift + BUILD_IMAGE=$1 + ;; + -t|--tag) + shift + BUILD_TAG=$1 + ;; + -b|--type) + shift + BUILD_TYPE=$1 + ;; + -p|--packages) + shift + BUILD_PACKAGES=$1 + ;; + -f|--platform) + shift + BUILD_PLATFORM=$1 + ;; + -l|--local) + BUILD_LOCAL=1 + ;; + -c|--incremental) + BUILD_INCREMENTAL=1 + ;; + -v|--verbose) + _VERBOSE=1 + ;; + -h|--help) + printHelp + exit 0 + ;; + --) + shift + break;; + esac + shift done +BUILD_ARGS=$@ + # determine package creation if [ ${BUILD_PACKAGES} == "true" ]; then PACKAGES="package" @@ -164,7 +200,7 @@ $DOCKER run --rm \ -v "${CODE_PATH}/:/source:rw" \ ${REGISTRY_URL}/${BUILD_IMAGE}:${BUILD_TAG} \ /bin/bash -c "mkdir -p /source/${BUILD_DIR} && cd /source/${BUILD_DIR} && - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${PLATFORM} .. || exit 2 && + cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${PLATFORM} ${BUILD_ARGS} .. || exit 2 && make -j $(nproc) ${PACKAGES} || exit 3 || : && exit 0; exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; } diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index c6a0d6bd..87036292 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -47,34 +47,36 @@ macro(DeployMacOS TARGET) endif() endforeach() - include(BundleUtilities) - fixup_bundle("${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}" "${QT_PLUGINS}" "" IGNORE_ITEM "python;python3;Python;Python3;.Python;.Python3") + if(ENABLE_EFFECTENGINE) + include(BundleUtilities) + fixup_bundle("${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}" "${QT_PLUGINS}" "" IGNORE_ITEM "python;python3;Python;Python3;.Python;.Python3") - # Detect the Python version and modules directory - find_package(Python3 3.5 REQUIRED) - execute_process( - COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" - OUTPUT_VARIABLE PYTHON_MODULES_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - # Copy Python modules to '/../Frameworks/Python.framework/Versions/Current/lib/PythonMAJOR.MINOR' and ignore the unnecessary stuff listed below - if (PYTHON_MODULES_DIR) - set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") - file( - COPY ${PYTHON_MODULES_DIR}/ - DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/Frameworks/Python.framework/Versions/Current/lib/python${PYTHON_VERSION_MAJOR_MINOR}" - PATTERN "*.pyc" EXCLUDE # compiled bytecodes - PATTERN "__pycache__" EXCLUDE # any cache - PATTERN "config-${PYTHON_VERSION_MAJOR_MINOR}*" EXCLUDE # static libs - PATTERN "lib2to3" EXCLUDE # automated Python 2 to 3 code translation - PATTERN "tkinter" EXCLUDE # Tk interface - PATTERN "turtledemo" EXCLUDE # Tk demo folder - PATTERN "turtle.py" EXCLUDE # Tk demo file - PATTERN "test" EXCLUDE # unittest module - PATTERN "sitecustomize.py" EXCLUDE # site-specific configs + # Detect the Python version and modules directory + find_package(Python3 3.5 REQUIRED) + execute_process( + COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" + OUTPUT_VARIABLE PYTHON_MODULES_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE ) - endif(PYTHON_MODULES_DIR) + + # Copy Python modules to '/../Frameworks/Python.framework/Versions/Current/lib/PythonMAJOR.MINOR' and ignore the unnecessary stuff listed below + if (PYTHON_MODULES_DIR) + set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + file( + COPY ${PYTHON_MODULES_DIR}/ + DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/Frameworks/Python.framework/Versions/Current/lib/python${PYTHON_VERSION_MAJOR_MINOR}" + PATTERN "*.pyc" EXCLUDE # compiled bytecodes + PATTERN "__pycache__" EXCLUDE # any cache + PATTERN "config-${PYTHON_VERSION_MAJOR_MINOR}*" EXCLUDE # static libs + PATTERN "lib2to3" EXCLUDE # automated Python 2 to 3 code translation + PATTERN "tkinter" EXCLUDE # Tk interface + PATTERN "turtledemo" EXCLUDE # Tk demo folder + PATTERN "turtle.py" EXCLUDE # Tk demo file + PATTERN "test" EXCLUDE # unittest module + PATTERN "sitecustomize.py" EXCLUDE # site-specific configs + ) + endif(PYTHON_MODULES_DIR) + endif(ENABLE_EFFECTENGINE) ]] COMPONENT "Hyperion") else() @@ -225,36 +227,38 @@ macro(DeployLinux TARGET) ) endforeach() - # Detect the Python version and modules directory - if (NOT CMAKE_VERSION VERSION_LESS "3.12") - set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") - set(PYTHON_MODULES_DIR "${Python3_STDLIB}") - else() - set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" - OUTPUT_VARIABLE PYTHON_MODULES_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() + if(ENABLE_EFFECTENGINE) + # Detect the Python version and modules directory + if (NOT CMAKE_VERSION VERSION_LESS "3.12") + set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + set(PYTHON_MODULES_DIR "${Python3_STDLIB}") + else() + set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" + OUTPUT_VARIABLE PYTHON_MODULES_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() - # Copy Python modules to 'share/hyperion/lib/pythonMAJOR.MINOR' and ignore the unnecessary stuff listed below - if (PYTHON_MODULES_DIR) + # Copy Python modules to 'share/hyperion/lib/pythonMAJOR.MINOR' and ignore the unnecessary stuff listed below + if (PYTHON_MODULES_DIR) - install( - DIRECTORY ${PYTHON_MODULES_DIR}/ - DESTINATION "share/hyperion/lib/python${PYTHON_VERSION_MAJOR_MINOR}" - COMPONENT "Hyperion" - PATTERN "*.pyc" EXCLUDE # compiled bytecodes - PATTERN "__pycache__" EXCLUDE # any cache - PATTERN "config-${PYTHON_VERSION_MAJOR_MINOR}*" EXCLUDE # static libs - PATTERN "lib2to3" EXCLUDE # automated Python 2 to 3 code translation - PATTERN "tkinter" EXCLUDE # Tk interface - PATTERN "turtle.py" EXCLUDE # Tk demo - PATTERN "test" EXCLUDE # unittest module - PATTERN "sitecustomize.py" EXCLUDE # site-specific configs - ) - endif(PYTHON_MODULES_DIR) + install( + DIRECTORY ${PYTHON_MODULES_DIR}/ + DESTINATION "share/hyperion/lib/python${PYTHON_VERSION_MAJOR_MINOR}" + COMPONENT "Hyperion" + PATTERN "*.pyc" EXCLUDE # compiled bytecodes + PATTERN "__pycache__" EXCLUDE # any cache + PATTERN "config-${PYTHON_VERSION_MAJOR_MINOR}*" EXCLUDE # static libs + PATTERN "lib2to3" EXCLUDE # automated Python 2 to 3 code translation + PATTERN "tkinter" EXCLUDE # Tk interface + PATTERN "turtle.py" EXCLUDE # Tk demo + PATTERN "test" EXCLUDE # unittest module + PATTERN "sitecustomize.py" EXCLUDE # site-specific configs + ) + endif(PYTHON_MODULES_DIR) + endif(ENABLE_EFFECTENGINE) else() # Run CMake after target was built to run get_prerequisites on ${TARGET_FILE} @@ -388,44 +392,46 @@ macro(DeployWindows TARGET) COMPONENT "Hyperion" ) - # Download embed python package (only release build package available) - # Currently only cmake version >= 3.12 implemented - set(url "https://www.python.org/ftp/python/${Python3_VERSION}/") - set(filename "python-${Python3_VERSION}-embed-amd64.zip") + if(ENABLE_EFFECTENGINE) + # Download embed python package (only release build package available) + # Currently only cmake version >= 3.12 implemented + set(url "https://www.python.org/ftp/python/${Python3_VERSION}/") + set(filename "python-${Python3_VERSION}-embed-amd64.zip") - if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${filename}" OR NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/python") - file(DOWNLOAD "${url}${filename}" "${CMAKE_CURRENT_BINARY_DIR}/${filename}" - STATUS result - ) + if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${filename}" OR NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/python") + file(DOWNLOAD "${url}${filename}" "${CMAKE_CURRENT_BINARY_DIR}/${filename}" + STATUS result + ) - # Check if the download is successful - list(GET result 0 result_code) - if(NOT result_code EQUAL 0) - list(GET result 1 reason) - message(FATAL_ERROR "Could not download file ${url}${filename}: ${reason}") + # Check if the download is successful + list(GET result 0 result_code) + if(NOT result_code EQUAL 0) + list(GET result 1 reason) + message(FATAL_ERROR "Could not download file ${url}${filename}: ${reason}") + endif() + + # Unpack downloaded embed python + file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/python) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar -xfz "${CMAKE_CURRENT_BINARY_DIR}/${filename}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python + OUTPUT_QUIET + ) endif() - # Unpack downloaded embed python - file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/python) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python) - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar -xfz "${CMAKE_CURRENT_BINARY_DIR}/${filename}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python - OUTPUT_QUIET + # Copy pythonXX.dll and pythonXX.zip to 'hyperion' + foreach(PYTHON_FILE + "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.dll" + "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.zip" ) - endif() - - # Copy pythonXX.dll and pythonXX.zip to 'hyperion' - foreach(PYTHON_FILE - "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.dll" - "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.zip" - ) - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/python/${PYTHON_FILE} - DESTINATION "bin" - COMPONENT "Hyperion" - ) - endforeach() + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/python/${PYTHON_FILE} + DESTINATION "bin" + COMPONENT "Hyperion" + ) + endforeach() + endif(ENABLE_EFFECTENGINE) if (ENABLE_DX) # Download DirectX End-User Runtimes (June 2010) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 4dd9cd7a..3566eaba 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -1,10 +1,10 @@ add_subdirectory(build/hidapi) -if ( ENABLE_TINKERFORGE ) +if (ENABLE_DEV_TINKERFORGE) add_subdirectory(build/tinkerforge) endif() -if(ENABLE_WS281XPWM) +if(ENABLE_DEV_WS281XPWM) add_library(ws281x external/rpi_ws281x/mailbox.c external/rpi_ws281x/ws2811.c external/rpi_ws281x/pwm.c external/rpi_ws281x/dma.c @@ -194,135 +194,138 @@ endif() # MBEDTLS #============================================================================= -set(USE_SYSTEM_MBEDTLS_LIBS ${DEFAULT_USE_SYSTEM_MBEDTLS_LIBS} CACHE BOOL "use mbedtls library from system") +if(ENABLE_DEV_NETWORK) + set(USE_SYSTEM_MBEDTLS_LIBS ${DEFAULT_USE_SYSTEM_MBEDTLS_LIBS} CACHE BOOL "use mbedtls library from system") -if (USE_SYSTEM_MBEDTLS_LIBS) - find_package(mbedtls REQUIRED) - if (NOT MBEDTLS_FOUND) - message(STATUS "Could NOT find mbedtls system libraries, build static mbedtls libraries") - #Fallback: build mbedtls static libray inside project - set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF PARENT_SCOPE) - set(USE_SYSTEM_MBEDTLS_LIBS OFF) - endif (NOT MBEDTLS_FOUND) -endif (USE_SYSTEM_MBEDTLS_LIBS) + if (USE_SYSTEM_MBEDTLS_LIBS) + find_package(mbedtls REQUIRED) + if (NOT MBEDTLS_FOUND) + message(STATUS "Could NOT find mbedtls system libraries, build static mbedtls libraries") + #Fallback: build mbedtls static libray inside project + set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF PARENT_SCOPE) + set(USE_SYSTEM_MBEDTLS_LIBS OFF) + endif (NOT MBEDTLS_FOUND) + endif (USE_SYSTEM_MBEDTLS_LIBS) -if (NOT USE_SYSTEM_MBEDTLS_LIBS) - set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF CACHE BOOL "system mbedtls libraries not found, disable use system mbedtls libraries") - set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared mbedtls libraries") + if (NOT USE_SYSTEM_MBEDTLS_LIBS) + set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF CACHE BOOL "system mbedtls libraries not found, disable use system mbedtls libraries") + set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared mbedtls libraries") - set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedTLS tests") - set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbedTLS programs") - set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "Disable mbedTLS shared libraries") - set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "Enable mbedTLS static libraries") + set(ENABLE_TESTING OFF CACHE BOOL "Disable mbedTLS tests") + set(ENABLE_PROGRAMS OFF CACHE BOOL "Disable mbedTLS programs") + set(USE_SHARED_MBEDTLS_LIBRARY OFF CACHE BOOL "Disable mbedTLS shared libraries") + set(USE_STATIC_MBEDTLS_LIBRARY ON CACHE BOOL "Enable mbedTLS static libraries") - set(MBEDTLS_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/download") - set(MBEDTLS_SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/src") - set(MBEDTLS_BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/build") - set(MBEDTLS_INSTALL_DIR "${CMAKE_BINARY_DIR}") - if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug") - set(MBEDTLS_LOGGING 1) - else () - set(MBEDTLS_LOGGING 0) - endif () - - set(MBEDTLS_CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DUSE_SHARED_MBEDTLS_LIBRARY:BOOL=OFF - -DUSE_STATIC_MBEDTLS_LIBRARY:BOOL=ON - -DENABLE_TESTING:BOOL=OFF - -DENABLE_PROGRAMS:BOOL=OFF - -DLINK_WITH_PTHREAD:BOOL=ON - -Wno-dev - #-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE - ) - - set(ENABLE_MBEDTLS_FETCH_CONTENT ON) - - if (ENABLE_MBEDTLS_FETCH_CONTENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) - - include(FetchContent) - - FetchContent_Declare( - mbedtls - GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git - GIT_TAG origin/master - BUILD_ALWAYS OFF - GIT_PROGRESS 1 - DOWNLOAD_DIR "${MBEDTLS_DOWNLOAD_DIR}" - SOURCE_DIR "${MBEDTLS_SOURCE_DIR}" - BINARY_DIR "${MBEDTLS_BINARY_DIR}" - INSTALL_DIR "${MBEDTLS_INSTALL_DIR}" - CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS} - BUILD_COMMAND "" - INSTALL_COMMAND "" - LOG_DOWNLOAD ${MBEDTLS_LOGGING} - LOG_UPDATE ${MBEDTLS_LOGGING} - LOG_PATCH ${MBEDTLS_LOGGING} - LOG_CONFIGURE ${MBEDTLS_LOGGING} - LOG_BUILD ${MBEDTLS_LOGGING} - LOG_INSTALL ${MBEDTLS_LOGGING} - LOG_TEST ${MBEDTLS_LOGGING} - LOG_MERGED_STDOUTERR ${MBEDTLS_LOGGING} - LOG_OUTPUT_ON_FAILURE ${MBEDTLS_LOGGING} - ) - - if (CMAKE_VERSION VERSION_LESS 3.14) - macro (FetchContent_MakeAvailable NAME) - FetchContent_GetProperties(${NAME}) - if (NOT ${NAME}_POPULATED) - FetchContent_Populate(${NAME}) - add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) - endif () - endmacro () + set(MBEDTLS_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/download") + set(MBEDTLS_SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/src") + set(MBEDTLS_BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/external/mbedtls/build") + set(MBEDTLS_INSTALL_DIR "${CMAKE_BINARY_DIR}") + if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug") + set(MBEDTLS_LOGGING 1) + else () + set(MBEDTLS_LOGGING 0) endif () - FetchContent_MakeAvailable(mbedtls) - else () - set(ENABLE_MBEDTLS_FETCH_CONTENT OFF PARENT_SCOPE) - if(NOT DEFINED BUILD_MBEDTLS_ONCE) - set(BUILD_MBEDTLS_ONCE CACHE INTERNAL "Done") - configure_file(${CMAKE_SOURCE_DIR}/dependencies/CMakeLists-mbedtls.txt.in ${MBEDTLS_DOWNLOAD_DIR}/CMakeLists.txt @ONLY) - execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR}) - execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR}) - add_subdirectory(${MBEDTLS_SOURCE_DIR} ${MBEDTLS_BINARY_DIR}) - endif() - endif () + set(MBEDTLS_CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DUSE_SHARED_MBEDTLS_LIBRARY:BOOL=OFF + -DUSE_STATIC_MBEDTLS_LIBRARY:BOOL=ON + -DENABLE_TESTING:BOOL=OFF + -DENABLE_PROGRAMS:BOOL=OFF + -DLINK_WITH_PTHREAD:BOOL=ON + -Wno-dev + #-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE + ) - set (MBEDTLS_INCLUDE_DIR "${MBEDTLS_SOURCE_DIR}/include") - set (MBEDTLS_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR} PARENT_SCOPE) - if (MBEDTLS_INCLUDE_DIR) - if (EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h") - file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h _MBEDTLS_VERSION_LINE REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*") - string(REGEX REPLACE ".*MBEDTLS_VERSION_STRING[\t ]+\"(.*)\"" "\\1" MBEDTLS_VERSION ${_MBEDTLS_VERSION_LINE}) - set (MBEDTLS_VERSION ${MBEDTLS_VERSION} PARENT_SCOPE) - message(STATUS "Using static mbedtls libraries (build version \"${MBEDTLS_VERSION}\")") - elseif(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") - file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" _MBEDTLS_VERSION_STRING REGEX "^#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[0-9]+.[0-9]+.[0-9]+\"") - string(REGEX REPLACE "^.*MBEDTLS_VERSION_STRING.*([0-9]+.[0-9]+.[0-9]+).*" "\\1" MBEDTLS_VERSION "${_MBEDTLS_VERSION_STRING}") - set (MBEDTLS_VERSION ${MBEDTLS_VERSION} PARENT_SCOPE) - message(STATUS "Using static mbedtls libraries (build version \"${MBEDTLS_VERSION}\")") - endif() - endif () + set(ENABLE_MBEDTLS_FETCH_CONTENT ON) - include_directories(${MBEDTLS_INCLUDE_DIR}) + if (ENABLE_MBEDTLS_FETCH_CONTENT AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.11) - if(WIN32) - set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_CFG_INTDIR}/") - else() - set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}") - endif () + include(FetchContent) - set (MBEDTLS_SSL_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedtls${CMAKE_STATIC_LIBRARY_SUFFIX}") - set (MBEDTLS_X509_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedx509${CMAKE_STATIC_LIBRARY_SUFFIX}") - set (MBEDTLS_CRYPTO_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}") - set (MBEDTLS_LIBRARIES ${MBEDTLS_SSL_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_CRYPTO_LIBRARY}) - set (MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARIES} PARENT_SCOPE) + FetchContent_Declare( + mbedtls + GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git + GIT_TAG origin/master + BUILD_ALWAYS OFF + GIT_PROGRESS 1 + DOWNLOAD_DIR "${MBEDTLS_DOWNLOAD_DIR}" + SOURCE_DIR "${MBEDTLS_SOURCE_DIR}" + BINARY_DIR "${MBEDTLS_BINARY_DIR}" + INSTALL_DIR "${MBEDTLS_INSTALL_DIR}" + CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS} + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD ${MBEDTLS_LOGGING} + LOG_UPDATE ${MBEDTLS_LOGGING} + LOG_PATCH ${MBEDTLS_LOGGING} + LOG_CONFIGURE ${MBEDTLS_LOGGING} + LOG_BUILD ${MBEDTLS_LOGGING} + LOG_INSTALL ${MBEDTLS_LOGGING} + LOG_TEST ${MBEDTLS_LOGGING} + LOG_MERGED_STDOUTERR ${MBEDTLS_LOGGING} + LOG_OUTPUT_ON_FAILURE ${MBEDTLS_LOGGING} + ) - if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug") - message(STATUS "mbedtls libraries: ${MBEDTLS_LIBRARIES}") - endif () + if (CMAKE_VERSION VERSION_LESS 3.14) + macro (FetchContent_MakeAvailable NAME) + FetchContent_GetProperties(${NAME}) + if (NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) + endif () + endmacro () + endif () - mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY) + FetchContent_MakeAvailable(mbedtls) + else () + set(ENABLE_MBEDTLS_FETCH_CONTENT OFF PARENT_SCOPE) + if(NOT DEFINED BUILD_MBEDTLS_ONCE) + set(BUILD_MBEDTLS_ONCE CACHE INTERNAL "Done") + configure_file(${CMAKE_SOURCE_DIR}/dependencies/CMakeLists-mbedtls.txt.in ${MBEDTLS_DOWNLOAD_DIR}/CMakeLists.txt @ONLY) + execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH=${MBEDTLS_INSTALL_DIR} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR}) + execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${MBEDTLS_DOWNLOAD_DIR}) + add_subdirectory(${MBEDTLS_SOURCE_DIR} ${MBEDTLS_BINARY_DIR}) + endif() + endif () + + set (MBEDTLS_INCLUDE_DIR "${MBEDTLS_SOURCE_DIR}/include") + set (MBEDTLS_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR} PARENT_SCOPE) + if (MBEDTLS_INCLUDE_DIR) + if (EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h") + file(STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h _MBEDTLS_VERSION_LINE REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*") + string(REGEX REPLACE ".*MBEDTLS_VERSION_STRING[\t ]+\"(.*)\"" "\\1" MBEDTLS_VERSION ${_MBEDTLS_VERSION_LINE}) + set (MBEDTLS_VERSION ${MBEDTLS_VERSION} PARENT_SCOPE) + message(STATUS "Using static mbedtls libraries (build version \"${MBEDTLS_VERSION}\")") + elseif(EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h") + file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" _MBEDTLS_VERSION_STRING REGEX "^#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[0-9]+.[0-9]+.[0-9]+\"") + string(REGEX REPLACE "^.*MBEDTLS_VERSION_STRING.*([0-9]+.[0-9]+.[0-9]+).*" "\\1" MBEDTLS_VERSION "${_MBEDTLS_VERSION_STRING}") + set (MBEDTLS_VERSION ${MBEDTLS_VERSION} PARENT_SCOPE) + message(STATUS "Using static mbedtls libraries (build version \"${MBEDTLS_VERSION}\")") + endif() + endif () + + include_directories(${MBEDTLS_INCLUDE_DIR}) + + if(WIN32) + set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_CFG_INTDIR}/") + else() + set (MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}") + endif () + + set (MBEDTLS_SSL_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedtls${CMAKE_STATIC_LIBRARY_SUFFIX}") + set (MBEDTLS_X509_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedx509${CMAKE_STATIC_LIBRARY_SUFFIX}") + set (MBEDTLS_CRYPTO_LIBRARY "${MBEDTLS_LIB_INSTALL_DIR_WITH_LIB_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}") + set (MBEDTLS_LIBRARIES ${MBEDTLS_SSL_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_CRYPTO_LIBRARY}) + set (MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARIES} PARENT_SCOPE) + + if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug") + message(STATUS "mbedtls libraries: ${MBEDTLS_LIBRARIES}") + endif () + + mark_as_advanced (MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES MBEDTLS_SSL_LIBRARY MBEDTLS_X509_LIBRARY MBEDTLS_CRYPTO_LIBRARY) + + endif (NOT USE_SYSTEM_MBEDTLS_LIBS) +endif(ENABLE_DEV_NETWORK) -endif (NOT USE_SYSTEM_MBEDTLS_LIBS) diff --git a/include/api/API.h b/include/api/API.h index f5802428..a075b0eb 100644 --- a/include/api/API.h +++ b/include/api/API.h @@ -107,6 +107,7 @@ protected: /// void setVideoMode(VideoMode mode, hyperion::Components callerComp = hyperion::COMP_INVALID); +#if defined(ENABLE_EFFECTENGINE) /// /// @brief Set an effect /// @param dat The effect data @@ -115,6 +116,7 @@ protected: /// @return True on success else false /// bool setEffect(const EffectCmdData &dat, hyperion::Components callerComp = hyperion::COMP_INVALID); +#endif /// /// @brief Set source auto select enabled or disabled @@ -213,6 +215,7 @@ protected: /// QString setInstanceName(quint8 index, const QString &name); +#if defined(ENABLE_EFFECTENGINE) /// /// @brief Delete an effect. Requires ADMIN ACCESS /// @param name The effect name @@ -226,6 +229,7 @@ protected: /// @return True on success else false /// QString saveEffect(const QJsonObject &data); +#endif /// /// @brief Save settings object. Requires ADMIN ACCESS diff --git a/include/api/JsonAPI.h b/include/api/JsonAPI.h index 738c6fdc..119d87bb 100644 --- a/include/api/JsonAPI.h +++ b/include/api/JsonAPI.h @@ -148,6 +148,7 @@ private: /// void handleImageCommand(const QJsonObject &message, const QString &command, int tan); +#if defined(ENABLE_EFFECTENGINE) /// /// Handle an incoming JSON Effect message /// @@ -168,6 +169,7 @@ private: /// @param message the incoming message /// void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan); +#endif /// /// Handle an incoming JSON System info message diff --git a/include/api/JsonCB.h b/include/api/JsonCB.h index e5a19c58..466db5fa 100644 --- a/include/api/JsonCB.h +++ b/include/api/JsonCB.h @@ -99,10 +99,12 @@ private slots: /// void handleVideoModeChange(VideoMode mode); +#if defined(ENABLE_EFFECTENGINE) /// /// @brief Handle effect list change /// void handleEffectListChange(); +#endif /// /// @brief Handle a config part change. This does NOT include (global) changes from other hyperion instances diff --git a/include/effectengine/Effect.h b/include/effectengine/Effect.h index 14b51650..4766f372 100644 --- a/include/effectengine/Effect.h +++ b/include/effectengine/Effect.h @@ -22,8 +22,6 @@ class Effect : public QThread public: - static const int ENDLESS; - friend class EffectModule; Effect(Hyperion *hyperion diff --git a/include/effectengine/EffectEngine.h b/include/effectengine/EffectEngine.h index 455b3f18..8a3c52fa 100644 --- a/include/effectengine/EffectEngine.h +++ b/include/effectengine/EffectEngine.h @@ -70,13 +70,13 @@ signals: public slots: /// Run the specified effect on the given priority channel and optionally specify a timeout - int runEffect(const QString &effectName, int priority, int timeout = Effect::ENDLESS, const QString &origin="System"); + int runEffect(const QString &effectName, int priority, int timeout = PriorityMuxer::ENDLESS, const QString &origin="System"); /// Run the specified effect on the given priority channel and optionally specify a timeout int runEffect(const QString &effectName , const QJsonObject &args , int priority - , int timeout = Effect::ENDLESS + , int timeout = PriorityMuxer::ENDLESS , const QString &pythonScript = "" , const QString &origin = "System" , unsigned smoothCfg=0 @@ -103,7 +103,7 @@ private: ,const QString &name , const QJsonObject &args , int priority - , int timeout = Effect::ENDLESS + , int timeout = PriorityMuxer::ENDLESS , const QString &origin="System" , unsigned smoothCfg=0 , const QString &imageData = "" diff --git a/include/hyperion/BGEffectHandler.h b/include/hyperion/BGEffectHandler.h index ae3362f0..724f9f0e 100644 --- a/include/hyperion/BGEffectHandler.h +++ b/include/hyperion/BGEffectHandler.h @@ -55,8 +55,12 @@ private slots: { _isBgEffectConfigured = true; + #if defined(ENABLE_EFFECTENGINE) const QString bgTypeConfig = BGEffectConfig["type"].toString("effect"); const QString bgEffectConfig = BGEffectConfig["effect"].toString("Warm mood blobs"); + #else + const QString bgTypeConfig = "color"; + #endif const QJsonValue bgColorConfig = BGEffectConfig["color"]; if (bgTypeConfig.contains("color")) { @@ -70,11 +74,13 @@ private slots: _hyperion->setColor(PriorityMuxer::BG_PRIORITY, bg_color); Info(Logger::getInstance("HYPERION"),"Initial background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue); } + #if defined(ENABLE_EFFECTENGINE) else { - int result = _hyperion->setEffect(bgEffectConfig, PriorityMuxer::BG_PRIORITY, Effect::ENDLESS); + int result = _hyperion->setEffect(bgEffectConfig, PriorityMuxer::BG_PRIORITY, PriorityMuxer::ENDLESS); Info(Logger::getInstance("HYPERION"),"Initial background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed")); } + #endif } #undef BGCONFIG_ARRAY } diff --git a/include/hyperion/Hyperion.h b/include/hyperion/Hyperion.h index 27e5e5ff..8a5736ab 100644 --- a/include/hyperion/Hyperion.h +++ b/include/hyperion/Hyperion.h @@ -24,11 +24,13 @@ #include #include +#if defined(ENABLE_EFFECTENGINE) // Effect engine includes #include #include #include #include +#endif #include @@ -42,7 +44,9 @@ class ImageProcessor; class MessageForwarder; #endif class LinearColorSmoothing; +#if defined(ENABLE_EFFECTENGINE) class EffectEngine; +#endif class MultiColorAdjustment; class ColorAdjustment; class SettingsManager; @@ -138,7 +142,7 @@ public slots: /// @param clearEffect Should be true when NOT called from an effect /// @return True on success, false when priority is not found /// - bool setInput(int priority, const std::vector& ledColors, int timeout_ms = -1, bool clearEffect = true); + bool setInput(int priority, const std::vector& ledColors, int timeout_ms = PriorityMuxer::ENDLESS, bool clearEffect = true); /// /// @brief Update the current image of a priority (prev registered with registerInput()) @@ -149,7 +153,7 @@ public slots: /// @param clearEffect Should be true when NOT called from an effect /// @return True on success, false when priority is not found /// - bool setInputImage(int priority, const Image& image, int64_t timeout_ms = -1, bool clearEffect = true); + bool setInputImage(int priority, const Image& image, int64_t timeout_ms = PriorityMuxer::ENDLESS, bool clearEffect = true); /// /// Writes a single color to all the leds for the given time and priority @@ -162,7 +166,7 @@ public slots: /// @param[in] origin The setter /// @param clearEffect Should be true when NOT called from an effect /// - void setColor(int priority, const std::vector &ledColors, int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true); + void setColor(int priority, const std::vector &ledColors, int timeout_ms = PriorityMuxer::ENDLESS, const QString& origin = "System" ,bool clearEffects = true); /// /// @brief Set the given priority to inactive @@ -196,14 +200,15 @@ public slots: /// bool clear(int priority, bool forceClearAll=false); +#if defined(ENABLE_EFFECTENGINE) /// ############# /// EFFECTENGINE /// /// @brief Get a pointer to the effect engine /// @return EffectEngine instance pointer /// - EffectEngine* getEffectEngineInstance() const { return _effectEngine; } + /// /// @brief Save an effect /// @param obj The effect args @@ -222,7 +227,7 @@ public slots: /// @param effectName Name of the effec to run /// @param priority The priority channel of the effect /// @param timeout The timeout of the effect (after the timout, the effect will be cleared) - int setEffect(const QString & effectName, int priority, int timeout = Effect::ENDLESS, const QString & origin="System"); + int setEffect(const QString & effectName, int priority, int timeout = PriorityMuxer::ENDLESS, const QString & origin="System"); /// Run the specified effect on the given priority channel and optionally specify a timeout /// @param effectName Name of the effec to run @@ -232,7 +237,7 @@ public slots: int setEffect(const QString &effectName , const QJsonObject &args , int priority - , int timeout = Effect::ENDLESS + , int timeout = PriorityMuxer::ENDLESS , const QString &pythonScript = "" , const QString &origin="System" , const QString &imageData = "" @@ -249,6 +254,7 @@ public slots: /// Get the list of available effect schema files /// @return The list of available effect schema files std::list getEffectSchemas() const; +#endif /// ############# /// PRIORITYMUXER @@ -444,10 +450,12 @@ signals: /// void adjustmentChanged(); +#if defined(ENABLE_EFFECTENGINE) /// /// @brief Signal pipe from EffectEngine to external, emits when effect list has been updated /// void effectListUpdated(); +#endif /// /// @brief Emits whenever new data should be pushed to the LedDeviceWrapper which forwards it to the threaded LedDevice @@ -533,8 +541,10 @@ private: /// The smoothing LedDevice LinearColorSmoothing * _deviceSmooth; +#if defined(ENABLE_EFFECTENGINE) /// Effect engine EffectEngine * _effectEngine; +#endif #if defined(ENABLE_FORWARDER) // Message forwarder diff --git a/include/hyperion/PriorityMuxer.h b/include/hyperion/PriorityMuxer.h index 36026fbe..c8af9214 100644 --- a/include/hyperion/PriorityMuxer.h +++ b/include/hyperion/PriorityMuxer.h @@ -63,6 +63,8 @@ public: /// Timeout used to identify a non active priority const static int TIMEOUT_NOT_ACTIVE_PRIO; + const static int ENDLESS; + /// /// Constructs the PriorityMuxer for the given number of LEDs (used to switch to black when /// there are no priority channels @@ -164,7 +166,7 @@ public: /// @param timeout_ms The new timeout (defaults to -1 endless) /// @return True on success, false when priority is not found /// - bool setInput(int priority, const std::vector& ledColors, int64_t timeout_ms = -1); + bool setInput(int priority, const std::vector& ledColors, int64_t timeout_ms = ENDLESS); /// /// @brief Update the current image of a priority (prev registered with registerInput()) @@ -173,7 +175,7 @@ public: /// @param timeout_ms The new timeout (defaults to -1 endless) /// @return True on success, false when priority is not found /// - bool setInputImage(int priority, const Image& image, int64_t timeout_ms = -1); + bool setInputImage(int priority, const Image& image, int64_t timeout_ms = ENDLESS); /// /// @brief Set the given priority to inactive @@ -220,7 +222,7 @@ signals: /// /// @brief Emits whenever something changes which influences the priorities listing - /// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1 + /// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1 (endless) /// void prioritiesChanged(); diff --git a/include/utils/SysInfo.h b/include/utils/SysInfo.h index 8864ab2b..ead73623 100644 --- a/include/utils/SysInfo.h +++ b/include/utils/SysInfo.h @@ -4,6 +4,8 @@ #include #include +#include "HyperionConfig.h" + class SysInfo : public QObject { public: @@ -24,7 +26,9 @@ public: QString domainName; bool isUserAdmin; QString qtVersion; +#if defined(ENABLE_EFFECTENGINE) QString pyVersion; +#endif }; static HyperionSysInfo get(); diff --git a/include/utils/hyperion.h b/include/utils/hyperion.h index 885ac36b..1a39b65b 100644 --- a/include/utils/hyperion.h +++ b/include/utils/hyperion.h @@ -10,7 +10,9 @@ // fg effect #include #include +#if defined(ENABLE_EFFECTENGINE) #include +#endif /// /// @brief Provide utility methods for Hyperion class @@ -24,12 +26,16 @@ namespace hyperion { // initial foreground effect/color if (FGEffectConfig["enable"].toBool(true)) { + #if defined(ENABLE_EFFECTENGINE) const QString fgTypeConfig = FGEffectConfig["type"].toString("effect"); const QString fgEffectConfig = FGEffectConfig["effect"].toString("Rainbow swirl fast"); + #else + const QString fgTypeConfig = "color"; + #endif const QJsonValue fgColorConfig = FGEffectConfig["color"]; int default_fg_duration_ms = 3000; int fg_duration_ms = FGEffectConfig["duration_ms"].toInt(default_fg_duration_ms); - if (fg_duration_ms <= Effect::ENDLESS) + if (fg_duration_ms <= PriorityMuxer::ENDLESS ) { fg_duration_ms = default_fg_duration_ms; Warning(Logger::getInstance("HYPERION"), "foreground effect duration 'infinity' is forbidden, set to default value %d ms",default_fg_duration_ms); @@ -46,11 +52,13 @@ namespace hyperion { hyperion->setColor(PriorityMuxer::FG_PRIORITY, fg_color, fg_duration_ms); Info(Logger::getInstance("HYPERION","I"+QString::number(hyperion->getInstanceIndex())),"Initial foreground color set (%d %d %d)",fg_color.at(0).red,fg_color.at(0).green,fg_color.at(0).blue); } + #if defined(ENABLE_EFFECTENGINE) else { int result = hyperion->setEffect(fgEffectConfig, PriorityMuxer::FG_PRIORITY, fg_duration_ms); Info(Logger::getInstance("HYPERION","I"+QString::number(hyperion->getInstanceIndex())),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed")); } + #endif } #undef FGCONFIG_ARRAY } diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 54416aa4..cc18654d 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -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() diff --git a/libsrc/api/API.cpp b/libsrc/api/API.cpp index c2a0acdd..a4969978 100644 --- a/libsrc/api/API.cpp +++ b/libsrc/api/API.cpp @@ -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) { diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index e6513767..094b0eb0 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -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 &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& 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); diff --git a/libsrc/api/JsonCB.cpp b/libsrc/api/JsonCB.cpp index fce3fedd..5b151784 100644 --- a/libsrc/api/JsonCB.cpp +++ b/libsrc/api/JsonCB.cpp @@ -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) { diff --git a/libsrc/effectengine/Effect.cpp b/libsrc/effectengine/Effect.cpp index b30335fd..a03ed570 100644 --- a/libsrc/effectengine/Effect.cpp +++ b/libsrc/effectengine/Effect.cpp @@ -8,18 +8,17 @@ #include #include #include +#include // python utils #include -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) diff --git a/libsrc/hyperion/CMakeLists.txt b/libsrc/hyperion/CMakeLists.txt index 115b0770..538d2278 100644 --- a/libsrc/hyperion/CMakeLists.txt +++ b/libsrc/hyperion/CMakeLists.txt @@ -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() diff --git a/libsrc/hyperion/Hyperion.cpp b/libsrc/hyperion/Hyperion.cpp index 0c1b7c84..f497f244 100644 --- a/libsrc/hyperion/Hyperion.cpp +++ b/libsrc/hyperion/Hyperion.cpp @@ -28,8 +28,10 @@ #include #include "LinearColorSmoothing.h" +#if defined(ENABLE_EFFECTENGINE) // effect engine includes #include +#endif // settingsManagaer #include @@ -56,7 +58,9 @@ Hyperion::Hyperion(quint8 instance, bool readonlyMode) , _raw2ledAdjustment(hyperion::createLedColorsAdjustment(static_cast(_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(_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& 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& 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 &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 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) { diff --git a/libsrc/hyperion/PriorityMuxer.cpp b/libsrc/hyperion/PriorityMuxer.cpp index 39cb58e0..fd32c48a 100644 --- a/libsrc/hyperion/PriorityMuxer.cpp +++ b/libsrc/hyperion/PriorityMuxer.cpp @@ -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::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(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); diff --git a/libsrc/leddevice/CMakeLists.txt b/libsrc/leddevice/CMakeLists.txt index 69a4db4c..f71faffe 100644 --- a/libsrc/leddevice/CMakeLists.txt +++ b/libsrc/leddevice/CMakeLists.txt @@ -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() diff --git a/libsrc/utils/CMakeLists.txt b/libsrc/utils/CMakeLists.txt index f7ed1194..b56a65b0 100644 --- a/libsrc/utils/CMakeLists.txt +++ b/libsrc/utils/CMakeLists.txt @@ -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() diff --git a/libsrc/utils/SysInfo.cpp b/libsrc/utils/SysInfo.cpp index 7d0409b3..da8758c7 100644 --- a/libsrc/utils/SysInfo.cpp +++ b/libsrc/utils/SysInfo.cpp @@ -1,5 +1,9 @@ +#include "HyperionConfig.h" + +#if defined(ENABLE_EFFECTENGINE) // Python includes #include +#endif #include "utils/SysInfo.h" #include "utils/FileUtils.h" @@ -10,6 +14,9 @@ #include #include +#ifndef _WIN32 +#include +#endif #ifdef _WIN32 #include @@ -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() diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index ab47420a..ab2b6508 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -30,7 +30,6 @@ add_executable(${PROJECT_NAME} ) target_link_libraries(${PROJECT_NAME} - effectengine commandline hyperion-utils ssdp @@ -45,6 +44,10 @@ if (ENABLE_AMLOGIC) ) endif() +if(ENABLE_EFFECTENGINE) + target_link_libraries(${PROJECT_NAME} effectengine) +endif() + if(APPLE) install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_remote" ) elseif(NOT WIN32) diff --git a/src/hyperion-remote/JsonConnection.cpp b/src/hyperion-remote/JsonConnection.cpp index 5641f4a7..6c139de4 100644 --- a/src/hyperion-remote/JsonConnection.cpp +++ b/src/hyperion-remote/JsonConnection.cpp @@ -12,6 +12,8 @@ #include #include +#include "HyperionConfig.h" + // hyperion-remote includes #include "JsonConnection.h" @@ -106,6 +108,7 @@ void JsonConnection::setImage(QImage &image, int priority, int duration) parseReply(reply); } +#if defined(ENABLE_EFFECTENGINE) void JsonConnection::setEffect(const QString &effectName, const QString & effectArgs, int priority, int duration) { Debug(_log, "Start effect: %s", QSTRING_CSTR(effectName)); @@ -185,6 +188,7 @@ void JsonConnection::deleteEffect(const QString &effectName) // parse reply message parseReply(reply); } +#endif QString JsonConnection::getServerInfoString() { diff --git a/src/hyperion-remote/JsonConnection.h b/src/hyperion-remote/JsonConnection.h index 6082ae8f..c04a52d8 100644 --- a/src/hyperion-remote/JsonConnection.h +++ b/src/hyperion-remote/JsonConnection.h @@ -49,6 +49,7 @@ public: /// void setImage(QImage &image, int priority, int duration); +#if defined(ENABLE_EFFECTENGINE) /// /// Start the given effect /// @@ -74,6 +75,7 @@ public: /// @param effectName The name of the effect /// void deleteEffect(const QString &effectName); +#endif /// /// Retrieve entire serverinfo as String diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index d13a5119..789aa458 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -100,11 +100,13 @@ int main(int argc, char * argv[]) IntOption & argDuration = parser.add ('d', "duration" , "Specify how long the LEDs should be switched on in milliseconds [default: infinity]"); ColorsOption & argColor = parser.add ('c', "color" , "Set all LEDs to a constant color (either RRGGBB hex getColors or a color name. The color may be repeated multiple time like: RRGGBBRRGGBB)"); ImageOption & argImage = parser.add ('i', "image" , "Set the LEDs to the colors according to the given image file"); +#if defined(ENABLE_EFFECTENGINE) Option & argEffect = parser.add