diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh deleted file mode 100755 index df276f00..00000000 --- a/.ci/ci_build.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# detect CI -if [ "$HOME" != "" ]; then - # GitHub Actions - echo "Github Actions detected" - CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" - CI_BUILD_DIR="$GITHUB_WORKSPACE" -else - # for executing in non ci environment - CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" -fi - -# set environment variables if not exists -[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Debug" - -# Determine cmake build type; tag builds are Release, else Debug (-dev appends to platform) -if [[ $BUILD_SOURCEBRANCH == *"refs/tags"* || $GITHUB_REF == *"refs/tags"* ]]; then - BUILD_TYPE=Release -else - PLATFORM=${PLATFORM}-dev -fi - -echo "Platform: ${PLATFORM}, build type: ${BUILD_TYPE}, CI_NAME: $CI_NAME, docker image: ${DOCKER_IMAGE}, docker type: ${DOCKER_TAG}" - -# Build the package on osx or linux -if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then - echo "Compile Hyperion on OSX or Darwin" - # compile prepare - mkdir build || exit 1 - cd build - cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2 - make -j $(sysctl -n hw.ncpu) package || exit 3 - cd ${CI_BUILD_DIR} && source /${CI_BUILD_DIR}/test/testrunner.sh || exit 4 - exit 0; - exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; } -elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then - echo "Compile Hyperion on Windows" - # compile prepare - echo "Number of Cores $NUMBER_OF_PROCESSORS" - mkdir build || exit 1 - cd build - cmake -G "Visual Studio 17 2022" -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE="Release" ../ || exit 2 - cmake --build . --target package --config "Release" -- -nologo -v:m -maxcpucount || exit 3 - exit 0; - exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; } -elif [[ "$CI_NAME" == 'linux' ]]; then - echo "Compile Hyperion with DOCKER_IMAGE = ${DOCKER_IMAGE}, DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}" - # set GitHub Container Registry url - REGISTRY_URL="ghcr.io/hyperion-project/${DOCKER_IMAGE}" - # take ownership of deploy dir - mkdir ${CI_BUILD_DIR}/deploy - - # run docker - docker run --rm \ - -v "${CI_BUILD_DIR}/deploy:/deploy" \ - -v "${CI_BUILD_DIR}:/source:ro" \ - $REGISTRY_URL:$DOCKER_TAG \ - /bin/bash -c "mkdir hyperion && cp -r source/. /hyperion && - cd /hyperion && mkdir build && cd build && - cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ../ || exit 2 && - make -j $(nproc) package || exit 3 && - cp /hyperion/build/bin/h* /deploy/ 2>/dev/null || : && - cp /hyperion/build/Hyperion-* /deploy/ 2>/dev/null || : && - cd /hyperion && source /hyperion/test/testrunner.sh || exit 4 && - exit 0; - exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; } - - # overwrite file owner to current user - sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy -fi diff --git a/.ci/ci_install.sh b/.ci/ci_install.sh deleted file mode 100755 index 86c6ffd4..00000000 --- a/.ci/ci_install.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# detect CI -if [ "$HOME" != "" ]; then - # GitHub Actions - CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" - CI_BUILD_DIR="$GITHUB_WORKSPACE" -else - # for executing in non ci environment - CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" -fi - -function installAndUpgrade() -{ - arr=("$@") - for i in "${arr[@]}"; - do - list_output=`brew list --formula | grep $i` - outdated_output=`brew outdated | grep $i` - - if [[ ! -z "$list_output" ]]; then - if [[ ! -z "$outdated_output" ]]; then - echo "Outdated package: ${outdated_output}" - brew unlink ${outdated_output} - brew upgrade $i - brew link --overwrite $i - fi - else - brew install $i - fi - done -} - -# install osx deps for hyperion compile -if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then - echo "Install dependencies" - brew update - dependencies=("qt5" "python" "libusb" "cmake" "doxygen") - installAndUpgrade "${dependencies[@]}" -fi diff --git a/.codedocs b/.codedocs deleted file mode 100644 index ead816de..00000000 --- a/.codedocs +++ /dev/null @@ -1,76 +0,0 @@ -# Hyperion.NG .codedocs Configuration File - -#--------------------------------------------------------------------------- -# CodeDocs Configuration -#--------------------------------------------------------------------------- - -# Include the Doxygen configuration from another file. -# The file must be a relative path with respect to the root of the repository. - -DOXYFILE = - -# Specify external repository to link documentation with. -# This is similar to Doxygen's TAGFILES option, but will automatically link to -# tags of other repositories already using CodeDocs. List each repository to -# link with by giving its location in the form of owner/repository. -# For example: -# TAGLINKS = doxygen/doxygen CodeDocs/osg -# Note: these repositories must already be built on CodeDocs. - -TAGLINKS = - -#--------------------------------------------------------------------------- -# Doxygen Configuration -#--------------------------------------------------------------------------- - -# Doxygen configuration may also be placed in this file. -# Currently, the following Doxygen configuration options are available. Refer -# to http://doxygen.org/manual/config.html for detailed explanation of the -# options. To request support for more options, contact support@codedocs.xyz. -# -# ABBREVIATE_BRIEF = -# ALIASES = -# ALPHABETICAL_INDEX = -# ALWAYS_DETAILED_SEC = -# CASE_SENSE_NAMES = -# CLASS_DIAGRAMS = -# DISABLE_INDEX = -# DISTRIBUTE_GROUP_DOC = -# EXAMPLE_PATH = - EXCLUDE = .ci/ \ - assets/ \ - bin/ - config/ \ - effects/ \ - test/ \ -# EXCLUDE_PATTERNS = -# EXCLUDE_SYMBOLS = -# EXTENSION_MAPPING = -# EXTRACT_LOCAL_CLASSES = -# FILE_PATTERNS = -# GENERATE_TAGFILE = -# GENERATE_TREEVIEW = -# HIDE_COMPOUND_REFERENCE = -# HIDE_SCOPE_NAMES = -# HIDE_UNDOC_CLASSES = -# HIDE_UNDOC_MEMBERS = -# HTML_TIMESTAMP = -# INLINE_GROUPED_CLASSES = -# INPUT_ENCODING = -# INTERNAL_DOCS = -# OPTIMIZE_OUTPUT_FOR_C = - PROJECT_BRIEF = "The successor to Hyperion aka Hyperion Next Generation" - PROJECT_NAME = "Hyperion.NG" -# PROJECT_NUMBER = -# SHORT_NAMES = -# SHOW_FILES = -# SHOW_INCLUDE_FILES = -# SHOW_NAMESPACES = -# SORT_BRIEF_DOCS = -# SORT_BY_SCOPE_NAME = -# SORT_MEMBER_DOCS = -# STRICT_PROTO_MATCHING = -# TYPEDEF_HIDES_STRUCT = - USE_MDFILE_AS_MAINPAGE = README.md -# VERBATIM_HEADERS = -# diff --git a/.devcontainer.json b/.devcontainer.json index 4cce9be7..966a658b 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,20 +1,25 @@ { "name": "Hyperion.ng Linux", - "extensions": [ - "twxs.cmake", - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", - "spmeesseman.vscode-taskexplorer", - "yzhang.markdown-all-in-one", - "CoenraadS.bracket-pair-colorizer", - "vscode-icons-team.vscode-icons", - "editorconfig.editorconfig" - ], - "settings": { - "editor.formatOnSave": false, - "cmake.environment": { - }, - }, + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "extensions": [ + "twxs.cmake", + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "spmeesseman.vscode-taskexplorer", + "yzhang.markdown-all-in-one", + "CoenraadS.bracket-pair-colorizer", + "vscode-icons-team.vscode-icons", + "editorconfig.editorconfig", + "RVSmartPorting.rpm-spec-ext" + ], + "settings": { + "editor.formatOnSave": false, + "cmake.environment": { } + } + } + }, "forwardPorts": [8090, 8092], - "postCreateCommand": "git submodule update --recursive --init && sudo apt-get update && sudo apt-get install -y git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libssl-dev" + "postCreateCommand": "git submodule update --recursive --init && sudo apt-get update && sudo apt-get install -y git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libssl-dev libasound2-dev" } diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100755 index 00000000..7c917fda --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# set environment variables if not exists +[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Debug" +[ -z "${TARGET_ARCH}" ] && TARGET_ARCH="linux/amd64" +[ -z "${PLATFORM}" ] && PLATFORM="x11" + +# Determine cmake build type; tag builds are Release, else Debug (-dev appends to platform) +if [[ $GITHUB_REF == *"refs/tags"* ]]; then + BUILD_TYPE=Release +else + PLATFORM=${PLATFORM}-dev +fi + +echo "Compile Hyperion on '${RUNNER_OS}' with build type '${BUILD_TYPE}' and platform '${PLATFORM}'" + +# Build the package on MacOS, Windows or Linux +if [[ "$RUNNER_OS" == 'macOS' ]]; then + mkdir build || exit 1 + cmake -B build -G Ninja -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local || exit 2 + cmake --build build --target package --parallel $(sysctl -n hw.ncpu) || exit 3 + cd ${GITHUB_WORKSPACE} && source /${GITHUB_WORKSPACE}/test/testrunner.sh || exit 4 + exit 0; + exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; } +elif [[ $RUNNER_OS == "Windows" ]]; then + echo "Number of Cores $NUMBER_OF_PROCESSORS" + mkdir build || exit 1 + cd build + cmake -G "Visual Studio 17 2022" -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE="Release" ../ || exit 2 + cmake --build . --target package --config "Release" -- -nologo -v:m -maxcpucount || exit 3 + exit 0; + exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; } +elif [[ "$RUNNER_OS" == 'Linux' ]]; then + echo "Docker arguments used: DOCKER_IMAGE=${DOCKER_IMAGE}, DOCKER_TAG=${DOCKER_TAG}, TARGET_ARCH=${TARGET_ARCH}" + # verification bypass of external dependencies + # set GitHub Container Registry url + REGISTRY_URL="ghcr.io/hyperion-project/${DOCKER_IMAGE}" + # take ownership of deploy dir + mkdir ${GITHUB_WORKSPACE}/deploy + + # run docker + docker run --rm --platform=${TARGET_ARCH} \ + -v "${GITHUB_WORKSPACE}/deploy:/deploy" \ + -v "${GITHUB_WORKSPACE}:/source:rw" \ + $REGISTRY_URL:$DOCKER_TAG \ + /bin/bash -c "mkdir -p /source/build && cd /source/build && + cmake -G Ninja -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 && + cmake --build . --target package -- -j $(nproc) || exit 3 || : && + cp /source/build/bin/h* /deploy/ 2>/dev/null || : && + cp /source/build/Hyperion-* /deploy/ 2>/dev/null || : && + cd /source && source /source/test/testrunner.sh || exit 5 && + exit 0; + exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; } + + # overwrite file owner to current user + sudo chown -fR $(stat -c "%U:%G" ${GITHUB_WORKSPACE}/deploy) ${GITHUB_WORKSPACE}/deploy +fi diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml deleted file mode 100644 index fc5eca13..00000000 --- a/.github/workflows/apt.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: Hyperion APT Build -on: - workflow_call: - secrets: - APT_GPG: - required: true - APT_USER: - required: true - APT_PASSWORD: - required: true - APT_DRAFT: - required: true - -jobs: - setup: - name: Setup APT build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set APT matrix - id: apt-ppa - run: | - APT=$(jq -n '.include |= [ inputs[] | select(.["exclude"] != true)]' .github/workflows/apt/*.json --compact-output) - echo "apt=$APT" >> $GITHUB_OUTPUT - - outputs: - apt-matrix: ${{ steps.apt-ppa.outputs.apt }} - - build: - name: ${{ matrix.description }} - needs: [setup] - runs-on: ubuntu-latest - strategy: - matrix: ${{ fromJson(needs.setup.outputs.apt-matrix) }} - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Generate environment variables - run: | - tr -d '\n' < .version > temp && mv temp .version - VERSION=$(cat .version) - echo VERSION=${VERSION} >> $GITHUB_ENV - if [[ $VERSION == *"-"* ]]; then - echo STANDARDS_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV - echo TARBALL_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV - echo DEBIAN_FORMAT='3.0 (quilt)' >> $GITHUB_ENV - else - echo STANDARDS_VERSION=$(echo ${VERSION%+*}) >> $GITHUB_ENV - echo TARBALL_VERSION=${VERSION}~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - echo DEBIAN_FORMAT='3.0 (native)' >> $GITHUB_ENV - fi - echo DISTRIBUTION=$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - - - name: Build package - shell: bash - run: | - mkdir -p "${GITHUB_WORKSPACE}/deploy" - docker run --rm \ - -v "${GITHUB_WORKSPACE}/deploy:/deploy" \ - -v "${GITHUB_WORKSPACE}:/source:rw" \ - ghcr.io/hyperion-project/${{ matrix.architecture }}:${{ env.DISTRIBUTION }} \ - /bin/bash -c "cd /source && \ - mkdir -p debian/source && echo '${{ env.DEBIAN_FORMAT }}' > debian/source/format && \ - dch --create --distribution ${{ env.DISTRIBUTION }} --package 'hyperion' -v '${{ env.VERSION }}~${{ env.DISTRIBUTION }}' '${{ github.event.commits[0].message }}' && \ - cp -fr LICENSE debian/copyright && \ - sed 's/@BUILD_DEPENDS@/${{ matrix.build-depends }}/g; s/@DEPENDS@/${{ matrix.package-depends }}/g; s/@ARCHITECTURE@/${{ matrix.architecture }}/g; s/@STANDARDS_VERSION@/${{ env.STANDARDS_VERSION }}/g' debian/control.in > debian/control && \ - sed 's/@CMAKE_ENVIRONMENT@/${{ matrix.cmake-environment }}/g' debian/rules.in > debian/rules && \ - tar -cJf ../hyperion_${{ env.TARBALL_VERSION }}.orig.tar.xz . && \ - debuild --no-lintian -uc -us && \ - cp ../hyperion_*.deb /deploy" - - - name: Upload package artifact - if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-artifact@v3 - with: - path: deploy - retention-days: 1 - - publish: - name: Publish APT packages - if: startsWith(github.event.ref, 'refs/tags') - needs: [setup, build] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5.2.0 - with: - gpg_private_key: ${{ secrets.APT_GPG }} - - - name: Install reprepro - run: sudo apt -y install reprepro - - - name: Make build folders, export public GPG key and copy distributions file - run: | - mkdir -p apt/{conf,dists,db} - gpg --armor --output apt/hyperion.pub.key --export 'admin@hyperion-project.org' - cp debian/distributions apt/conf/distributions - - - name: Create initial structure/packages files and symbolic links - run: | - reprepro -Vb apt createsymlinks - reprepro -Vb apt export - - - name: Download artifacts - uses: actions/download-artifact@v3.0.2 - - - name: Include artifacts into the package source - run: | - for file in artifact/hyperion_*.deb; do - if [ -f "$file" ]; then - dist=${file#*~} - dist=${dist%_*} - reprepro -Vb apt/ includedeb "$dist" "$file" - fi - done - - - name: Upload packages to APT server (DRAFT) - uses: SamKirkland/FTP-Deploy-Action@4.3.3 - with: - server: apt.hyperion-project.org - username: ${{ secrets.APT_USER }} - password: ${{ secrets.APT_PASSWORD }} - local-dir: "./apt/" - server-dir: ${{ secrets.APT_DRAFT }} - dangerous-clean-slate: true diff --git a/.github/workflows/apt/amd64.json b/.github/workflows/apt/amd64.json deleted file mode 100644 index 9e0cce1b..00000000 --- a/.github/workflows/apt/amd64.json +++ /dev/null @@ -1,66 +0,0 @@ -[ - { - "distribution": "Bionic", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl1.0-dev, libmbedtls-dev", - "package-depends": "libpython3.6, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls10, libasound2, libturbojpeg, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 18.04 (Bionic Beaver) (amd64)" - }, - { - "distribution": "Focal", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.8, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libasound2, libturbojpeg, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 20.04 (Focal Fossa) (amd64)" - }, - { - "distribution": "Jammy", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libasound2, libturbojpeg, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.04 (Jammy Jellyfish) (amd64)" - }, - { - "distribution": "Kinetic", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libasound2, libturbojpeg, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.10 (Kinetic Kudu) (amd64)" - }, - { - "distribution": "Stretch", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl1.0-dev, libmbedtls-dev", - "package-depends": "libpython3.5, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls10, libasound2, libturbojpeg0, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 9.x (Stretch) (amd64)" - }, - { - "distribution": "Buster", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.7, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libasound2, libturbojpeg0, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 10.x (Buster) (amd64)" - }, - { - "distribution": "Bullseye", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libasound2, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 11.x (Bullseye) (amd64)" - }, - { - "distribution": "Bookworm", - "architecture": "amd64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libasound2, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 12.x (Bookworm) (amd64)" - } -] diff --git a/.github/workflows/apt/arm64.json b/.github/workflows/apt/arm64.json deleted file mode 100644 index 8cc8b2e5..00000000 --- a/.github/workflows/apt/arm64.json +++ /dev/null @@ -1,59 +0,0 @@ -[ - { - "distribution": "Bionic", - "architecture": "arm64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl1.0-dev, libmbedtls-dev", - "package-depends": "libpython3.6, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls10, libturbojpeg, libcec4", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 18.04 (Bionic Beaver) (arm64)" - }, - { - "distribution": "Focal", - "architecture": "arm64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.8, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg, libcec4", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 20.04 (Focal Fossa) (arm64)" - }, - { - "distribution": "Jammy", - "architecture": "arm64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libturbojpeg, libcec6", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.04 (Jammy Jellyfish) (arm64)" - }, - { - "distribution": "Kinetic", - "architecture": "arm64", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libturbojpeg, libcec6", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.10 (Kinetic Kudu) (arm64)" - }, - { - "distribution": "Buster", - "architecture": "arm64", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.7, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 10.x (Buster) (arm64)" - }, - { - "distribution": "Bullseye", - "architecture": "arm64", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 11.x (Bullseye) (arm64)" - }, - { - "distribution": "Bookworm", - "architecture": "arm64", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 12.x (Bookworm) (arm64)", - "exclude" : true - } -] diff --git a/.github/workflows/apt/armhf.json b/.github/workflows/apt/armhf.json deleted file mode 100644 index f7f5aa3c..00000000 --- a/.github/workflows/apt/armhf.json +++ /dev/null @@ -1,67 +0,0 @@ -[ - { - "distribution": "Bionic", - "architecture": "armhf", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl1.0-dev, libmbedtls-dev", - "package-depends": "libpython3.6, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls10, libturbojpeg, libcec4", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 18.04 (Bionic Beaver) (armhf)" - }, - { - "distribution": "Focal", - "architecture": "armhf", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.8, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg, libcec4", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 20.04 (Focal Fossa) (armhf)" - }, - { - "distribution": "Jammy", - "architecture": "armhf", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libturbojpeg, libcec6", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.04 (Jammy Jellyfish) (armhf)" - }, - { - "distribution": "Kinetic", - "architecture": "armhf", - "build-depends": "git, cmake, build-essential, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, libqt5x11extras5-dev, libusb-1.0-0-dev, python3-dev, libcec-dev, libxcb-image0-dev, libxcb-util0-dev, libxcb-shm0-dev, libxcb-render0-dev, libxcb-randr0-dev, libxrandr-dev, libxrender-dev, libturbojpeg0-dev, libjpeg-dev, libssl-dev, libmbedtls-dev", - "package-depends": "libpython3.10, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libturbojpeg, libcec6", - "cmake-environment": "-DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DENABLE_XCB=ON -DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Ubuntu 22.10 (Kinetic Kudu) (armhf)" - }, - { - "distribution": "Stretch", - "architecture": "armhf", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl1.0-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.5, libusb-1.0-0, libqt5widgets5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls10, libturbojpeg0, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description":"Debian 9.x (Stretch) (armhf)" - }, - { - "distribution": "Buster", - "architecture": "armhf", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl1.0-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.7, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec4", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 10.x (Buster) (armhf)" - }, - { - "distribution": "Bullseye", - "architecture": "armhf", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 11.x (Bullseye) (armhf)" - }, - { - "distribution": "Bookworm", - "architecture": "armhf", - "build-depends": "git, cmake, python3-dev, qtbase5-dev, libqt5serialport5-dev, libqt5sql5-sqlite, libqt5svg5-dev, build-essential, libusb-1.0-0-dev, libcec-dev, libssl-dev, libraspberrypi-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.9, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls12, libturbojpeg0, libcec6", - "cmake-environment": "-DUSE_SYSTEM_MBEDTLS_LIBS=ON -DENABLE_DEPLOY_DEPENDENCIES=OFF -DCMAKE_BUILD_TYPE=Release", - "description": "Debian 12.x (Bookworm) (armhf)", - "exclude" : true - } -] diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 95ab9fd7..48c42fb0 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -1,4 +1,4 @@ -name: Clean artifacts +name: ๐Ÿงน Cleanup old artifacts # Run cleanup workflow at the end of every day on: @@ -9,7 +9,7 @@ jobs: clean: runs-on: ubuntu-latest steps: - - name: cleanup + - name: ๐Ÿงน Cleanup old workflow artifacts uses: kolpav/purge-artifacts-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ac3b57ba..b557cbf7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,8 @@ -name: "CodeQL" +name: ๐Ÿ“Š CodeQL +run-name: | + ${{ github.event_name == 'schedule' && 'โฐ Scheduled CodeQL run' || '' }} + ${{ github.event_name == 'push' && format('๐Ÿ“Š Pushed CodeQL run - {0}', github.event.head_commit.message) || '' }} + ${{ github.event_name == 'pull_request' && format('๐Ÿ“Š CodeQL run for PR {0} - {1}', github.event.pull_request.number, github.event.pull_request.title) || github.event.head_commit.message }} on: push: @@ -10,7 +14,7 @@ on: jobs: analyze: - name: Analyze + name: ๐Ÿ“Š Analyze runs-on: ubuntu-latest permissions: actions: read @@ -23,35 +27,35 @@ jobs: language: [ python, javascript, cpp ] steps: - - name: Checkout - uses: actions/checkout@v3 + - name: โฌ‡ Checkout + uses: actions/checkout@v4 with: submodules: recursive - - name: Install Packages (cpp) + - name: ๐Ÿ“ฅ Install Packages (cpp) if: ${{ matrix.language == 'cpp' }} run: | sudo apt-get update sudo apt-get install --yes git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + - name: ๐Ÿ” Initialize CodeQL + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: +security-and-quality config-file: ./.github/config/codeql.yml - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + - name: ๐Ÿ‘ท Autobuild + uses: github/codeql-action/autobuild@v3 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: ๐Ÿƒ Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 with: category: "/language:${{ matrix.language }}" upload: False output: sarif-results - - name: Filter SARIF + - name: ๐Ÿ†” Filter SARIF uses: advanced-security/filter-sarif@v1 with: patterns: | @@ -63,14 +67,15 @@ jobs: input: sarif-results/${{ matrix.language }}.sarif output: sarif-results/${{ matrix.language }}.sarif - - name: Upload SARIF - uses: github/codeql-action/upload-sarif@v2 + - name: ๐Ÿ“ฆ Upload SARIF + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: sarif-results/${{ matrix.language }}.sarif - - name: Upload loc as a Build Artifact - uses: actions/upload-artifact@v2.2.0 + + - name: ๐Ÿ“ฆ Upload loc as a Build Artifact + uses: actions/upload-artifact@v4 with: - name: sarif-results + name: ${{ matrix.language }}.sarif path: sarif-results retention-days: 1 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 75365c4c..00000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,187 +0,0 @@ -name: Nightly build - -# Create nightly builds at the end of every day -on: - schedule: - - cron: '0 0 * * *' - repository_dispatch: - types: [hyperion_nightly_push] - -jobs: - update: - name: Update Submodule rpi_ws281x - if: github.repository_owner == 'hyperion-project' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - submodules: recursive - - - name: Update Submodule rpi_ws281x - id: update - run: git submodule update --remote --recursive dependencies/external/rpi_ws281x - - - name: Check git status - id: status - run: echo "status=$(git status -s)" >> $GITHUB_OUTPUT - - - name: Add and commit changes - if: ${{ steps.status.outputs.status }} - run: | - git config --local user.email "20935312+Hyperion-Bot@users.noreply.github.com" - git config --local user.name "Hyperion-Bot" - git config --local diff.ignoreSubmodules dirty - git commit -am "Update submodule rpi_ws281x" - - - name: Push changes - if: ${{ steps.status.outputs.status }} - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.HYPERION_BOT_TOKEN }} - branch: ${{ github.ref }} - - check: - name: Compare local <-> nightly - needs: [update] - if: github.repository_owner == 'hyperion-project' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check if commit has changed - id: build-necessary - run: | - if wget --spider "https://nightly.apt.hyperion-project.org/$(git rev-parse --short HEAD)" 2>/dev/null; then - echo "commit-has-changed=false" >> $GITHUB_OUTPUT - else - echo "commit-has-changed=true" >> $GITHUB_OUTPUT - fi - outputs: - build-nightly: ${{ steps.build-necessary.outputs.commit-has-changed }} - - setup: - name: Setup nightly build - needs: [check] - if: ${{ needs.check.outputs.build-nightly == 'true' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set nightly matrix - id: nightly-ppa - run: | - NIGHTLY=$(jq -n '.include |= [ inputs[] | select(.["exclude"] != true)]' .github/workflows/apt/*.json --compact-output) - echo "nightly=$NIGHTLY" >> $GITHUB_OUTPUT - - outputs: - nightly-matrix: ${{ steps.nightly-ppa.outputs.nightly }} - - build: - name: ${{ matrix.description }} - needs: [setup] - runs-on: ubuntu-latest - strategy: - matrix: ${{ fromJson(needs.setup.outputs.nightly-matrix) }} - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Generate environment variables - run: | - echo "$(tr -d '\n' < .version)+nightly$(date '+%Y%m%d')$(git rev-parse --short HEAD)" > .version - VERSION=$(cat .version) - echo VERSION=${VERSION} >> $GITHUB_ENV - if [[ $VERSION == *"-"* ]]; then - echo STANDARDS_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV - echo TARBALL_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV - echo DEBIAN_FORMAT='3.0 (quilt)' >> $GITHUB_ENV - else - echo STANDARDS_VERSION=$(echo ${VERSION%+*}) >> $GITHUB_ENV - echo TARBALL_VERSION=${VERSION}~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - echo DEBIAN_FORMAT='3.0 (native)' >> $GITHUB_ENV - fi - echo DISTRIBUTION=$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - - - name: Build package - shell: bash - run: | - mkdir -p "${GITHUB_WORKSPACE}/deploy" - docker run --rm \ - -v "${GITHUB_WORKSPACE}/deploy:/deploy" \ - -v "${GITHUB_WORKSPACE}:/source:rw" \ - ghcr.io/hyperion-project/${{ matrix.architecture }}:${{ env.DISTRIBUTION }} \ - /bin/bash -c "cd /source && \ - mkdir -p debian/source && echo '${{ env.DEBIAN_FORMAT }}' > debian/source/format && \ - dch --create --distribution ${{ env.DISTRIBUTION }} --package 'hyperion' -v '${{ env.VERSION }}~${{ env.DISTRIBUTION }}' '${{ github.event.commits[0].message }}' && \ - cp -fr LICENSE debian/copyright && \ - sed 's/@BUILD_DEPENDS@/${{ matrix.build-depends }}/g; s/@DEPENDS@/${{ matrix.package-depends }}/g; s/@ARCHITECTURE@/${{ matrix.architecture }}/g; s/@STANDARDS_VERSION@/${{ env.STANDARDS_VERSION }}/g' debian/control.in > debian/control && \ - sed 's/@CMAKE_ENVIRONMENT@/${{ matrix.cmake-environment }}/g' debian/rules.in > debian/rules && \ - tar -cJf ../hyperion_${{ env.TARBALL_VERSION }}.orig.tar.xz . && \ - debuild --no-lintian -uc -us && \ - cp ../hyperion_*.deb /deploy" - - - name: Upload package artifact - uses: actions/upload-artifact@v3 - with: - path: deploy - retention-days: 1 - - publish: - name: Publish nightly packages - needs: [setup, build] - if: github.repository_owner == 'hyperion-project' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5.2.0 - with: - gpg_private_key: ${{ secrets.APT_GPG }} - - - name: Install reprepro - run: sudo apt -y install reprepro - - - name: Make build folders, export public GPG key, copy distributions file and create short sha file for nightly build check - run: | - mkdir -p nightly/{conf,dists,db} - gpg --armor --output nightly/hyperion.pub.key --export 'admin@hyperion-project.org' - cp debian/distributions nightly/conf/distributions - touch "nightly/$(git rev-parse --short HEAD)" - - - name: Create initial structure/packages files and symbolic links - run: | - reprepro -Vb nightly createsymlinks - reprepro -Vb nightly export - - - name: Download artifacts - uses: actions/download-artifact@v3.0.2 - - - name: Include artifacts into the package source - run: | - for file in artifact/*.deb; do - if [ -f "$file" ]; then - dist=${file#*~} - dist=${dist%_*} - reprepro -Vb nightly/ includedeb "$dist" "$file" - fi - done - - - name: Upload packages to nightly server - uses: SamKirkland/FTP-Deploy-Action@4.3.3 - with: - server: nightly.apt.hyperion-project.org - username: ${{ secrets.NIGHTLY_USER }} - password: ${{ secrets.NIGHTLY_PASSWORD }} - local-dir: "./nightly/" - server-dir: "./" - dangerous-clean-slate: true - - - name: Remove intermediate artifacts - uses: geekyeggo/delete-artifact@v2 - with: - name: artifact - failOnError: false diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 4aab0779..00000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,192 +0,0 @@ -name: Hyperion PR Build -on: - pull_request: - branches: - - master - -jobs: - -###################### -###### Linux ######### -###################### - - Linux: - name: ${{ matrix.dockerName }} - runs-on: ubuntu-latest - strategy: - matrix: - dockerImage: [ x86_64, armv6l, armv7l, aarch64 ] - include: - - dockerImage: x86_64 - dockerName: Debian Stretch (x86_64) - platform: x11 - - dockerImage: armv6l - dockerName: Debian Stretch (Raspberry Pi v1 & ZERO) - platform: rpi - - dockerImage: armv7l - dockerName: Debian Stretch (Raspberry Pi 2 & 3) - platform: rpi - - dockerImage: aarch64 - dockerName: Debian Stretch (Generic AARCH64) - platform: amlogic - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - # Append PR number to .version - - name: Append PR number to version - shell: bash - run: | - tr -d '\n' < .version > temp && mv temp .version - echo -n "+PR${{ github.event.pull_request.number }}" >> .version - - # Build packages - - name: Build packages - env: - DOCKER_IMAGE: ${{ matrix.dockerImage }} - DOCKER_TAG: stretch - DOCKER_NAME: ${{ matrix.dockerName }} - PLATFORM: ${{ matrix.platform }} - shell: bash - run: ./.ci/ci_build.sh - - # Collecting deployable artifacts - - name: Collecting deployable artifacts - shell: bash - run: | - mkdir -p ${{ matrix.dockerImage }} - mv deploy/*.tar.gz ${{ matrix.dockerImage }} - - # Upload artifacts - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.dockerImage }} - path: ${{ matrix.dockerImage }} - -###################### -###### macOS ######### -###################### - - macOS: - name: macOS - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - # Append PR number to .version - - name: Append PR number to version - shell: bash - run: | - tr -d '\n' < .version > temp && mv temp .version - echo -n "+PR${{ github.event.pull_request.number }}" >> .version - - # Install dependencies - - name: Install dependencies - shell: bash - run: ./.ci/ci_install.sh - - # Build packages - - name: Build packages - env: - PLATFORM: osx - shell: bash - run: ./.ci/ci_build.sh - - # Collecting deployable artifacts - - name: Collecting deployable artifacts - shell: bash - run: | - mkdir -p macOS - mv build/*.dmg macOS - - # Upload artifacts - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: macOS - path: macOS - -###################### -###### Windows ####### -###################### - - windows: - name: Windows - runs-on: windows-2022 - env: - VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' - QT_VERSION: 5.15.2 - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - # Append PR number to .version - - name: Append PR number to version - shell: bash - run: | - tr -d '\n' < .version > temp && mv temp .version - echo -n "+PR${{ github.event.pull_request.number }}" >> .version - - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: ${{env.QT_VERSION}} - target: 'desktop' - arch: 'win64_msvc2019_64' - cache: 'true' - cache-key-prefix: 'cache-qt-windows' - - - name: Cache Chocolatey downloads - uses: actions/cache@v3 - with: - path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey - key: ${{ runner.os }}-chocolatey - -# - name: Install Python -# shell: powershell -# run: | -# choco install --no-progress python -y - - - name: Install OpenSSL, DirectX SDK - shell: powershell - run: | - choco install --no-progress openssl directx-sdk -y - - - name: Install libjpeg-turbo - run: | - Invoke-WebRequest https://netcologne.dl.sourceforge.net/project/libjpeg-turbo/2.0.6/libjpeg-turbo-2.0.6-vc64.exe -OutFile libjpeg-turbo.exe -UserAgent NativeHost - .\libjpeg-turbo /S - - - name: Set up x64 build architecture environment - shell: cmd - run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat" - - # Build packages - - name: Build packages - env: - PLATFORM: windows - shell: bash - run: ./.ci/ci_build.sh - - # Collecting deployable artifacts - - name: Collecting deployable artifacts - shell: bash - run: | - mkdir -p windows - mv build/*.exe windows - - # Upload artifacts - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: windows - path: windows diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml deleted file mode 100644 index c820a447..00000000 --- a/.github/workflows/push-master.yml +++ /dev/null @@ -1,202 +0,0 @@ -name: Hyperion CI Build -on: - push: - branches: - - '**' - tags: - - '*' - -jobs: - -################### -###### Linux ###### -################### - - Linux: - name: ${{ matrix.dockerName }} - runs-on: ubuntu-latest - strategy: - matrix: - dockerImage: [ x86_64, armv6l, armv7l, aarch64 ] - include: - - dockerImage: x86_64 - dockerName: Debian Stretch (x86_64) - platform: x11 - - dockerImage: armv6l - dockerName: Debian Stretch (Raspberry Pi v1 & ZERO) - platform: rpi - - dockerImage: armv7l - dockerName: Debian Stretch (Raspberry Pi 2 & 3) - platform: rpi - - dockerImage: aarch64 - dockerName: Debian Stretch (Generic AARCH64) - platform: amlogic - - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - # Build process - - name: Build packages - env: - DOCKER_IMAGE: ${{ matrix.dockerImage }} - DOCKER_TAG: stretch - DOCKER_NAME: ${{ matrix.dockerName }} - PLATFORM: ${{ matrix.platform }} - shell: bash - run: ./.ci/ci_build.sh - - # Upload artifacts (only on tagged commit) - - name: Upload artifacts - if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-artifact@v3 - with: - path: deploy/Hyperion-* - -################### -###### macOS ###### -################### - - macOS: - name: macOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - # Install dependencies - - name: Install dependencies - shell: bash - run: ./.ci/ci_install.sh - - # Build process - - name: Build packages - env: - PLATFORM: osx - shell: bash - run: ./.ci/ci_build.sh - - # Upload artifacts (only on tagged commit) - - name: Upload artifacts - if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-artifact@v3 - with: - path: build/Hyperion-* - -##################### -###### Windows ###### -##################### - - windows: - name: Windows - runs-on: windows-2022 - env: - VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' - QT_VERSION: 5.15.2 - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: ${{env.QT_VERSION}} - target: 'desktop' - arch: 'win64_msvc2019_64' - cache: 'true' - cache-key-prefix: 'cache-qt-windows' - - - name: Cache Chocolatey downloads - uses: actions/cache@v3 - with: - path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey - key: ${{ runner.os }}-chocolatey - -# - name: Install Python -# shell: powershell -# run: | -# choco install --no-progress python -y - - - name: Install OpenSSL, DirectX SDK - shell: powershell - run: | - choco install --no-progress openssl directx-sdk -y - - - name: Install libjpeg-turbo - run: | - Invoke-WebRequest https://netcologne.dl.sourceforge.net/project/libjpeg-turbo/2.0.6/libjpeg-turbo-2.0.6-vc64.exe -OutFile libjpeg-turbo.exe -UserAgent NativeHost - .\libjpeg-turbo /S - - - name: Set up x64 build architecture environment - shell: cmd - run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat" - - # Build packages - - name: Build packages - env: - PLATFORM: windows - shell: bash - run: ./.ci/ci_build.sh - - # Upload artifacts (only on tagged commit) - - name: Upload artifacts - if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-artifact@v3 - with: - path: build/Hyperion-* - retention-days: 1 - -##################################### -###### Publish GitHub Releases ###### -##################################### - - github_publish: - name: Publish GitHub Releases - if: startsWith(github.event.ref, 'refs/tags') - needs: [Linux, macOS, windows] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - # Generate environment variables - - name: Generate environment variables from .version and tag - run: | - echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - echo "VERSION=$(tr -d '\n' < .version)" >> $GITHUB_ENV - - # Download artifacts from previous build process - - name: Download artifacts - uses: actions/download-artifact@v3.0.2 - with: - path: artifacts - - # Create draft release and upload artifacts - - name: Create draft release - uses: softprops/action-gh-release@v1 - with: - name: Hyperion ${{ env.VERSION }} - tag_name: ${{ env.TAG }} - files: "artifacts/**" - draft: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -########################## -###### APT workflow ###### -########################## - - apt_build: - name: APT Build GitHub Releases - if: startsWith(github.event.ref, 'refs/tags') - needs: [Linux, macOS, windows] - uses: ./.github/workflows/apt.yml - secrets: - APT_GPG: ${{ secrets.APT_GPG }} - APT_USER: ${{ secrets.APT_USER }} - APT_PASSWORD: ${{ secrets.APT_PASSWORD }} - APT_DRAFT: ${{ secrets.APT_DRAFT }} diff --git a/.github/workflows/push_pull.yml b/.github/workflows/push_pull.yml new file mode 100644 index 00000000..f9729c93 --- /dev/null +++ b/.github/workflows/push_pull.yml @@ -0,0 +1,49 @@ +name: Hyperion CI/PR Builds +run-name: | + ${{ github.event_name == 'push' && '๐ŸŒฑ Push build -' || '' }} + ${{ github.event_name == 'pull_request' && format('๐Ÿ“ฆ Artifacts build for PR {0} - {1}', github.event.pull_request.number, github.event.pull_request.title) || github.event.head_commit.message }} + +on: + push: + branches: + - '**' + tags: + - '*' + pull_request: + branches: + - 'master' + +jobs: + + # GitHub Push/Pull Request (Release only on tagged commits) + github_build: + name: Qt ${{ matrix.qt_version }} Build ${{ matrix.qt_version == '6' && '(Testing))' || '' }} + strategy: + fail-fast: false + matrix: + qt_version: ['5', '6'] + uses: ./.github/workflows/qt5_6.yml + secrets: inherit + with: + qt_version: ${{ matrix.qt_version }} + event_name: ${{ github.event_name }} + pull_request_number: ${{ github.event.pull_request.number }} + publish: ${{ startsWith(github.event.ref, 'refs/tags') && matrix.qt_version == '5' }} + + # Build DEB/RPM Packages for APT/DNF Repository (runs only on tagged commits) + repo_build: + name: ๐Ÿš€ Let Hyperion build its own repository (APT/DNF) + if: startsWith(github.event.ref, 'refs/tags') + needs: [ github_build ] + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฒ Dispatch APT/DNF build + if: ${{ env.SECRET_HYPERION_BOT_TOKEN != null }} + uses: peter-evans/repository-dispatch@v3.0.0 + with: + repository: hyperion-project/hyperion.releases-ci + token: ${{ secrets.HYPERION_BOT_TOKEN }} + event-type: releases_repo_build + client-payload: '{ "head_sha": "${{ github.sha }}", "repo_checkout": "hyperion-project/hyperion.ng" }' + env: + SECRET_HYPERION_BOT_TOKEN: ${{ secrets.HYPERION_BOT_TOKEN }} diff --git a/.github/workflows/qt5_6.yml b/.github/workflows/qt5_6.yml new file mode 100644 index 00000000..c773cf5f --- /dev/null +++ b/.github/workflows/qt5_6.yml @@ -0,0 +1,242 @@ +name: GitHub Qt5/6 Builds + +on: + # Reusable from push_pull.yml + workflow_call: + inputs: + qt_version: + type: string + description: Build with this Qt version + default: '5' + required: false + event_name: + type: string + description: The event name + default: '' + required: false + pull_request_number: + type: string + description: The corresponding PR number + default: '' + required: false + publish: + type: boolean + description: Package publishing + default: false + required: false + +env: + ghcr: hyperion-project + +jobs: + +###################### +###### Linux ######### +###################### + + Linux: + name: ๐Ÿง ${{ matrix.os.description }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ + { distribution: debian, codename: buster, description: Debian Buster (x86_64), architecture: [ amd64, linux/amd64 ], platform: x11 }, + { distribution: debian, codename: buster, description: Debian Buster (Raspberry Pi 1 & Zero 1), architecture: [ armv6, linux/arm/v6 ], platform: rpi }, + { distribution: debian, codename: buster, description: Debian Buster (Raspberry Pi 2), architecture: [ armv7, linux/arm/v7 ], platform: rpi }, + { distribution: debian, codename: buster, description: Debian Buster (Raspberry Pi 3/4/5 & Zero 2), architecture: [ arm64, linux/arm64 ], platform: rpi }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (x86_64), architecture: [ amd64, linux/amd64 ], platform: x11 }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (Raspberry Pi 2), architecture: [ armv7, linux/arm/v7 ], platform: rpi }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (Raspberry Pi 3/4/5 & Zero 2), architecture: [ arm64, linux/arm64 ], platform: rpi } + ] + isQt5: + - ${{ inputs.qt_version == '5' }} + exclude: + - isQt5: true + os: { distribution: debian, codename: bullseye } + - isQt5: false + os: { distribution: debian, codename: buster } + + steps: + - name: โฌ‡ Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ๐Ÿ”ง Prepare + shell: bash + run: | + echo '::group::Append PR number to version (PR only)' + if [[ "${{ inputs.event_name }}" = "pull_request" ]]; then + tr -d '\n' < .version > temp && mv temp .version + echo -n "+PR${{ inputs.pull_request_number }}" >> .version + fi + echo '::endgroup::' + + - name: ๐Ÿ‘ท Build + shell: bash + run: ./.github/scripts/build.sh + env: + DOCKER_IMAGE: ${{ matrix.os.distribution }} + DOCKER_TAG: ${{ matrix.os.codename }}${{ inputs.qt_version == '6' && '-qt6' || '' }} + PLATFORM: ${{ matrix.os.platform }} + TARGET_ARCH: ${{ matrix.os.architecture[1] }} + + - name: ๐Ÿ“ฆ Upload + if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} + path: ${{ inputs.event_name == 'pull_request' && 'deploy/*.tar.gz' || 'deploy/Hyperion-*' }} + env: + NAME: ${{ format('{0}_{1}_{2}{3}', matrix.os.distribution, matrix.os.codename, matrix.os.architecture[0], inputs.qt_version == '6' && '_qt6' || '') }} + +###################### +###### macOS ######### +###################### + + macOS: + name: ๐Ÿ macOS x64 + runs-on: macos-latest + steps: + - name: โฌ‡ Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ๐Ÿ”ง Prepare + shell: bash + run: | + echo '::group::Append PR number to version (PR only)' + if [[ "${{ inputs.event_name }}" = "pull_request" ]]; then + tr -d '\n' < .version > temp && mv temp .version + echo -n "+PR${{ inputs.pull_request_number }}" >> .version + fi + echo '::endgroup::' + + echo '::group::Update/Install dependencies' + brew untap --force homebrew/core homebrew/cask + brew update || true + brew install qt${{ inputs.qt_version }} vulkan-headers ninja || true + echo '::endgroup::' + + - name: ๐Ÿ‘ท Build + shell: bash + run: ./.github/scripts/build.sh + env: + PLATFORM: osx + + - name: ๐Ÿ“ฆ Upload + if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} + path: 'build/Hyperion-*' + env: + NAME: ${{ inputs.qt_version == '6' && 'macOS_x64_qt6' || 'macOS_x64' }} + +###################### +###### Windows ####### +###################### + + windows: + name: ๐ŸชŸ Windows x64 + runs-on: windows-2022 + env: + VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' + steps: + - name: โฌ‡ Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: ๐Ÿ”ง Prepare PR + if: ${{ inputs.event_name == 'pull_request' }} + shell: bash + run: | + echo '::group::Append PR number to version' + tr -d '\n' < .version > temp && mv temp .version + echo -n "+PR${{ inputs.pull_request_number }}" >> .version + echo '::endgroup::' + + - name: ๐Ÿ’พ Cache/Restore + uses: actions/cache@v4 + with: + path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey + key: ${{ runner.os }}${{ inputs.qt_version == '6' && '-chocolatey-qt6' || '-chocolatey' }} + + - name: ๐Ÿ“ฅ Install DirectX SDK, OpenSSL, libjpeg-turbo ${{ inputs.qt_version == '6' && 'and Vulkan-SDK' || '' }} + shell: powershell + run: | + choco install --no-progress directx-sdk ${{env.VULKAN_SDK}} -y + choco install --no-progress ${{env.OPENSSL}} -y + Invoke-WebRequest https://netcologne.dl.sourceforge.net/project/libjpeg-turbo/3.0.1/libjpeg-turbo-3.0.1-vc64.exe -OutFile libjpeg-turbo.exe -UserAgent NativeHost + .\libjpeg-turbo /S + env: + VULKAN_SDK: ${{ inputs.qt_version == '6' && 'vulkan-sdk' || '' }} + OPENSSL: ${{ inputs.qt_version == '6' && 'openssl' || 'openssl --version=1.1.1.2100' }} + + - name: ๐Ÿ“ฅ Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{ inputs.qt_version == '6' && '6.5.2' || '5.15.2' }} + target: 'desktop' + modules: ${{ inputs.qt_version == '6' && 'qtserialport' || '' }} + arch: 'win64_msvc2019_64' + cache: 'true' + cache-key-prefix: 'cache-qt-windows' + + - name: ๐Ÿ› ๏ธ Setup MSVC + shell: cmd + run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat" + + - name: ๐Ÿ‘ท Build + shell: bash + run: ./.github/scripts/build.sh + env: + PLATFORM: windows + + - name: ๐Ÿ“ฆ Upload + if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }} + path: ${{ inputs.event_name == 'pull_request' && 'build/*.exe' || 'build/Hyperion-*' }} + env: + NAME: ${{ inputs.qt_version == '6' && 'windows_x64_qt6' || 'windows_x64' }} + +##################################### +###### Publish GitHub Releases ###### +##################################### + + github_publish: + name: ๐Ÿš€ Publish GitHub Releases + if: ${{ inputs.qt_version == '5' && inputs.publish }} + needs: [Linux, macOS, windows] + runs-on: ubuntu-latest + steps: + - name: โฌ‡ Checkout + uses: actions/checkout@v4 + + - name: ๐Ÿ”ง Prepare + run: | + echo '::group::Generate environment variables from .version and tag' + echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + echo "VERSION=$(tr -d '\n' < .version)" >> $GITHUB_ENV + echo '::endgroup::' + + - name: ๐Ÿ’พ Artifact download + uses: actions/download-artifact@v4.1.1 + with: + pattern: artifact-* + path: all-artifacts + + - name: ๐Ÿ“ฆ Upload + uses: softprops/action-gh-release@v1 + with: + name: Hyperion ${{ env.VERSION }} + tag_name: ${{ env.TAG }} + files: "all-artifacts/**" + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4c8461a..be59ce03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,19 @@ -name: Release Actions +name: ๐Ÿš€ Release Actions +run-name: ๐Ÿš€ Let HyperBian create + on: release: types: [published] jobs: + hyperbian: - name: Let HyperBian create + name: ๐Ÿš€ Let HyperBian create runs-on: ubuntu-latest steps: # Dispatch event to build new HyperBian image - - name: Dispatch HyperBian build - uses: peter-evans/repository-dispatch@v2.1.1 + - name: ๐Ÿ“ฒ Dispatch HyperBian build + uses: peter-evans/repository-dispatch@v3.0.0 if: ${{ github.repository_owner == 'hyperion-project'}} with: repository: hyperion-project/HyperBian diff --git a/.gitmodules b/.gitmodules index 624c175c..2fd17349 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "dependencies/external/rpi_ws281x"] path = dependencies/external/rpi_ws281x - url = https://github.com/jgarff/rpi_ws281x - branch = master + url = https://github.com/hyperion-project/rpi_ws281x + branch = main [submodule "dependencies/external/flatbuffers"] path = dependencies/external/flatbuffers url = https://github.com/google/flatbuffers diff --git a/.lgtm.yml b/.lgtm.yml deleted file mode 100644 index 6a799607..00000000 --- a/.lgtm.yml +++ /dev/null @@ -1,27 +0,0 @@ -extraction: - cpp: - prepare: - packages: - - "git" - - "cmake" - - "build-essential" - - "qtbase5-dev" - - "libqt5serialport5-dev" - - "libqt5sql5-sqlite" - - "libqt5svg5-dev" - - "libqt5x11extras5-dev" - - "libusb-1.0-0-dev" - - "python3-dev" - - "libcec-dev" - - "libxcb-image0-dev" - - "libxcb-util0-dev" - - "libxcb-shm0-dev" - - "libxcb-render0-dev" - - "libxcb-randr0-dev" - - "libxrandr-dev" - - "libxrender-dev" - - "libavahi-core-dev" - - "libavahi-compat-libdnssd-dev" - - "libturbojpeg0-dev" - - "libjpeg-dev" - - "libssl-dev" diff --git a/.version b/.version index 11812ad8..40259166 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.0.16-beta.1 +2.0.17-beta.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index f0daa08c..5b7c18f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/hyperion-project/hyperion.ng/compare/2.0.15...HEAD) +## [Unreleased](https://github.com/hyperion-project/hyperion.ng/compare/2.0.16...HEAD) ### Breaking @@ -12,9 +12,89 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -### Fixed +### Removed -## Removed +## [2.0.16](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.16) - 2024-01 + +### Added + +- New languages: Hebrew, Indonesian, Ukrainian + +**Event Services** +Newly introduced Event Service configuration and consistent handling across all components +- Suspend/Resume & Screen Locking support for MaxOS +- Allow to enable/disable suspend & lock on operating system events (#1633, #1632) +- Scheduled events allowing to suspend,resume, etc. (#1088) +- Configurable CEC event handling + +##### LED-Devices + +**Philips Hue** + +- APIv2 support, incl. full https security and certificate validation +- Multi-Segment device support, e.g. Gradient light +- Use Entertainment area device location for Hyperion layout in addition to manual locations +- Option to layout by focussing on full- or only center of entertainment area +- Wizard supports multiple Hue-Bridge discovery +- Support of DIYHue specifics. DIYHue bridge's name must start with "DIY" +- Backward compatibility for bridges not supporting APIv2 and/or Entertainment API +Note: The wizard will configure an APIv2 capable bridge always with Entertainment to ensure the best experience. + +**Nanoleaf** +- Wizard to generate user authorization token allowing users to configure the device via a single window +- Generation of a default layout per device's configuration, including orientation +- Lines support + +### Changed + +- Updated misleading error messages in case Hyperion is not able to support the suspend/lock feature (#1622) +- Restart Serial Device, if write error occurred +- ws281x - Update logic to identify is user is admin and disable device configuration if not (#1621) +- Hide Hyperion from the Dock on macOS, as all features can be accessed from the menubar - Thanks @Rastafabisch + +### Fixed +- Correctly display local language characters in log, e.g. Umlauts +- Fixed that Audio Capture is enabled after reboot automatically (#1581) +- Fixed that Audio Capture is not shown when there is no screen nor video grabber +- Audio Capture settings are no longer ignored (#1630) +- Fixed that the Matrix effect finds its image - Thanks @lsellens +- MDNSBrower - Fixed, if timeout while resolving host occurs +- Non image updates ignored blacklisted LEDs (#1634) +- Fixed that Windows OsEvents failed in non-GUI mode (#1671) +- Addressed serious (#1425) and some smaller memory leaks + +##### LED-Devices + +**WLED** +- Fixed UI handling, if segment streaming is not supported + +**Nanoleaf** +- "Panel numbering sequence" was not configurable any longer +- Number of panels increased during retries (#1643) + +### Removed + +##### LED-Devices + +**Philips Hue** +- "Switch Off On Black" for APIv2, as the original bridge will switch off LEDs itself. +- "Candy Gamma" for APIv2, as the bridge maps the RGB values best per device. + +**Nanoleaf** +- Removed "Start Position" in favour of the general Blacklist feature provided + +### Technical + +- Changed default build from Stretch to Buster +- Support Qt 6.7, Update to Protobuf 25.1, Update mbedTLS to v3.4.0, Update flatbuffers to v23.5.26 +- Use C++17 standard as default +- Added Pull Request (PR) installation script, allowing users to test development builds savely on Linux +- Fixed missing include limits in QJsonSchemaChecker - Thanks @Portisch +- Fixed dependencies for deb packages in Debian Bookworm (#1579) - Thanks @hg42, @Psirus +- Fixed git version identification when run in docker and local code +- Address cmake deprecation warnings, cmake 3.5 is required at minimum now +- Address some build warnings +- Removed UniqueConnections from Lambdas, as not supported ## [2.0.15](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.15) - 2023-02 @@ -41,6 +121,7 @@ To allow segment streaming, enable "Realtime - Use main segment only" in WLED's - REST API - Increased default timeout to address "Operation cancelled" errors - LED Devices: Allow to differentiate between recoverable/unrecoverable errors - Renamed LED area assignment naming to provide clarity on the processing algorithms +- Updated SEDU default baud rates ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index e0c45882..7818a6f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,17 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.5.0) -message( STATUS "CMake Version: ${CMAKE_VERSION}" ) +message(STATUS "CMake Version: ${CMAKE_VERSION}") macro(addIndent text) -if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") - list(APPEND CMAKE_MESSAGE_INDENT ${text}) -endif() + if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") + list(APPEND CMAKE_MESSAGE_INDENT ${text}) + endif() endmacro() macro(removeIndent) -if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") - list(POP_BACK CMAKE_MESSAGE_INDENT) -endif() + if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") + list(POP_BACK CMAKE_MESSAGE_INDENT) + endif() endmacro() PROJECT(hyperion) @@ -31,190 +31,197 @@ set(CMAKE_AUTOMOC ON) # auto prepare .qrc files set(CMAKE_AUTORCC ON) -# Configure CCache if available +# multicore compiling +include(ProcessorCount) +ProcessorCount(NCORES) +if(NOT NCORES EQUAL 0) + set(CMAKE_BUILD_PARALLEL_LEVEL NCORES) +endif() + +# Configure CCache ifavailable find_program(CCACHE_FOUND ccache) -if ( CCACHE_FOUND ) +if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) -# enable C++14; MSVC doesn't have c++14 feature switch -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - if(APPLE) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY) - if(REQUIRED_UNGUARDED_AVAILABILITY) - list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability") - endif() +# enable C++17 +if(APPLE) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY) + if(REQUIRED_UNGUARDED_AVAILABILITY) + list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability") endif() - - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") - endif() - - set(CMAKE_CXX_STANDARD 14) - set(CXX_STANDARD_REQUIRED ON) - set(CXX_EXTENSIONS OFF) endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + # Set build variables # Grabber -SET ( DEFAULT_AMLOGIC OFF ) -SET ( DEFAULT_DISPMANX OFF ) -SET ( DEFAULT_DX OFF ) -SET ( DEFAULT_MF OFF ) -SET ( DEFAULT_OSX OFF ) -SET ( DEFAULT_QT ON ) -SET ( DEFAULT_V4L2 OFF ) -SET ( DEFAULT_AUDIO ON ) -SET ( DEFAULT_X11 OFF ) -SET ( DEFAULT_XCB OFF ) +set(DEFAULT_AMLOGIC OFF) +set(DEFAULT_DISPMANX OFF) +set(DEFAULT_DX OFF) +set(DEFAULT_MF OFF) +set(DEFAULT_OSX OFF) +set(DEFAULT_QT ON ) +set(DEFAULT_V4L2 OFF) +set(DEFAULT_AUDIO ON ) +set(DEFAULT_X11 OFF) +set(DEFAULT_XCB OFF) # Input -SET ( DEFAULT_BOBLIGHT_SERVER ON ) -SET ( DEFAULT_CEC OFF ) -SET ( DEFAULT_FLATBUF_SERVER ON ) -SET ( DEFAULT_PROTOBUF_SERVER ON ) +set(DEFAULT_BOBLIGHT_SERVER ON ) +set(DEFAULT_CEC OFF) +set(DEFAULT_FLATBUF_SERVER ON ) +set(DEFAULT_PROTOBUF_SERVER ON ) # Output -SET ( DEFAULT_FORWARDER ON ) -SET ( DEFAULT_FLATBUF_CONNECT ON ) +set(DEFAULT_FORWARDER ON ) +set(DEFAULT_FLATBUF_CONNECT ON ) # LED-Devices -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 ) +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_EFFECTENGINE ON ) -SET ( DEFAULT_EXPERIMENTAL OFF ) -SET ( DEFAULT_MDNS ON ) -SET ( DEFAULT_REMOTE_CTL ON ) +set(DEFAULT_EFFECTENGINE ON ) +set(DEFAULT_EXPERIMENTAL OFF) +set(DEFAULT_MDNS ON ) +set(DEFAULT_REMOTE_CTL ON ) # Build -SET ( DEFAULT_JSONCHECKS ON ) -SET ( DEFAULT_DEPLOY_DEPENDENCIES ON ) -SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF ) -SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) -SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF ) -SET ( DEFAULT_USE_SYSTEM_QMDNS_LIBS OFF ) -SET ( DEFAULT_TESTS OFF ) +set(DEFAULT_JSONCHECKS ON ) +set(DEFAULT_DEPLOY_DEPENDENCIES ON ) +set(DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF) +set(DEFAULT_USE_SYSTEM_PROTO_LIBS OFF) +set(DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF) +set(DEFAULT_USE_SYSTEM_QMDNS_LIBS OFF) +set(DEFAULT_TESTS OFF) # Build Hyperion with a reduced set of functionality, overwrites other default values -SET ( DEFAULT_HYPERION_LIGHT OFF ) +set(DEFAULT_HYPERION_LIGHT OFF) -IF ( ${CMAKE_SYSTEM} MATCHES "Linux" ) - SET ( DEFAULT_FB ON ) - SET ( DEFAULT_V4L2 ON ) - SET ( DEFAULT_DEV_SPI 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_DEV_SPI OFF ) - SET ( DEFAULT_DEV_TINKERFORGE OFF ) - SET ( DEFAULT_DEV_USB_HID OFF ) - SET ( DEFAULT_CEC OFF ) -ENDIF() +if(${CMAKE_SYSTEM} MATCHES "Linux") + set(DEFAULT_FB ON) + set(DEFAULT_V4L2 ON) + set(DEFAULT_DEV_SPI 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_DEV_SPI OFF) + set(DEFAULT_DEV_TINKERFORGE OFF) + set(DEFAULT_DEV_USB_HID OFF) + set(DEFAULT_CEC OFF) +endif() -if ( NOT DEFINED PLATFORM ) - if ( APPLE ) - SET( PLATFORM "osx") - elseif ( WIN32 ) - SET( PLATFORM "windows") - elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" ) - SET( PLATFORM "x11") - elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") - SET( PLATFORM "rpi") - FILE( READ /proc/cpuinfo SYSTEM_CPUINFO ) - STRING ( TOLOWER "${SYSTEM_CPUINFO}" SYSTEM_CPUINFO ) - if ( "${SYSTEM_CPUINFO}" MATCHES "amlogic" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4 ) - SET( PLATFORM "amlogic" ) - elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 ) - SET( PLATFORM "amlogic64" ) +if(NOT DEFINED PLATFORM) + if(APPLE) + set(PLATFORM "osx") + elseif (WIN32) + set(PLATFORM "windows") + elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86") + set(PLATFORM "x11") + elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") + set(PLATFORM "rpi") + file(READ /proc/cpuinfo SYSTEM_CPUINFO) + STRING (TOLOWER "${SYSTEM_CPUINFO}" SYSTEM_CPUINFO) + if("${SYSTEM_CPUINFO}" MATCHES "amlogic" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(PLATFORM "amlogic") + elseif (("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "odroid-c2" OR "${SYSTEM_CPUINFO}" MATCHES "vero4k") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(PLATFORM "amlogic64") endif() endif() - if ( PLATFORM ) - message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}") + if(PLATFORM) + message(STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}") else() - message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=") + message(FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=") endif() endif() -message( STATUS "PLATFORM: ${PLATFORM}") +message(STATUS "PLATFORM: ${PLATFORM}") # Macro to get path of first sub dir of a dir, used for MAC OSX lib/header searching -MACRO(FIRSTSUBDIR result curdir) - FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) - SET(dirlist "") - FOREACH(child ${children}) - IF(IS_DIRECTORY ${curdir}/${child}) - LIST(APPEND dirlist "${curdir}/${child}") - BREAK() - ENDIF() - ENDFOREACH() - SET(${result} ${dirlist}) -ENDMACRO() +macro(FIRSTSUBDIR result curdir) + file(GLOB children RELATIVE ${curdir} ${curdir}/*) + set(dirlist "") + foreach(child ${children}) + if(IS_DIRECTORY ${curdir}/${child}) + list(APPEND dirlist "${curdir}/${child}") + break() + endif() + endforeach() + set(${result} ${dirlist}) +endmacro() + +if("${PLATFORM}" MATCHES "osx") + # specify the min version of the target platform (only GitHub Actions) + if(DEFINED ENV{GITHUB_WORKSPACE}) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15") + endif() -if ( "${PLATFORM}" MATCHES "osx" ) - # specify the min version of the target platform - SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.15" ) # add specific prefix paths FIRSTSUBDIR(SUBDIRPY "/usr/local/opt/python3/Frameworks/Python.framework/Versions") set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${SUBDIRPY}) include_directories("/opt/X11/include/") - SET ( DEFAULT_OSX ON ) - SET ( DEFAULT_AUDIO OFF ) - SET ( DEFAULT_DEV_USB_HID ON ) + set(DEFAULT_OSX ON ) + set(DEFAULT_AUDIO OFF) + set(DEFAULT_DEV_USB_HID ON ) -elseif ( "${PLATFORM}" MATCHES "rpi" ) - SET ( DEFAULT_DISPMANX ON ) - SET ( DEFAULT_DEV_WS281XPWM ON ) -elseif ( "${PLATFORM}" STREQUAL "amlogic" ) - SET ( DEFAULT_AMLOGIC ON ) -elseif ( "${PLATFORM}" STREQUAL "amlogic-dev" ) - SET ( DEFAULT_AMLOGIC ON ) - SET ( DEFAULT_DISPMANX OFF ) - SET ( DEFAULT_QT OFF ) - SET ( DEFAULT_CEC OFF ) -elseif ( "${PLATFORM}" STREQUAL "amlogic64" ) - SET ( DEFAULT_AMLOGIC ON ) -elseif ( "${PLATFORM}" MATCHES "x11" ) - SET ( DEFAULT_X11 ON ) - SET ( DEFAULT_XCB ON ) - if ( "${PLATFORM}" STREQUAL "x11-dev" ) - SET ( DEFAULT_AMLOGIC ON) - SET ( DEFAULT_DEV_WS281XPWM ON ) +elseif ("${PLATFORM}" MATCHES "rpi") + set(DEFAULT_DISPMANX ON) + set(DEFAULT_DEV_WS281XPWM ON) +elseif ("${PLATFORM}" MATCHES "^amlogic") + set(DEFAULT_AMLOGIC ON) + if("${PLATFORM}" MATCHES "-dev$") + set(DEFAULT_AMLOGIC ON) + set(DEFAULT_DISPMANX OFF) + set(DEFAULT_QT OFF) + set(DEFAULT_CEC OFF) endif() -elseif ( "${PLATFORM}" STREQUAL "imx6" ) - SET ( DEFAULT_FB ON ) +elseif ("${PLATFORM}" MATCHES "^x11") + set(DEFAULT_X11 ON) + set(DEFAULT_XCB ON) + if("${PLATFORM}" MATCHES "-dev$") + set(DEFAULT_AMLOGIC ON) + set(DEFAULT_DEV_WS281XPWM ON) + endif() +elseif ("${PLATFORM}" STREQUAL "imx6") + set(DEFAULT_FB ON) endif() # enable tests for -dev builds -if ( "${PLATFORM}" MATCHES "-dev" ) - SET ( DEFAULT_TESTS ON ) +if("${PLATFORM}" MATCHES "-dev$") + set(DEFAULT_TESTS ON) endif() -STRING( TOUPPER "-DPLATFORM_${PLATFORM}" PLATFORM_DEFINE) -STRING( REPLACE "-DEV" "" PLATFORM_DEFINE "${PLATFORM_DEFINE}" ) -ADD_DEFINITIONS( ${PLATFORM_DEFINE} ) +string(TOUPPER "-DPLATFORM_${PLATFORM}" PLATFORM_DEFINE) +string(REPLACE "-DEV" "" PLATFORM_DEFINE "${PLATFORM_DEFINE}") +ADD_DEFINITIONS(${PLATFORM_DEFINE}) # set the build options -option(HYPERION_LIGHT "Build Hyperion with a reduced set of functionality" ${DEFAULT_HYPERION_LIGHT} ) +option(HYPERION_LIGHT "Build Hyperion with a reduced set of functionality" ${DEFAULT_HYPERION_LIGHT}) message(STATUS "HYPERION_LIGHT = ${HYPERION_LIGHT}") -if (HYPERION_LIGHT) +if(HYPERION_LIGHT) message(STATUS "HYPERION_LIGHT: Hyperion is build with a reduced set of functionality.") # Disable Grabbers SET ( DEFAULT_AMLOGIC OFF ) @@ -225,48 +232,49 @@ if (HYPERION_LIGHT) SET ( DEFAULT_OSX OFF ) SET ( DEFAULT_QT OFF ) SET ( DEFAULT_V4L2 OFF ) - SET ( DEFAULT_AUDIO OFF ) SET ( DEFAULT_X11 OFF ) SET ( DEFAULT_XCB OFF ) + SET ( DEFAULT_AUDIO OFF ) + # Disable Input Servers - SET ( DEFAULT_BOBLIGHT_SERVER OFF ) - SET ( DEFAULT_CEC OFF ) - SET ( DEFAULT_FLATBUF_SERVER OFF ) - SET ( DEFAULT_PROTOBUF_SERVER OFF ) + set(DEFAULT_BOBLIGHT_SERVER OFF) + set(DEFAULT_CEC OFF) + set(DEFAULT_FLATBUF_SERVER OFF) + set(DEFAULT_PROTOBUF_SERVER OFF) # Disable Output Connectors - SET ( DEFAULT_FORWARDER OFF ) - SET ( DEFAULT_FLATBUF_CONNECT OFF ) + set(DEFAULT_FORWARDER OFF) + set(DEFAULT_FLATBUF_CONNECT OFF) # Disable Services - SET ( DEFAULT_EFFECTENGINE OFF ) + set(DEFAULT_EFFECTENGINE OFF) endif() message(STATUS "Grabber options:") addIndent(" - ") -option(ENABLE_AMLOGIC "Enable the AMLOGIC video grabber" ${DEFAULT_AMLOGIC} ) +option(ENABLE_AMLOGIC "Enable the AMLOGIC video grabber" ${DEFAULT_AMLOGIC}) message(STATUS "ENABLE_AMLOGIC = ${ENABLE_AMLOGIC}") -option(ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ${DEFAULT_DISPMANX} ) +option(ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ${DEFAULT_DISPMANX}) message(STATUS "ENABLE_DISPMANX = ${ENABLE_DISPMANX}") option(ENABLE_DX "Enable the DirectX grabber" ${DEFAULT_DX}) message(STATUS "ENABLE_DX = ${ENABLE_DX}") -if (ENABLE_AMLOGIC) - SET(ENABLE_FB ON) +if(ENABLE_AMLOGIC) + set(ENABLE_FB ON) else() - option(ENABLE_FB " Enable the framebuffer grabber" ${DEFAULT_FB} ) + option(ENABLE_FB " Enable the framebuffer grabber" ${DEFAULT_FB}) endif() message(STATUS "ENABLE_FB = ${ENABLE_FB}") option(ENABLE_MF "Enable the Media Foundation grabber" ${DEFAULT_MF}) message(STATUS "ENABLE_MF = ${ENABLE_MF}") -option(ENABLE_OSX "Enable the OSX grabber" ${DEFAULT_OSX} ) +option(ENABLE_OSX "Enable the OSX grabber" ${DEFAULT_OSX}) message(STATUS "ENABLE_OSX = ${ENABLE_OSX}") option(ENABLE_QT "Enable the Qt grabber" ${DEFAULT_QT}) @@ -277,30 +285,28 @@ message(STATUS "ENABLE_V4L2 = ${ENABLE_V4L2}") option(ENABLE_X11 "Enable the X11 grabber" ${DEFAULT_X11}) message(STATUS "ENABLE_X11 = ${ENABLE_X11}") -option(ENABLE_AUDIO "Enable the AUDIO grabber" ${DEFAULT_AUDIO}) -message(STATUS "ENABLE_AUDIO = ${ENABLE_AUDIO}") - -option(ENABLE_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_WS281XPWM} ) -message(STATUS "ENABLE_WS281XPWM = ${ENABLE_WS281XPWM}") option(ENABLE_XCB "Enable the XCB grabber" ${DEFAULT_XCB}) message(STATUS "ENABLE_XCB = ${ENABLE_XCB}") +option(ENABLE_AUDIO "Enable the AUDIO grabber" ${DEFAULT_AUDIO}) +message(STATUS "ENABLE_AUDIO = ${ENABLE_AUDIO}") + removeIndent() message(STATUS "Input options:") addIndent(" - ") -option(ENABLE_BOBLIGHT_SERVER "Enable BOBLIGHT server" ${DEFAULT_BOBLIGHT_SERVER} ) +option(ENABLE_BOBLIGHT_SERVER "Enable BOBLIGHT server" ${DEFAULT_BOBLIGHT_SERVER}) message(STATUS "ENABLE_BOBLIGHT_SERVER = ${ENABLE_BOBLIGHT_SERVER}") -option(ENABLE_CEC "Enable the libcec and CEC control" ${DEFAULT_CEC} ) +option(ENABLE_CEC "Enable the libcec and CEC control" ${DEFAULT_CEC}) message(STATUS "ENABLE_CEC = ${ENABLE_CEC}") -option(ENABLE_FLATBUF_SERVER "Enable Flatbuffers server" ${DEFAULT_FLATBUF_SERVER} ) +option(ENABLE_FLATBUF_SERVER "Enable Flatbuffers server" ${DEFAULT_FLATBUF_SERVER}) message(STATUS "ENABLE_FLATBUF_SERVER = ${ENABLE_FLATBUF_SERVER}") -option(ENABLE_PROTOBUF_SERVER "Enable Protocol Buffers server" ${DEFAULT_PROTOBUF_SERVER} ) +option(ENABLE_PROTOBUF_SERVER "Enable Protocol Buffers server" ${DEFAULT_PROTOBUF_SERVER}) message(STATUS "ENABLE_PROTOBUF_SERVER = ${ENABLE_PROTOBUF_SERVER}") removeIndent() @@ -308,13 +314,13 @@ removeIndent() message(STATUS "Output options:") addIndent(" - ") -option(ENABLE_FORWARDER "Enable Hyperion forwarding" ${DEFAULT_FORWARDER} ) +option(ENABLE_FORWARDER "Enable Hyperion forwarding" ${DEFAULT_FORWARDER}) message(STATUS "ENABLE_FORWARDER = ${ENABLE_FORWARDER}") -if (ENABLE_FORWARDER) - SET(ENABLE_FLATBUF_CONNECT ON) +if(ENABLE_FORWARDER) + set(ENABLE_FLATBUF_CONNECT ON) else() - option(ENABLE_FLATBUF_CONNECT "Enable Flatbuffers connecting remotely" ${DEFAULT_FLATBUF_CONNECT} ) + option(ENABLE_FLATBUF_CONNECT "Enable Flatbuffers connecting remotely" ${DEFAULT_FLATBUF_CONNECT}) endif() message(STATUS "ENABLE_FLATBUF_CONNECT = ${ENABLE_FLATBUF_CONNECT}") @@ -323,22 +329,22 @@ removeIndent() message(STATUS "LED-Device options:") addIndent(" - ") -option(ENABLE_DEV_NETWORK "Enable the Network devices" ${DEFAULT_DEV_NETWORK} ) +option(ENABLE_DEV_NETWORK "Enable the Network devices" ${DEFAULT_DEV_NETWORK}) message(STATUS "ENABLE_DEV_NETWORK = ${ENABLE_DEV_NETWORK}") -option(ENABLE_DEV_SERIAL "Enable the Serial devices" ${DEFAULT_DEV_SERIAL} ) +option(ENABLE_DEV_SERIAL "Enable the Serial devices" ${DEFAULT_DEV_SERIAL}) message(STATUS "ENABLE_DEV_SERIAL = ${ENABLE_DEV_SERIAL}") -option(ENABLE_DEV_SPI "Enable the SPI device" ${DEFAULT_DEV_SPI} ) +option(ENABLE_DEV_SPI "Enable the SPI device" ${DEFAULT_DEV_SPI}) message(STATUS "ENABLE_DEV_SPI = ${ENABLE_DEV_SPI}") 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} ) +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} ) +option(ENABLE_DEV_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_DEV_WS281XPWM}) message(STATUS "ENABLE_DEV_WS281XPWM = ${ENABLE_DEV_WS281XPWM}") removeIndent() @@ -379,7 +385,7 @@ endif() message(STATUS "DEFAULT_USE_SYSTEM_MBEDTLS_LIBS = ${DEFAULT_USE_SYSTEM_MBEDTLS_LIBS}") -if (ENABLE_MDNS) +if(ENABLE_MDNS) message(STATUS "DEFAULT_USE_SYSTEM_QMDNS_LIBS = ${DEFAULT_USE_SYSTEM_QMDNS_LIBS}") endif() @@ -392,14 +398,14 @@ message(STATUS "ENABLE_TESTS = ${ENABLE_TESTS}") removeIndent() -SET ( FLATBUFFERS_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/flatbuf ) -SET ( FLATBUFFERS_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/flatbuf ) +set(FLATBUFFERS_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/flatbuf) +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 ) +set(PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto) +set(PROTOBUF_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/proto) if(ENABLE_JSONCHECKS OR ENABLE_EFFECTENGINE) - if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") + if("${CMAKE_VERSION}" VERSION_LESS "3.12.0") set(Python_ADDITIONAL_VERSIONS 3.5) find_package(PythonInterp 3.5 REQUIRED) else() @@ -412,38 +418,38 @@ 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}) + 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 ( + 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(${CHECK_JSON_FAILED}) + message (FATAL_ERROR "check of json files failed") + endif() if(ENABLE_EFFECTENGINE) - EXECUTE_PROCESS ( + 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 () + if(${CHECK_EFFECTS_FAILED}) + message (FATAL_ERROR "check of json effect files failed") + endif() endif() - EXECUTE_PROCESS ( + 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 ) - 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) @@ -457,8 +463,8 @@ configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR include_directories("${PROJECT_BINARY_DIR}") # Define the global output path of binaries -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH}) file(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) @@ -471,32 +477,21 @@ include_directories(${CMAKE_SOURCE_DIR}/include) #set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so") # MSVC options -if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") +if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # Search for Windows SDK find_package(WindowsSDK REQUIRED) message(STATUS "WINDOWS SDK: ${WINDOWSSDK_LATEST_DIR} ${WINDOWSSDK_LATEST_NAME}") message(STATUS "MSVC VERSION: ${MSVC_VERSION}") - - # Search for DirectX9 - if (ENABLE_DX) - find_package(DirectX9 REQUIRED) - endif(ENABLE_DX) - -endif() - -# Use GNU gold linker if available -if (NOT WIN32 AND NOT APPLE) - include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake) endif() # Don't create new dynamic tags (RUNPATH) and setup -rpath to search for shared libs in BINARY/../lib folder (only for Unix) -if (ENABLE_DEPLOY_DEPENDENCIES AND UNIX AND NOT APPLE) +if(ENABLE_DEPLOY_DEPENDENCIES AND UNIX AND NOT APPLE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags") - SET(CMAKE_SKIP_BUILD_RPATH FALSE) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:$ORIGIN/../lib") - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -endif () + set(CMAKE_SKIP_BUILD_RPATH FALSE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +endif() if(APPLE) set(CMAKE_EXE_LINKER_FLAGS "-framework CoreGraphics") @@ -507,61 +502,61 @@ find_package(Threads REQUIRED) # Allow to overwrite QT base directory # Either supply QTDIR as -DQTDIR= to cmake or set and environment variable QTDIR pointing to the Qt installation # For Windows and OSX, the default Qt installation path are tried to resolved automatically -if (NOT DEFINED QTDIR) - if (DEFINED ENV{QTDIR}) +if(NOT DEFINED QTDIR) + if(DEFINED ENV{QTDIR}) set(QTDIR $ENV{QTDIR}) else() - if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") FIRSTSUBDIR(SUBDIRQT "C:/Qt") - if (NOT ${SUBDIRQT} STREQUAL "") + if(NOT ${SUBDIRQT} STREQUAL "") set(QTDIR "${SUBDIRQT}/msvc2019_64") endif() - elseif ( "${PLATFORM}" MATCHES "osx" ) - # QT6 x86_64 location - if (EXISTS /usr/local/opt/qt6) - set(QTDIR "/usr/local/opt/qt6") - # QT6 arm64 location - elseif (EXISTS /opt/homebrew/opt/qt@6) - set(QTDIR "/opt/homebrew/opt/qt@6") - # QT5 x86_64 location - elseif (EXISTS /usr/local/opt/qt5) - set(QTDIR "/usr/local/opt/qt5") - # QT5 arm64 location - elseif (EXISTS /opt/homebrew/opt/qt@5) - set(QTDIR "/opt/homebrew/opt/qt@5") - endif() + elseif ("${PLATFORM}" MATCHES "osx") + foreach(QT_VERSION 6 5) + execute_process( + COMMAND brew --prefix qt@${QT_VERSION} + RESULT_VARIABLE DETECT_QT + OUTPUT_VARIABLE QT_LOCATION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(${DETECT_QT} EQUAL 0 AND EXISTS ${QT_LOCATION}) + set(QTDIR ${QT_LOCATION}) + break() + endif() + endforeach() endif() endif() endif() -if (DEFINED QTDIR) +if(DEFINED QTDIR) message(STATUS "Add QTDIR: ${QTDIR} to CMAKE_PREFIX_PATH") list(PREPEND CMAKE_PREFIX_PATH ${QTDIR} "${QTDIR}/lib") endif() -if (CMAKE_PREFIX_PATH) - message( STATUS "CMAKE_PREFIX_PATH used: ${CMAKE_PREFIX_PATH}" ) +if(CMAKE_PREFIX_PATH) + message(STATUS "CMAKE_PREFIX_PATH used: ${CMAKE_PREFIX_PATH}") endif() # find QT libs find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Network Sql Widgets REQUIRED) -message( STATUS "Found Qt Version: ${QT_VERSION}" ) +message(STATUS "Found Qt Version: ${QT_VERSION}") -if (${QT_VERSION_MAJOR} GREATER_EQUAL 6 ) - SET(QT_MIN_VERSION "6.2.2") +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + set(QT_MIN_VERSION "6.2.2") else() - SET(QT_MIN_VERSION "5.5.0") + set(QT_MIN_VERSION "5.5.0") endif() -if ( "${QT_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" ) - message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" ) +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 Sql Widgets REQUIRED) -message( STATUS "Qt version used: ${QT_VERSION}" ) +message(STATUS "Qt version used: ${QT_VERSION}") -if (APPLE AND (${QT_VERSION_MAJOR} GREATER_EQUAL 6) ) +if(APPLE AND (${QT_VERSION_MAJOR} GREATER_EQUAL 6)) set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) endif() @@ -573,29 +568,29 @@ add_definitions(${QT_DEFINITIONS}) add_subdirectory(dependencies) add_subdirectory(libsrc) add_subdirectory(src) -if (ENABLE_TESTS) +if(ENABLE_TESTS) add_subdirectory(test) -endif () +endif() # Add resources directory add_subdirectory(resources) # remove generated files on make cleaan too -LIST( APPEND GENERATED_QRC +list(APPEND GENERATED_QRC ${CMAKE_BINARY_DIR}/WebConfig.qrc ${CMAKE_BINARY_DIR}/HyperionConfig.h ) if(ENABLE_EFFECTENGINE) -LIST( APPEND GENERATED_QRC +list(APPEND GENERATED_QRC ${CMAKE_BINARY_DIR}/EffectEngine.qrc ) -endif () +endif() -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_QRC}" ) +set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_QRC}") # uninstall target -configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) # enable make package - no code after this line ! diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bef034bf..d8ca43ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,8 +124,9 @@ The amount of "%" must match with following arguments If you want to use VSCode for development follow the steps. - Install [VSCode](https://code.visualstudio.com/). On Ubuntu 16.04+ you can also use the [Snapcraft VSCode](https://snapcraft.io/code) package. -- Linux: Install gdb `sudo apt-get install gdb` -- Mac: ? +- Install gdb: + - Linux: `sudo apt-get install gdb` + - Mac: `brew install gdb` - Open VSCode and click on _File_ -> _Open Workspace_ and select the file `hyperion.ng/.vscode/hyperion.code-workspace` - Install recommended extensions - If you installed the Task Explorer you can now use the defined vscode tasks to build Hyperion and configure cmake diff --git a/Installation.md b/Installation.md deleted file mode 100644 index 9f2fa84a..00000000 --- a/Installation.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Installation -This page contains general installation steps for Hyperion. - -## Windows & macOS -For Windows and macOS is an installation file available on our [Release page](https://github.com/hyperion-project/hyperion.ng/releases). - -## Linux: -On the following operating systems, Hyperion can currently be installed/updated using the method listed below: -- Raspbian Stretch/Raspberry Pi OS and later (armhf/arm64) -- Debian Stretch (9) and later (armhf/arm64/x86_64) -- Ubuntu 18.04 and later (armhf/arm64/x86_64) - -*** - -### Install Hyperion: -1. Add necessary packages for the installation: -```bash -sudo apt-get update && sudo apt-get install wget gpg apt-transport-https lsb-release -``` - -2. Add Hyperionโ€™s official GPG key: -```bash -wget -qO- https://apt.hyperion-project.org/hyperion.pub.key | sudo gpg --dearmor -o /usr/share/keyrings/hyperion.pub.gpg -``` - -3. Add Hyperion-Project to your APT sources: -```bash -echo "deb [signed-by=/usr/share/keyrings/hyperion.pub.gpg] https://apt.hyperion-project.org/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hyperion.list -``` - -4. Update your local package index and install Hyperion: -```bash -sudo apt-get update && sudo apt-get install hyperion -``` -*** - -### Update Hyperion: -```bash -sudo apt-get install hyperion -``` -*** - -### If you want to uninstall Hyperion, use the following commands: -1. Remove Hyperion: -```bash -sudo apt-get --purge autoremove hyperion -``` - -2. Remove the Hyperion-Project APT source from your system: -```bash -sudo rm /usr/share/keyrings/hyperion.pub.gpg /etc/apt/sources.list.d/hyperion.list -``` diff --git a/LICENSE b/LICENSE index 3968954e..7f7a5bff 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2023 Hyperion Project +Copyright (c) 2014-2024 Hyperion Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index cf3f7d8b..8e8c3fb0 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,12 @@ [![Latest-Release](https://img.shields.io/github/v/release/hyperion-project/hyperion.ng?include_prereleases&label=Latest%20Release&logo=github&logoColor=white&color=0f83e7)](https://github.com/hyperion-project/hyperion.ng/releases) -[![GitHub Actions](https://github.com/hyperion-project/hyperion.ng/workflows/Hyperion%20CI%20Build/badge.svg?branch=master)](https://github.com/hyperion-project/hyperion.ng/actions) +[![GitHub Actions](https://github.com/hyperion-project/hyperion.ng/actions/workflows/push_pull.yml/badge.svg)](https://github.com/hyperion-project/hyperion.ng/actions) [![CodeQL Analysis](https://github.com/hyperion-project/hyperion.ng/actions/workflows/codeql.yml/badge.svg)](https://github.com/hyperion-project/hyperion.ng/actions/workflows/codeql.yml) [![Forum](https://img.shields.io/website/https/hyperion-project.org.svg?label=Forum&down_color=red&down_message=offline&up_color=4bc51d&up_message=online&logo=homeadvisor&logoColor=white)](https://www.hyperion-project.org) [![Documentation](https://img.shields.io/website/https/docs.hyperion-project.org.svg?label=Documentation&down_color=red&down_message=offline&up_color=4bc51d&up_message=online&logo=read-the-docs)](https://docs.hyperion-project.org) -[![Discord](https://img.shields.io/discord/785578322167463937?label=Discord&logo=discord&logoColor=white&color=4bc51d)](https://discord.gg/khkR8Vx3ff) +[![Discord](https://img.shields.io/discord/785578322167463937?label=Discord&logo=discord&logoColor=white&color=4bc51d)](https://discord.gg/XtVTb3HEKS) +[![Package-Repository](https://img.shields.io/badge/Package%20Repository-online-4bc51d?logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHdpZHRoPSIxMTZweCIgaGVpZ2h0PSIxMjNweCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxuczpzZXJpZj0iaHR0cDovL3d3dy5zZXJpZi5jb20vIiBzdHlsZT0iZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjI7Ij48cGF0aCBkPSJNNTUuNzYsNzcuMzlMMTcuMTUsNTcuMTNMNy4xOCw2OUMyMS4xOCw3Ni4zOCAzNC4wOCw4My4zNSA0OC4wNCw5MC43M0w1NS43Niw3Ny40NEw1NS43Niw3Ny4zOVpNNjguNDMsMEw2OC40MywyMS40NEw3OC40MywyMS40NEM3OS44MjQsMjEuMzYyIDgxLjE2NywyMS45OSA4MiwyMy4xMUM4My44NiwyNS45MSA4MS4zMSwyOC42OCA3OS41NSwzMC42MkM3NC41NSwzNi4xMyA2My4xOSw0OC40MiA2MC43MSw1MS4zMkM1OS45MzUsNTIuMzAyIDU4Ljc1MSw1Mi44NzUgNTcuNSw1Mi44NzVDNTYuMjQ5LDUyLjg3NSA1NS4wNjUsNTIuMzAyIDU0LjI5LDUxLjMyQzUxLjczLDQ4LjMyIDM5Ljc0LDM1LjQ2IDM0Ljk3LDMwLjA5QzMzLjMyLDI4LjIzIDMxLjI3LDI1LjY5IDMyLjk3LDIzLjA5QzMzLjgwMSwyMS45NzMgMzUuMTQsMjEuMzQ1IDM2LjUzLDIxLjQyTDQ2LjUzLDIxLjQyTDQ2LjUzLDBMNjguNDMsMFpNMzUuNDMsNDYuMzRMMTkuNzcsNTQuMTJMNTguMjYsNzQuMzVMOTYuODIsNTQuMDhMODAuMjgsNDUuNDhMODIuOTgsNDIuNDhMOTcuOTgsNTAuMjJMMTA4Ljg1LDQwTDkyLjM2LDMxQzkyLjk5NCwyOS43NDUgOTMuNDEzLDI4LjM5MyA5My42LDI3TDExNC4yMywzNy45QzExNC4zNjUsMzcuOTcyIDExNC40ODcsMzguMDY3IDExNC41OSwzOC4xOEMxMTQuODY2LDM4LjQ1NiAxMTUuMDIxLDM4LjgzIDExNS4wMjEsMzkuMjJDMTE1LjAyMSwzOS42MSAxMTQuODY2LDM5Ljk4NCAxMTQuNTksNDAuMjZMMTAxLjM0LDUzLjI2TDExNC4xNyw2OC42MkMxMTQuNjksNjkuMjQ0IDExNC42MDksNzAuMTg0IDExMy45OSw3MC43MUMxMTMuODk1LDcwLjc4IDExMy43OTQsNzAuODQ0IDExMy42OSw3MC45TDEwMi4xNCw3N0wxMDIuMTQsOTkuODhDMTAyLjEzOSwxMDAuNDc3IDEwMS43OCwxMDEuMDE4IDEwMS4yMywxMDEuMjVMNTkuNTcsMTIyLjM5QzU5LjI5LDEyMi43IDU4Ljg5MSwxMjIuODc3IDU4LjQ3MywxMjIuODc3QzU3LjkxNCwxMjIuODc3IDU3LjQwMSwxMjIuNTYgNTcuMTUsMTIyLjA2TDE1LjQxLDEwMS4yQzE0LjkxNCwxMDAuOTQ4IDE0LjYsMTAwLjQzNyAxNC42LDk5Ljg4TDE0LjYsNzcuMTZMMi44NSw3MUMyLjc0Niw3MC45NDQgMi42NDUsNzAuODggMi41NSw3MC44MUMxLjkzMSw3MC4yODQgMS44NSw2OS4zNDQgMi4zNyw2OC43MkwxNC44Nyw1My43MkwwLjM2LDQwQzAuMTE3LDM5LjcyNyAtMC4wMTcsMzkuMzc0IC0wLjAxNywzOS4wMDlDLTAuMDE3LDM4LjU3NSAwLjE3MiwzOC4xNjMgMC41LDM3Ljg4QzAuNTksMzcuODA4IDAuNjg3LDM3Ljc0NCAwLjc5LDM3LjY5TDIxLjczLDI1Ljg0QzIxLjgyNywyNy4yODcgMjIuMTM0LDI4LjcxMSAyMi42NCwzMC4wN0w1LjY5LDM5LjcxTDE3LjUyLDUwLjcxTDMyLjYxLDQzLjI0TDM1LjQ2LDQ2LjM1TDM1LjQzLDQ2LjM0Wk05OS41OSw1Ny4yOEw2MS4wNSw3Ny41TDY4LjU2LDkwLjgyTDEwOS4xMSw2OC44Mkw5OS41OSw1Ny4yOFoiIHN0eWxlPSJmaWxsOndoaXRlO2ZpbGwtcnVsZTpub256ZXJvOyIvPjwvc3ZnPg==)](https://releases.hyperion-project.org) ![made-with-love](https://img.shields.io/badge/Made%20With-♥-ff0000.svg) ## About Hyperion @@ -45,7 +46,7 @@ For an example, you can participate in the translation.
## Supported Platforms -Find here more details on [supported platforms and configuration sets](doc/development/SupportedPlatforms.md) +Find here more details on [supported platforms and configuration sets](doc/development/SupportedPlatforms.md). ## Documentation Covers these topics: @@ -57,16 +58,16 @@ Covers these topics: [![Visit Documentation](https://img.shields.io/website/https/docs.hyperion-project.org.svg?label=Documentation&down_color=red&down_message=offline&up_color=4bc51d&up_message=online&logo=read-the-docs)](https://docs.hyperion-project.org) ## Changelog -Released and unreleased changes at [CHANGELOG.md](CHANGELOG.md) +Released and unreleased changes at [CHANGELOG.md](CHANGELOG.md). ## Building See [CompileHowto.md](doc/development/CompileHowto.md). ## Installation -See [Documentation](https://docs.hyperion-project.org/en/user/Installation.html) or at [Installation.md](Installation.md). +See [Documentation](https://docs.hyperion-project.org/en/user/Installation.html) or on the [Release Repository](https://releases.hyperion-project.org). ## Download -Releases available from the [Hyperion release page](https://github.com/hyperion-project/hyperion.ng/releases) +GitHub Releases are available on the [Hyperion release page](https://github.com/hyperion-project/hyperion.ng/releases). ## Privacy Policy See [PRIVACY.md](PRIVACY.md). diff --git a/assets/webconfig/content/conf_events.html b/assets/webconfig/content/conf_events.html new file mode 100644 index 00000000..df98b737 --- /dev/null +++ b/assets/webconfig/content/conf_events.html @@ -0,0 +1,11 @@ +
+
+
+ +
+
+
+
+
+ + diff --git a/assets/webconfig/content/conf_general.html b/assets/webconfig/content/conf_general.html index 161a551c..1ba37bf8 100644 --- a/assets/webconfig/content/conf_general.html +++ b/assets/webconfig/content/conf_general.html @@ -28,17 +28,20 @@ -
-
-
-
-

-

- -
- + diff --git a/assets/webconfig/content/conf_leds.html b/assets/webconfig/content/conf_leds.html index 3229c206..e249f630 100755 --- a/assets/webconfig/content/conf_leds.html +++ b/assets/webconfig/content/conf_leds.html @@ -46,6 +46,9 @@
' + + '
' + + ' ' + + '
'; + + if (storedAccess === 'expert') { + topContainer_html += '
' + + ':' + + '
'; + } + + topContainer_html += '

'; + topContainer_html += ''; + + $('#wh_topcontainer').append(topContainer_html); $('#usrcont').append('

' + $.i18n('wiz_hue_username') + '

' + '
' + @@ -751,23 +749,18 @@ function startWizardPhilipsHue(e) { '
' ); - if (hueType == 'philipshueentertainment') { - $('#usrcont').append('

' + $.i18n('wiz_hue_clientkey') + - '


'); - } + $('#usrcont').append('

' + $.i18n('wiz_hue_clientkey') + + '


'); $('#usrcont').append('

<\p>' + ''); - if (hueType == 'philipshueentertainment') { - $('#wizp2_body').append('

'); - createTable("gidsh", "gidsb", "hue_grp_ids_t"); - $('.gidsh').append(createTableRow([$.i18n('edt_dev_spec_groupId_title'), $.i18n('wiz_hue_e_use_group')], true)); - $('#wizp2_body').append(''); - } - else { - $('#wizp2_body').append(''); - } + $('#wizp2_body').append(''); + createTable("gidsh", "gidsb", "hue_grp_ids_t"); + $('.gidsh').append(createTableRow([$.i18n('edt_dev_spec_groupId_title'), ""], true)); + + $('#wizp2_body').append(''); + createTable("lidsh", "lidsb", "hue_ids_t"); $('.lidsh').append(createTableRow([$.i18n('edt_dev_spec_lightid_title'), $.i18n('wiz_pos'), $.i18n('wiz_identify')], true)); $('#wizp2_footer').html(''); @@ -793,13 +786,26 @@ function startWizardPhilipsHue(e) { function checkHueBridge(cb, hueUser) { var usr = (typeof hueUser != "undefined") ? hueUser : 'config'; - if (usr == 'config') $('#wiz_hue_discovered').html(""); + if (usr === 'config') { + $('#wiz_hue_discovered').html(""); + } if (hueIPs[hueIPsinc]) { var host = hueIPs[hueIPsinc].host; var port = hueIPs[hueIPsinc].port; - getProperties_hue_bridge(cb, decodeURIComponent(host), port, usr); + if (usr != '') + { + getProperties_hue_bridge(cb, decodeURIComponent(host), port, usr); + } + else + { + cb(false, usr); + } + + if (isAPIv2Ready) { + $('#port').val(443); + } } } @@ -811,37 +817,51 @@ function checkBridgeResult(reply, usr) { $('#port').val(hueIPs[hueIPsinc].port) $('#usrcont').toggle(true); - checkHueBridge(checkUserResult, $('#user').val() ? $('#user').val() : "newdeveloper"); + + checkHueBridge(checkUserResult, $('#user').val()); } else { - //increment and check again - if (hueIPs.length - 1 > hueIPsinc) { - hueIPsinc++; - checkHueBridge(checkBridgeResult); - } - else { - $('#usrcont').toggle(false); - $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); - } + $('#usrcont').toggle(false); + $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); } }; -function checkUserResult(reply, usr) { +function checkUserResult(reply, username) { $('#usrcont').toggle(true); - if (reply) { - $('#user').val(usr); - if (hueType == 'philipshueentertainment' && $('#clientkey').val() == "") { + var hue_create_user = 'wiz_hue_e_create_user'; + if (!isEntertainmentReady) { + hue_create_user = 'wiz_hue_create_user'; + $('#hue_client_key_r').toggle(false); + } else { + $('#hue_client_key_r').toggle(true); + } + + $('#wiz_hue_create_user').text($.i18n(hue_create_user)); + $('#wiz_hue_create_user').toggle(true); + + if (reply) { + $('#user').val(username); + + if (isEntertainmentReady && $('#clientkey').val() == "") { $('#wiz_hue_usrstate').html($.i18n('wiz_hue_e_clientkey_needed')); $('#wiz_hue_create_user').toggle(true); } else { $('#wiz_hue_usrstate').html(""); $('#wiz_hue_create_user').toggle(false); - if (hueType == 'philipshue') { - get_hue_lights(); - } - if (hueType == 'philipshueentertainment') { - get_hue_groups(); + + if (isEntertainmentReady) { + $('#hue_id_headline').text($.i18n('wiz_hue_e_desc3')); + $('#hue_grp_ids_t').toggle(true); + + get_hue_groups(username); + + } else { + $('#hue_id_headline').text($.i18n('wiz_hue_desc2')); + $('#hue_grp_ids_t').toggle(false); + + get_hue_lights(username); + } } } @@ -852,22 +872,73 @@ function checkUserResult(reply, usr) { } }; -function useGroupId(id) { - $('#groupId').val(id); +function useGroupId(id, username) { + $('#groupId').val(hueEntertainmentConfigs[id].id); + if (isAPIv2Ready) { + var group = hueEntertainmentConfigs[id]; - //Ensure ligthIDs are strings - groupLights = hueGroups[id].lights.map(num => { - return String(num); - }); + groupLights = []; + for (const light of group.light_services) { + groupLights.push(light.rid); + } - groupLightsLocations = hueGroups[id].locations; - get_hue_lights(); + groupChannels = []; + for (const channel of group.channels) { + groupChannels.push(channel); + } + + groupLightsLocations = []; + for (const location of group.locations.service_locations) { + groupLightsLocations.push(location); + } + } else { + //Ensure ligthIDs are strings + groupLights = hueEntertainmentConfigs[id].lights.map(num => { + return String(num); + }); + + var lightLocations = hueEntertainmentConfigs[id].locations; + for (var locationID in lightLocations) { + var lightLocation = {}; + + let position = { + x: lightLocations[locationID][0], + y: lightLocations[locationID][1], + z: lightLocations[locationID][2] + }; + lightLocation.position = position; + + groupLightsLocations.push(lightLocation); + } + } + + get_hue_lights(username); } +function updateBridgeDetails(properties) { + var ledDeviceProperties = properties.config; + + if (!jQuery.isEmptyObject(ledDeviceProperties)) { + isEntertainmentReady = properties.isEntertainmentReady; + isAPIv2Ready = properties.isAPIv2Ready; + + if (ledDeviceProperties.name && ledDeviceProperties.bridgeid && ledDeviceProperties.modelid) { + $('#wiz_hue_discovered').html( + "Bridge: " + ledDeviceProperties.name + + ", Modelid: " + ledDeviceProperties.modelid + + ", Firmware: " + ledDeviceProperties.swversion + "
" + + "API-Version: " + ledDeviceProperties.apiversion + + ", Entertainment: " + (isEntertainmentReady ? "✓" : "-") + + ", APIv2: " + (isAPIv2Ready ? "✓" : "-") + ); + } + } +} async function discover_hue_bridges() { $('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress')); - $('#wiz_hue_discovered').html("") + + // $('#wiz_hue_discovered').html("") const res = await requestLedDeviceDiscovery('philipshue'); if (res && !res.error) { const r = res.info; @@ -903,11 +974,6 @@ async function discover_hue_bridges() { port = device.port; } - //Remap https port to http port until Hue-API v2 is supported - if (port == 443) { - port = 80; - } - if (host) { if (!hueIPs.some(item => item.host === host)) { @@ -916,22 +982,39 @@ async function discover_hue_bridges() { } } } + $('#wiz_hue_ipstate').html(""); $('#host').val(hueIPs[hueIPsinc].host) $('#port').val(hueIPs[hueIPsinc].port) - var usr = $('#user').val(); - if (usr != "") { - checkHueBridge(checkUserResult, usr); - } else { - checkHueBridge(checkBridgeResult); + $('#hue_bridge_select').html(""); + + for (var key in hueIPs) { + $('#hue_bridge_select').append(createSelOpt(key, hueIPs[key].host)); } + + $('.hue_bridge_sel_watch').on("click", function () { + hueIPsinc = $(this).val(); + + var name = $("#hue_bridge_select option:selected").text(); + $('#host').val(name); + $('#port').val(hueIPs[hueIPsinc].port) + + var usr = $('#user').val(); + if (usr != "") { + checkHueBridge(checkUserResult, usr); + } else { + checkHueBridge(checkBridgeResult); + } + }); + + $('.hue_bridge_sel_watch').click(); } } } async function getProperties_hue_bridge(cb, hostAddress, port, username, resourceFilter) { - let params = { host: hostAddress, user: username, filter: resourceFilter }; + let params = { host: hostAddress, username: username, filter: resourceFilter }; if (port !== 'undefined') { params.port = parseInt(port); } @@ -945,23 +1028,27 @@ async function getProperties_hue_bridge(cb, hostAddress, port, username, resourc } // Use device's properties, if properties in chache - if (devicesProperties[ledType][key]) { + if (devicesProperties[ledType][key] && devicesProperties[ledType][key][username]) { + updateBridgeDetails(devicesProperties[ledType][key]); cb(true, username); } else { const res = await requestLedDeviceProperties(ledType, params); - - if (res && !res.error) { var ledDeviceProperties = res.info.properties; if (!jQuery.isEmptyObject(ledDeviceProperties)) { + devicesProperties[ledType][key] = {}; + devicesProperties[ledType][key][username] = ledDeviceProperties; + + isAPIv2Ready = res.info.isAPIv2Ready; + devicesProperties[ledType][key].isAPIv2Ready = isAPIv2Ready; + isEntertainmentReady = res.info.isEntertainmentReady; + devicesProperties[ledType][key].isEntertainmentReady = isEntertainmentReady; + + updateBridgeDetails(devicesProperties[ledType][key]); if (username === "config") { - if (ledDeviceProperties.name && ledDeviceProperties.bridgeid && ledDeviceProperties.modelid) { - $('#wiz_hue_discovered').html("Bridge: " + ledDeviceProperties.name + ", Modelid: " + ledDeviceProperties.modelid + ", API-Version: " + ledDeviceProperties.apiversion); - cb(true); - } + cb(true); } else { - devicesProperties[ledType][key] = ledDeviceProperties; cb(true, username); } } else { @@ -973,12 +1060,12 @@ async function getProperties_hue_bridge(cb, hostAddress, port, username, resourc } } -async function identify_hue_device(hostAddress, port, username, id) { +async function identify_hue_device(hostAddress, port, username, name, id, id_v1) { var disabled = $('#btn_wiz_save').is(':disabled'); // Take care that new record cannot be save during background process $('#btn_wiz_save').prop('disabled', true); - let params = { host: decodeURIComponent(hostAddress), user: username, lightId: id }; + let params = { host: decodeURIComponent(hostAddress), username: username, lightName: decodeURIComponent(name), lightId: id, lightId_v1: id_v1 }; if (port !== 'undefined') { params.port = parseInt(port); @@ -1003,11 +1090,9 @@ function beginWizardHue() { $('#user').val(usr); } - if (hueType == 'philipshueentertainment') { - var clkey = eV("clientkey"); - if (clkey != "") { - $('#clientkey').val(clkey); - } + var clkey = eV("clientkey"); + if (clkey != "") { + $('#clientkey').val(clkey); } //check if host is empty/reachable/search for bridge @@ -1022,13 +1107,13 @@ function beginWizardHue() { $('#host').val(host); var port = eV("port"); - if (port == 0) { - $('#port').val(80); - } - else { + if (port > 0) { $('#port').val(port); } - hueIPs.unshift({ host: host, port: port }); + else { + $('#port').val(''); + } + hueIPs.push({ host: host, port: port }); if (usr != "") { checkHueBridge(checkUserResult, usr); @@ -1038,18 +1123,18 @@ function beginWizardHue() { } $('#retry_bridge').off().on('click', function () { + var host = $('#host').val(); + var port = parseInt($('#port').val()); - if ($('#host').val() != "") { + if (host != "") { - hueIPs = []; - hueIPsinc = 0; - - var port = $('#port').val(); - if (isNaN(port) || port < 1 || port > 65535) { - port = 80; - $('#port').val(80); + var idx = hueIPs.findIndex(item => item.host === host && item.port === port); + if (idx === -1) { + hueIPs.push({ host: host, port: port }); + hueIPsinc = hueIPs.length - 1; + } else { + hueIPsinc = idx; } - hueIPs.push({ host: $('#host').val(), port: port }); } else { discover_hue_bridges(); @@ -1064,29 +1149,177 @@ function beginWizardHue() { }); $('#retry_usr').off().on('click', function () { - checkHueBridge(checkUserResult, $('#user').val() ? $('#user').val() : "newdeveloper"); + checkHueBridge(checkUserResult, $('#user').val()); }); $('#wiz_hue_create_user').off().on('click', function () { - if ($('#host').val() != "") { - hueIPs.unshift({ host: $('#host').val(), port: $('#port').val() }); - } createHueUser(); }); + function assignLightEntertainmentPos(isFocusCenter, position, name, id) { + + var x = position.x; + var z = position.z; + + if (isFocusCenter) { + // Map lights as in centered range -0.5 to 0.5 + if (x < -0.5) { + x = -0.5; + } else if (x > 0.5) { + x = 0.5; + } + if (z < -0.5) { + z = -0.5; + } else if (z > 0.5) { + z = 0.5; + } + } else { + // Map lights as in full range -1 to 1 + x /= 2; + z /= 2; + } + + var h = x + 0.5; + var v = -z + 0.5; + + var hmin = h - 0.05; + var hmax = h + 0.05; + var vmin = v - 0.05; + var vmax = v + 0.05; + + let layoutObject = { + hmin: hmin < 0 ? 0 : hmin, + hmax: hmax > 1 ? 1 : hmax, + vmin: vmin < 0 ? 0 : vmin, + vmax: vmax > 1 ? 1 : vmax, + name: name + }; + + if (id) { + layoutObject.name += "_" + id; + } + return layoutObject; + } + + function assignSegmentedLightPos(segment, position, name) { + var layoutObjects = []; + + var segTotalLength = 0; + for (var key in segment) { + + segTotalLength += segment[key].length; + } + + var min; + var max; + var horizontal = true; + + var layoutObject = assignLightPos(position, name); + if (position === "left" || position === "right") { + // vertical distribution + min = layoutObject.vmin; + max = layoutObject.vmax; + horizontal = false; + + } else { + // horizontal distribution + min = layoutObject.hmin; + max = layoutObject.hmax; + } + + var step = (max - min) / segTotalLength; + var start = min; + + for (var key in segment) { + min = start; + max = round(start + segment[key].length * step); + + if (horizontal) { + layoutObject.hmin = min; + layoutObject.hmax = max; + } else { + layoutObject.vmin = min; + layoutObject.vmax = max; + } + layoutObject.name = name + "_" + key; + layoutObjects.push(JSON.parse(JSON.stringify(layoutObject))); + + start = max; + } + + return layoutObjects; + } + $('#btn_wiz_save').off().on("click", function () { var hueLedConfig = []; var finalLightIds = []; + var channelNumber = 0; //create hue led config - for (var key in hueLights) { - if (hueType == 'philipshueentertainment') { - if (groupLights.indexOf(key) == -1) continue; - } - if ($('#hue_' + key).val() != "disabled") { - finalLightIds.push(key); - var idx_content = assignLightPos(key, $('#hue_' + key).val(), hueLights[key].name); - hueLedConfig.push(JSON.parse(JSON.stringify(idx_content))); + for (var key in groupLights) { + var lightId = groupLights[key]; + + if ($('#hue_' + lightId).val() != "disabled") { + finalLightIds.push(lightId); + + var lightName; + if (isAPIv2Ready) { + var light = hueLights.find(light => light.id === lightId); + lightName = light.metadata.name; + } else { + lightName = hueLights[lightId].name; + } + + var position = $('#hue_' + lightId).val(); + var lightIdx = groupLights.indexOf(lightId); + var lightLocation = groupLightsLocations[lightIdx]; + + var serviceID; + if (isAPIv2Ready) { + serviceID = lightLocation.service.rid; + } + + if (position.startsWith("entertainment")) { + + // Layout per entertainment area definition at bridge + var isFocusCenter = false; + if (position === "entertainment_center") { + isFocusCenter = true; + } + + if (isAPIv2Ready) { + + groupChannels.forEach((channel) => { + if (channel.members[0].service.rid === serviceID) { + var layoutObject = assignLightEntertainmentPos(isFocusCenter, channel.position, lightName, channel.channel_id); + hueLedConfig.push(JSON.parse(JSON.stringify(layoutObject))); + ++channelNumber; + } + }); + } else { + var layoutObject = assignLightEntertainmentPos(isFocusCenter, lightLocation.position, lightName); + hueLedConfig.push(JSON.parse(JSON.stringify(layoutObject))); + } + } + else { + // Layout per manual settings + var maxSegments = 1; + + if (isAPIv2Ready) { + var service = hueEntertainmentServices.find(service => service.id === serviceID); + maxSegments = service.segments.max_segments; + } + + if (maxSegments > 1) { + var segment = service.segments.segments; + var layoutObjects = assignSegmentedLightPos(segment, position, lightName); + hueLedConfig.push(...layoutObjects); + } else { + var layoutObject = assignLightPos(position, lightName); + hueLedConfig.push(JSON.parse(JSON.stringify(layoutObject))); + } + channelNumber += maxSegments; + } } } @@ -1121,7 +1354,7 @@ function beginWizardHue() { d.brightnessFactor = parseFloat(eV("brightnessFactor", 1)); d.clientkey = $('#clientkey').val(); - d.groupId = parseInt($('#groupId').val()); + d.groupId = $('#groupId').val(); d.blackLightsTimeout = parseInt(eV("blackLightsTimeout", 5000)); d.brightnessMin = parseFloat(eV("brightnessMin", 0)); d.brightnessMax = parseFloat(eV("brightnessMax", 1)); @@ -1134,8 +1367,16 @@ function beginWizardHue() { d.enableAttempts = parseInt(conf_editor.getEditor("root.generalOptions.enableAttempts").getValue()); d.enableAttemptsInterval = parseInt(conf_editor.getEditor("root.generalOptions.enableAttemptsInterval").getValue()); - if (hueType == 'philipshue') { - d.useEntertainmentAPI = false; + d.useEntertainmentAPI = isEntertainmentReady; + d.useAPIv2 = isAPIv2Ready; + + if (isEntertainmentReady) { + d.hardwareLedCount = channelNumber; + if (window.serverConfig.device.type !== d.type) { + //smoothing on, if new device + sc.smoothing = { enable: true }; + } + } else { d.hardwareLedCount = finalLightIds.length; d.verbose = false; if (window.serverConfig.device.type !== d.type) { @@ -1144,15 +1385,6 @@ function beginWizardHue() { } } - if (hueType == 'philipshueentertainment') { - d.useEntertainmentAPI = true; - d.hardwareLedCount = groupLights.length; - if (window.serverConfig.device.type !== d.type) { - //smoothing on, if new device - sc.smoothing = { enable: true }; - } - } - window.serverConfig.device = d; requestWriteConfig(sc, true); @@ -1163,7 +1395,6 @@ function beginWizardHue() { } function createHueUser() { - var host = hueIPs[hueIPsinc].host; var port = hueIPs[hueIPsinc].port; @@ -1208,7 +1439,8 @@ function createHueUser() { conf_editor.getEditor("root.specificOptions.host").setValue(host); conf_editor.getEditor("root.specificOptions.port").setValue(port); } - if (hueType == 'philipshueentertainment') { + + if (isEntertainmentReady) { var clientkey = response.clientkey; if (clientkey != 'undefined') { $('#clientkey').val(clientkey); @@ -1230,37 +1462,52 @@ function createHueUser() { }, retryInterval * 1000); } -function get_hue_groups() { - +function get_hue_groups(username) { var host = hueIPs[hueIPsinc].host; - if (devicesProperties['philipshue'][host]) { - var ledProperties = devicesProperties['philipshue'][host]; + if (devicesProperties['philipshue'][host] && devicesProperties['philipshue'][host][username]) { + var ledProperties = devicesProperties['philipshue'][host][username]; - if (!jQuery.isEmptyObject(ledProperties)) { - hueGroups = ledProperties.groups; - if (Object.keys(hueGroups).length > 0) { - - $('.lidsb').html(""); - $('#wh_topcontainer').toggle(false); - $('#hue_grp_ids_t').toggle(true); - - var gC = 0; - for (var groupid in hueGroups) { - if (hueGroups[groupid].type == 'Entertainment') { - $('.gidsb').append(createTableRow([groupid + ' (' + hueGroups[groupid].name + ')', ''])); - gC++; - } - } - if (gC == 0) { - noAPISupport('wiz_hue_e_noegrpids'); + if (isAPIv2Ready) { + if (!jQuery.isEmptyObject(ledProperties.data)) { + if (Object.keys(ledProperties.data).length > 0) { + hueEntertainmentConfigs = ledProperties.data.filter(config => { + return config.type === "entertainment_configuration"; + }); + hueEntertainmentServices = ledProperties.data.filter(config => { + return (config.type === "entertainment" && config.renderer === true); + }); } } + } else { + if (!jQuery.isEmptyObject(ledProperties.groups)) { + hueEntertainmentConfigs = []; + var hueGroups = ledProperties.groups; + for (var groupid in hueGroups) { + if (hueGroups[groupid].type == 'Entertainment') { + hueGroups[groupid].id = groupid; + hueEntertainmentConfigs.push(hueGroups[groupid]); + } + } + } + } + + if (Object.keys(hueEntertainmentConfigs).length > 0) { + + $('.lidsb').html(""); + $('#wh_topcontainer').toggle(false); + $('#hue_grp_ids_t').toggle(true); + + for (var groupid in hueEntertainmentConfigs) { + $('.gidsb').append(createTableRow([groupid + ' (' + hueEntertainmentConfigs[groupid].name + ')', ''])); + } + } else { + noAPISupport('wiz_hue_e_noegrpids', username); } } } -function noAPISupport(txt) { +function noAPISupport(txt, username) { showNotification('danger', $.i18n('wiz_hue_e_title'), $.i18n('wiz_hue_e_noapisupport_hint')); conf_editor.getEditor("root.specificOptions.useEntertainmentAPI").setValue(false); $("#root_specificOptions_useEntertainmentAPI").trigger("change"); @@ -1269,51 +1516,82 @@ function noAPISupport(txt) { var txt = (txt) ? $.i18n(txt) : $.i18n('wiz_hue_e_nogrpids'); $('

' + txt + '
' + $.i18n('wiz_hue_e_noapisupport') + '

').insertBefore('#wizp2_body #hue_ids_t'); $('#hue_id_headline').html($.i18n('wiz_hue_desc2')); - hueType = 'philipshue'; - get_hue_lights(); + + get_hue_lights(username); } -function get_hue_lights() { - +function get_hue_lights(username) { var host = hueIPs[hueIPsinc].host; - if (devicesProperties['philipshue'][host]) { - var ledProperties = devicesProperties['philipshue'][host]; + if (devicesProperties['philipshue'][host] && devicesProperties['philipshue'][host][username]) { + var ledProperties = devicesProperties['philipshue'][host][username]; - if (!jQuery.isEmptyObject(ledProperties.lights)) { - hueLights = ledProperties.lights; - if (Object.keys(hueLights).length > 0) { - if (hueType == 'philipshue') { - $('#wh_topcontainer').toggle(false); + if (isAPIv2Ready) { + if (!jQuery.isEmptyObject(ledProperties.data)) { + if (Object.keys(ledProperties.data).length > 0) { + hueLights = ledProperties.data.filter(config => { + return config.type === "light"; + }); } - $('#hue_ids_t, #btn_wiz_save').toggle(true); + } + } else { + if (!jQuery.isEmptyObject(ledProperties.lights)) { + hueLights = ledProperties.lights; + } + } - var lightOptions = [ - "top", "topleft", "topright", - "bottom", "bottomleft", "bottomright", - "left", "lefttop", "leftmiddle", "leftbottom", - "right", "righttop", "rightmiddle", "rightbottom", - "entire", - "lightPosTopLeft112", "lightPosTopLeftNewMid", "lightPosTopLeft121", - "lightPosBottomLeft14", "lightPosBottomLeft12", "lightPosBottomLeft34", "lightPosBottomLeft11", - "lightPosBottomLeft112", "lightPosBottomLeftNewMid", "lightPosBottomLeft121" - ]; + if (Object.keys(hueLights).length > 0) { + if (!isEntertainmentReady) { + $('#wh_topcontainer').toggle(false); + } + $('#hue_ids_t, #btn_wiz_save').toggle(true); - if (hueType == 'philipshue') { - lightOptions.unshift("disabled"); + var lightOptions = [ + "top", "topleft", "topright", + "bottom", "bottomleft", "bottomright", + "left", "lefttop", "leftmiddle", "leftbottom", + "right", "righttop", "rightmiddle", "rightbottom", + "entire", + "lightPosTopLeft112", "lightPosTopLeftNewMid", "lightPosTopLeft121", + "lightPosBottomLeft14", "lightPosBottomLeft12", "lightPosBottomLeft34", "lightPosBottomLeft11", + "lightPosBottomLeft112", "lightPosBottomLeftNewMid", "lightPosBottomLeft121" + ]; + + if (isEntertainmentReady) { + lightOptions.unshift("entertainment_center"); + lightOptions.unshift("entertainment"); + } else { + lightOptions.unshift("disabled"); + groupLights = Object.keys(hueLights); + } + + $('.lidsb').html(""); + + var pos = ""; + for (var id in groupLights) { + var lightId = groupLights[id]; + var lightId_v1 = "/lights/" + lightId; + + var lightName; + if (isAPIv2Ready) { + var light = hueLights.find(light => light.id === lightId); + lightName = light.metadata.name; + lightId_v1 = light.id_v1; + } else { + lightName = hueLights[lightId].name; } - $('.lidsb').html(""); - var pos = ""; - for (var lightid in hueLights) { - if (hueType == 'philipshueentertainment') { - if (groupLights.indexOf(lightid) == -1) continue; + if (isEntertainmentReady) { + var lightLocation = {}; + lightLocation = groupLightsLocations[id]; + if (lightLocation) { + if (isAPIv2Ready) { + pos = 0; + } else { + var x = lightLocation.position.x; + var y = lightLocation.position.y; + var z = lightLocation.position.z; - if (groupLightsLocations.hasOwnProperty(lightid)) { - lightLocation = groupLightsLocations[lightid]; - var x = lightLocation[0]; - var y = lightLocation[1]; - var z = lightLocation[2]; var xval = (x < 0) ? "left" : "right"; if (z != 1 && x >= -0.25 && x <= 0.25) xval = ""; switch (z) { @@ -1329,37 +1607,39 @@ function get_hue_lights() { } } } - var options = ""; - for (var opt in lightOptions) { - var val = lightOptions[opt]; - var txt = (val != 'entire' && val != 'disabled') ? 'conf_leds_layout_cl_' : 'wiz_ids_'; - options += '