diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh deleted file mode 100755 index df276f00e..000000000 --- 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 86c6ffd4b..000000000 --- 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/.devcontainer.json b/.devcontainer.json index 4cce9be71..966a658ba 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 000000000..5880abb92 --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,59 @@ +#!/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 + 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 ${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 + git config --global --add safe.directory "${GITHUB_WORKSPACE}/dependencies/external/*" + # 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 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ../ || exit 2 && + cmake --build /source/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 99bce2146..000000000 --- a/.github/workflows/apt.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: Hyperion APT Build -on: - workflow_call: - inputs: - head_sha: - type: string - description: The branch, tag or SHA to checkout - required: true - secrets: - APT_GPG: - required: true - APT_USER: - required: true - APT_PASSWORD: - required: true - APT_DRAFT: - required: true - workflow_dispatch: - inputs: - head_sha: - type: string - description: The branch, tag or SHA to checkout - required: true - 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@v4 - - 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@v4 - with: - ref: ${{ github.event.inputs.head_sha || github.event.client_payload.head_sha }} - 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') || github.event_name == 'workflow_dispatch' }} - uses: actions/upload-artifact@v3 - with: - path: deploy - retention-days: 1 - - publish: - name: Publish APT packages - if: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' }} - needs: [setup, build] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.head_sha || github.event.client_payload.head_sha }} - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6.0.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@v4.3.4 - 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 ecfa56c3a..000000000 --- a/.github/workflows/apt/amd64.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "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": "Lunar", - "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.11, 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 23.04 (Lunar Lobster) (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.11, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, 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 8cf6325ea..000000000 --- a/.github/workflows/apt/arm64.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "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, 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": "-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, 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": "-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, 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": "-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, libasound2-dev, libturbojpeg0-dev, libjpeg-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) (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, libasound2-dev, libturbojpeg0-dev, libjpeg-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) (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, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.11, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libasound2, 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 ed4b9b4de..000000000 --- a/.github/workflows/apt/armhf.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "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, 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": "-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, 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": "-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, 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": "-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": "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, libasound2-dev, libturbojpeg0-dev, libjpeg-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) (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, libasound2-dev, libturbojpeg0-dev, libjpeg-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) (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, libasound2-dev, libturbojpeg0-dev, libjpeg-dev, libmbedtls-dev", - "package-depends": "libpython3.11, libusb-1.0-0, libqt5widgets5, libqt5x11extras5, libqt5sql5, libqt5sql5-sqlite, libqt5serialport5, libmbedtls14, libasound2, 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 95ab9fd70..48c42fb04 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 d39190cc7..9ed683698 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 + - 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 + - name: ๐Ÿ” Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} queries: +security-and-quality config-file: ./.github/config/codeql.yml - - name: Autobuild + - name: ๐Ÿ‘ท Autobuild uses: github/codeql-action/autobuild@v2 - - name: Perform CodeQL Analysis + - name: ๐Ÿƒ Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 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,11 +67,12 @@ jobs: input: sarif-results/${{ matrix.language }}.sarif output: sarif-results/${{ matrix.language }}.sarif - - name: Upload SARIF + - name: ๐Ÿ“ฆ Upload SARIF uses: github/codeql-action/upload-sarif@v2 with: sarif_file: sarif-results/${{ matrix.language }}.sarif - - name: Upload loc as a Build Artifact + + - name: ๐Ÿ“ฆ Upload loc as a Build Artifact uses: actions/upload-artifact@v3 with: name: sarif-results diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 2046ba07a..000000000 --- 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@v4 - 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@v4 - - 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@v4 - - 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@v4 - with: - submodules: recursive - - - 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@v4 - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6.0.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@v4.3.4 - 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 eee7c150a..000000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,193 +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 Buster (x86_64) - platform: x11 - - dockerImage: armv6l - dockerName: Debian Buster (Raspberry Pi v1 & ZERO) - platform: rpi - - dockerImage: armv7l - dockerName: Debian Buster (Raspberry Pi 2 & 3) - platform: rpi - - dockerImage: aarch64 - dockerName: Debian Buster (Generic AARCH64) - platform: amlogic - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - # 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: buster - 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@v4 - with: - submodules: recursive - - # 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@v4 - with: - submodules: recursive - - # 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 --version=1.1.1.2100 -y - choco install --no-progress 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 b0ee7a1d8..000000000 --- a/.github/workflows/push-master.yml +++ /dev/null @@ -1,201 +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 Buster (x86_64) - platform: x11 - - dockerImage: armv6l - dockerName: Debian Buster (Raspberry Pi v1 & ZERO) - platform: rpi - - dockerImage: armv7l - dockerName: Debian Buster (Raspberry Pi 2 & 3) - platform: rpi - - dockerImage: aarch64 - dockerName: Debian Buster (Generic AARCH64) - platform: amlogic - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - # Build process - - name: Build packages - env: - DOCKER_IMAGE: ${{ matrix.dockerImage }} - DOCKER_TAG: buster - 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@v4 - with: - submodules: recursive - - # 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@v4 - with: - submodules: recursive - - - 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 --version=1.1.1.2100 -y - choco install --no-progress 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@v4 - - # 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: inherit - with: - head_sha: master diff --git a/.github/workflows/push_pull.yml b/.github/workflows/push_pull.yml new file mode 100644 index 000000000..add2c9440 --- /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') }} + + # 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@v2.1.2 + with: + repository: hyperion-project/hyperion.releases-ci + token: ${{ secrets.HYPERION_BOT_TOKEN }} + event-type: releases_repo_build + client-payload: '{ "head_sha": "${{ github.sha }}" }' + 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 000000000..ac4622b34 --- /dev/null +++ b/.github/workflows/qt5_6.yml @@ -0,0 +1,250 @@ +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 ] }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (x86_64), architecture: [ amd64, linux/amd64 ] }, + { distribution: debian, codename: buster, description: Debian Buster (Raspberry Pi 1/ZERO), architecture: [ armv6, linux/arm/v5 ] }, + { distribution: debian, codename: buster, description: Debian Buster (Raspberry Pi 2/3/4), architecture: [ armv7, linux/arm/v7 ] }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (Raspberry Pi 2/3/4), architecture: [ armv7, linux/arm/v7 ] }, + { distribution: debian, codename: buster, description: Debian Buster (Generic AARCH64), architecture: [ aarch64, linux/arm64 ] }, + { distribution: debian, codename: bullseye, description: Debian Bullseye (Generic AARCH64), architecture: [ aarch64, linux/arm64 ] } + ] + isQt5: + - ${{ inputs.qt_version == '5' }} + include: + - os.architecture[0]: amd64 + platform: x11 + - os.architecture[0]: armv6 + platform: rpi + - os.architecture[0]: armv7 + platform: rpi + - os.architecture[0]: aarch64 + platform: amlogic + 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.platform }} + TARGET_ARCH: ${{ matrix.os.architecture[1] }} + + - name: ๐Ÿ“ฆ Upload + if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + 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 update || true + brew install --overwrite qt${{ inputs.qt_version }} libusb + brew link --overwrite --force qt${{ inputs.qt_version }} + 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@v3 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + 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@v3 + 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@v3 + with: + name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} + 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@v3.0.2 + with: + path: artifacts + + - name: ๐Ÿ“ฆ Upload + 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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 104c2c793..941e07dd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,18 @@ -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 + - name: ๐Ÿ“ฒ Dispatch HyperBian build uses: peter-evans/repository-dispatch@v2.1.2 if: ${{ github.repository_owner == 'hyperion-project'}} with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 32bbb7d20..8d88c41e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,17 @@ 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,9 +31,16 @@ 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) @@ -58,160 +65,163 @@ 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 ) - -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" ) +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(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() - -if ( "${PLATFORM}" MATCHES "osx" ) - # specify the min version of the target platform - SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.15" ) +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() + # 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 ) - -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 ) + 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}" 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}" MATCHES "^x11" ) - SET ( DEFAULT_X11 ON ) - SET ( DEFAULT_XCB ON ) - if ( "${PLATFORM}" MATCHES "-dev$" ) - SET ( DEFAULT_AMLOGIC ON) - SET ( DEFAULT_DEV_WS281XPWM 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 ) +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 ) @@ -228,43 +238,43 @@ if (HYPERION_LIGHT) 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}) @@ -287,16 +297,16 @@ 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() @@ -304,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}") @@ -319,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() @@ -375,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() @@ -388,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() @@ -408,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) @@ -453,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}) @@ -467,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") @@ -503,18 +502,18 @@ 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" ) + elseif ("${PLATFORM}" MATCHES "osx") # QT6 x86_64 location - if (EXISTS /usr/local/opt/qt6) + if(EXISTS /usr/local/opt/qt6) set(QTDIR "/usr/local/opt/qt6") # QT6 arm64 location elseif (EXISTS /opt/homebrew/opt/qt@6) @@ -530,34 +529,34 @@ if (NOT DEFINED QTDIR) 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() @@ -569,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/bin/scripts/docker-compile.sh b/bin/scripts/docker-compile.sh index ce298b965..bafde87fb 100755 --- a/bin/scripts/docker-compile.sh +++ b/bin/scripts/docker-compile.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash DOCKER="docker" # Git repo url of Hyperion @@ -7,20 +7,21 @@ GIT_REPO_URL="https://github.com/hyperion-project/hyperion.ng.git" REGISTRY_URL="ghcr.io/hyperion-project" # cmake build type BUILD_TYPE="Release" -# the docker image at GitHub Container Registry -BUILD_IMAGE="x86_64" -# the docker tag at GitHub Container Registry -BUILD_TAG="bullseye" +DISTRIBUTION="debian" +CODENAME="bullseye" +ARCHITECTURE="amd64" # build packages (.deb .zip ...) BUILD_PACKAGES=true # packages string inserted to cmake cmd PACKAGES="" # platform string inserted to cmake cmd BUILD_PLATFORM="" +#Run build with Qt6 or Qt5 +BUILD_WITH_QT5=false #Run build using GitHub code files -BUILD_LOCAL=0 +BUILD_LOCAL=false #Build from scratch -BUILD_INCREMENTAL=0 +BUILD_INCREMENTAL=false #Verbose output _VERBOSE=0 #Additional args @@ -37,11 +38,7 @@ cd `dirname ${BASE_PATH}` > /dev/null BASE_PATH=`pwd`; popd > /dev/null -BASE_PATH=`pwd`;function log () { - if [[ $_V -eq 1 ]]; then - echo "$@" - fi -} +BASE_PATH=`pwd`; set +e ${DOCKER} ps >/dev/null 2>&1 @@ -62,7 +59,7 @@ function printHelp { echo "######################################################## ## A script to compile Hyperion inside a docker container ## Requires installed Docker: https://www.docker.com/ -## Without arguments it will compile Hyperion for Debian Bullseye (x86_64) and uses Hyperion code from GitHub repository. +## Without arguments it will compile Hyperion for ${DISTRIBUTION}:${CODENAME}, ${ARCHITECTURE} architecture and uses Hyperion code from GitHub repository. ## For all images and tags currently available, see https://github.com/orgs/hyperion-project/packages ## ## Homepage: https://www.hyperion-project.org @@ -71,16 +68,17 @@ echo "######################################################## # These are possible arguments to modify the script behaviour with their default values # # docker-compile.sh -h, --help # Show this help message -# docker-compile.sh -i, --image # The docker image, e.g., x86_64, armv6l, armv7l, aarch64 -# docker-compile.sh -t, --tag # The docker tag, e.g., buster, bullseye, bookworm +# docker-compile.sh -n, --name # The distribution's codename, e.g., buster, bullseye, bookworm, jammy, trixie, lunar, mantic; Note: for Fedora it is the version number +# docker-compile.sh -a, --architecture # The output architecture, e.g., amd64, arm64, arm/v7 # docker-compile.sh -b, --type # Release or Debug build # docker-compile.sh -p, --packages # If true, build packages with CPack +# docker-compile.sh --qt5 # Build with Qt5, otherwise build with Qt6 +# docker-compile.sh -f, --platform # cmake PLATFORM parameter, e.g. x11, amlogic-dev # docker-compile.sh -l, --local # Run build using local code files # docker-compile.sh -c, --incremental # Run incremental build, i.e. do not delete files created during previous build -# docker-compile.sh -f, --platform # cmake PLATFORM parameter, e.g. x11, amlogic-dev # docker-compile.sh -v, --verbose # Run the script in verbose mode # docker-compile.sh -- args # Additonal cmake arguments, e.g., -DHYPERION_LIGHT=ON -# More informations to docker tags at: https://github.com/Hyperion-Project/hyperion.docker-ci" +# More informations to docker containers available at: https://github.com/Hyperion-Project/hyperion.docker-ci" } function log () { @@ -89,48 +87,63 @@ function log () { fi } +function check_distribution () { + url=${REGISTRY_URL}/$1:${CODENAME} + + log "Check for distribution at: $url" + if $($DOCKER buildx imagetools inspect "$url" 2>&1 | grep -q $2) ; then + rc=0 + else + rc=1 + fi + return $rc +} + echo "Compile Hyperion using a Docker container" -options=$(getopt -l "image:,tag:,type:,packages:,platform:,local,incremental,verbose,help" -o "i:t:b:p:f:lcvh" -a -- "$@") +options=$(getopt -l "architecture:,name:,type:,packages:,platform:,qt5,local,incremental,verbose,help" -o "a:n:b:p:f:lcvh" -a -- "$@") eval set -- "$options" while true do case $1 in - -i|--image) + -a|--architecture) shift - BUILD_IMAGE=$1 + ARCHITECTURE=`echo $1 | tr '[:upper:]' '[:lower:]'` ;; - -t|--tag) + -n|--name) shift - BUILD_TAG=$1 + CODENAME=`echo $1 | tr '[:upper:]' '[:lower:]'` ;; - -b|--type) + -b|--type) shift BUILD_TYPE=$1 ;; - -p|--packages) + -p|--packages) shift BUILD_PACKAGES=$1 ;; - -f|--platform) + -f|--platform) shift BUILD_PLATFORM=$1 ;; - -l|--local) - BUILD_LOCAL=1 + --qt5) + BUILD_WITH_QT5=true + ;; + -l|--local) + BUILD_LOCAL=true ;; - -c|--incremental) - BUILD_INCREMENTAL=1 + -i|--incremental) + BUILD_INCREMENTAL=true ;; - -v|--verbose) + -v|--verbose) _VERBOSE=1 ;; - -h|--help) + -h|--help) printHelp exit 0 ;; --) - shift + shift break;; esac shift @@ -148,7 +161,66 @@ if [[ ! -z ${BUILD_PLATFORM} ]]; then PLATFORM="-DPLATFORM=${BUILD_PLATFORM}" fi -echo "---> Initialize with IMAGE:TAG=${BUILD_IMAGE}:${BUILD_TAG}, BUILD_TYPE=${BUILD_TYPE}, BUILD_PACKAGES=${BUILD_PACKAGES}, PLATFORM=${BUILD_PLATFORM}, BUILD_LOCAL=${BUILD_LOCAL}, BUILD_INCREMENTAL=${BUILD_INCREMENTAL}" +PLATFORM_ARCHITECTURE="linux/"${ARCHITECTURE} + +QTVERSION="5" +if [ ${BUILD_WITH_QT5} == false ]; then + QTVERSION="6" + CODENAME="${CODENAME}-qt6" +fi + +echo "---> Evaluate distribution for codename:${CODENAME} on platform architecture ${PLATFORM_ARCHITECTURE}" +DISTRIBUTION="debian" +if ! check_distribution ${DISTRIBUTION} ${PLATFORM_ARCHITECTURE} ; then + DISTRIBUTION="ubuntu" + if ! check_distribution ${DISTRIBUTION} ${PLATFORM_ARCHITECTURE} ; then + DISTRIBUTION="fedora" + if ! check_distribution ${DISTRIBUTION} ${PLATFORM_ARCHITECTURE} ; then + echo "No docker image found for a distribution with codename: ${CODENAME} to be build on platform architecture ${PLATFORM_ARCHITECTURE}" + exit 1 + fi + fi +fi + +echo "---> Build with -> Distribution: ${DISTRIBUTION}, Codename: ${CODENAME}, Architecture: ${ARCHITECTURE}, Type: ${BUILD_TYPE}, Platform: ${BUILD_PLATFORM}, QT Version: ${QTVERSION}, Build Packages: ${BUILD_PACKAGES}, Build local: ${BUILD_LOCAL}, Build incremental: ${BUILD_INCREMENTAL}" + +# Determine the current architecture +CURRENT_ARCHITECTURE=`uname -m` + +#Test if multiarchitecture setup, i.e. user-space is 32bit +if [ ${CURRENT_ARCHITECTURE} == "aarch64" ]; then + CURRENT_ARCHITECTURE="arm64" + USER_ARCHITECTURE=$CURRENT_ARCHITECTURE + IS_V7L=`cat /proc/$$/maps |grep -m1 -c v7l` + if [ $IS_V7L -ne 0 ]; then + USER_ARCHITECTURE="arm/v7" + else + IS_V6L=`cat /proc/$$/maps |grep -m1 -c v6l` + if [ $IS_V6L -ne 0 ]; then + USER_ARCHITECTURE="arm/v6" + fi + fi + if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then + log "Identified user space current architecture: $USER_ARCHITECTURE" + CURRENT_ARCHITECTURE=$USER_ARCHITECTURE + fi +else + CURRENT_ARCHITECTURE=${CURRENT_ARCHITECTURE//x86_/amd} +fi + +log "Identified kernel current architecture: $CURRENT_ARCHITECTURE" +if [ $ARCHITECTURE != $CURRENT_ARCHITECTURE ]; then + echo "---> Build is not for the same architecturem, enable emulation for ${PLATFORM_ARCHITECTURE}" + ENTRYPOINT_OPTION= + + if [ $CURRENT_ARCHITECTURE != "amd64" ]; then + echo "---> Emulation builds can only be executed on linux/amd64, linux/x86_64 platforms, current architecture is ${CURRENT_ARCHITECTURE}" + exit 1 + fi +else + log "Build natively for platform architecture: ${PLATFORM_ARCHITECTURE}" + ENTRYPOINT_OPTION="--entrypoint=""" +fi log "---> BASE_PATH = ${BASE_PATH}" CODE_PATH=${BASE_PATH}; @@ -163,9 +235,11 @@ git clone --recursive --depth 1 -q ${GIT_REPO_URL} ${CODE_PATH} || { echo "---> fi log "---> CODE_PATH = ${CODE_PATH}" -BUILD_DIR="build-${BUILD_IMAGE}-${BUILD_TAG}" +ARCHITECTURE_PATH=${ARCHITECTURE//\//_} + +BUILD_DIR="build-${CODENAME}-${ARCHITECTURE_PATH}" BUILD_PATH="${CODE_PATH}/${BUILD_DIR}" -DEPLOY_DIR="deploy/${BUILD_IMAGE}/${BUILD_TAG}" +DEPLOY_DIR="deploy/${CODENAME}/${ARCHITECTURE}" DEPLOY_PATH="${CODE_PATH}/${DEPLOY_DIR}" log "---> BUILD_DIR = ${BUILD_DIR}" @@ -178,7 +252,7 @@ sudo rm -fr "${DEPLOY_PATH}" >/dev/null 2>&1 mkdir -p "${DEPLOY_PATH}" >/dev/null 2>&1 #Remove previous build area, if no incremental build -if [ ${BUILD_INCREMENTAL} != 1 ]; then +if [ ${BUILD_INCREMENTAL} != true ]; then sudo rm -fr "${BUILD_PATH}" >/dev/null 2>&1 fi mkdir -p "${BUILD_PATH}" >/dev/null 2>&1 @@ -194,10 +268,11 @@ echo "---> Compiling Hyperion from source code at ${CODE_PATH}" # execute inside container all commands on bash echo "---> Startup docker..." -$DOCKER run --rm \ +$DOCKER run --rm --platform=${PLATFORM_ARCHITECTURE} \ + ${ENTRYPOINT_OPTION} \ -v "${DEPLOY_PATH}:/deploy" \ -v "${CODE_PATH}/:/source:rw" \ - ${REGISTRY_URL}/${BUILD_IMAGE}:${BUILD_TAG} \ + ${REGISTRY_URL}/${DISTRIBUTION}:${CODENAME} \ /bin/bash -c "mkdir -p /source/${BUILD_DIR} && cd /source/${BUILD_DIR} && cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${PLATFORM} ${BUILD_ARGS} .. || exit 2 && make -j $(nproc) ${PACKAGES} || exit 3 || : && @@ -210,7 +285,7 @@ DOCKERRC=${?} sudo chown -fR $(stat -c "%U:%G" ${BASE_PATH}) ${BUILD_PATH} if [ ${DOCKERRC} == 0 ]; then - if [ ${BUILD_LOCAL} == 1 ]; then + if [ ${BUILD_LOCAL} == true ]; then echo "---> Find compiled binaries in: ${BUILD_PATH}/bin" fi diff --git a/bin/scripts/install_pr.sh b/bin/scripts/install_pr.sh index 1f654f23c..cd023504b 100755 --- a/bin/scripts/install_pr.sh +++ b/bin/scripts/install_pr.sh @@ -73,13 +73,13 @@ if [ ${ARCHITECTURE} == "aarch64" ]; then IS_V7L=`cat /proc/$$/maps |grep -m1 -c v7l` if [ $IS_V7L -ne 0 ]; then USER_ARCHITECTURE="armv7l" - else + else IS_V6L=`cat /proc/$$/maps |grep -m1 -c v6l` if [ $IS_V6L -ne 0 ]; then USER_ARCHITECTURE="armv6l" fi fi - if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then + if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then echo "---> Identified kernel target architecture: $ARCHITECTURE" echo "---> Identified user space target architecture: $USER_ARCHITECTURE" ARCHITECTURE=$USER_ARCHITECTURE @@ -134,11 +134,11 @@ if [ -z "$run_id" ]; then # Determine run_id from head_sha runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha") run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """ -import json,sys +import json,sys,os data = json.load(sys.stdin) for i in data['workflow_runs']: - if i['name'] == 'Hyperion PR Build': + if os.path.basename(i['path']) == 'push_pull.yml': print(i['id']) break """ 2>/dev/null) @@ -198,11 +198,11 @@ if [[ ! -z ${CURRENT_SERVICE} ]]; then echo "---> Stop current service: ${CURRENT_SERVICE}" STOPCMD="systemctl stop --quiet ${CURRENT_SERVICE} --now" - USERNAME=${SUDO_USER:-$(whoami)} + USERNAME=${SUDO_USER:-$(whoami)} if [ ${USERNAME} != "root" ]; then STOPCMD="sudo ${STOPCMD}" fi - + ${STOPCMD} >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "---> Critical Error: Failed to stop service: ${CURRENT_SERVICE}, Hyperion may not be started. Stop Hyperion manually." diff --git a/bin/service/hyperion.systemd b/bin/service/hyperion.systemd index adee0eedf..7087d6b00 100644 --- a/bin/service/hyperion.systemd +++ b/bin/service/hyperion.systemd @@ -1,5 +1,5 @@ [Unit] -Description=Hyperion ambient light systemd service for user %i +Description=Hyperion ambient light systemd service for user %i Documentation=https://docs.hyperion-project.org Requisite=network.target Wants=network-online.target diff --git a/bin/service/hyperion.xml b/bin/service/hyperion.xml new file mode 100644 index 000000000..1ecc4e7e2 --- /dev/null +++ b/bin/service/hyperion.xml @@ -0,0 +1,22 @@ + + + Hyperion + Hyperion.NG firewall rules + + + + + + + + + + + + + + + + + + diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 40ada3e15..847c4c40b 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -14,7 +14,7 @@ macro(DeployMacOS TARGET) install(CODE "set(PLUGIN_DIR \"${QT_PLUGIN_DIR}\")" COMPONENT "Hyperion") install(CODE "set(BUILD_DIR \"${CMAKE_BINARY_DIR}\")" COMPONENT "Hyperion") install(CODE "set(ENABLE_EFFECTENGINE \"${ENABLE_EFFECTENGINE}\")" COMPONENT "Hyperion") - + install(CODE [[ file(GET_RUNTIME_DEPENDENCIES @@ -36,6 +36,7 @@ macro(DeployMacOS TARGET) FILES "${dependency}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/lib" TYPE SHARED_LIBRARY + FOLLOW_SYMLINK_CHAIN ) endif() endforeach() @@ -48,7 +49,6 @@ macro(DeployMacOS TARGET) foreach(PLUGIN "platforms" "sqldrivers" "imageformats") if(EXISTS ${PLUGIN_DIR}/${PLUGIN}) file(GLOB files "${PLUGIN_DIR}/${PLUGIN}/*") - list(FILTER files EXCLUDE REGEX ".*libqwebp\\.dylib$") foreach(file ${files}) file(GET_RUNTIME_DEPENDENCIES EXECUTABLES ${file} @@ -61,6 +61,7 @@ macro(DeployMacOS TARGET) DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/lib" TYPE SHARED_LIBRARY FILES ${DEPENDENCY} + FOLLOW_SYMLINK_CHAIN ) endforeach() @@ -76,25 +77,27 @@ macro(DeployMacOS TARGET) endif() endforeach() - include(BundleUtilities) + include(BundleUtilities) fixup_bundle("${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}" "${QT_PLUGINS}" "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/lib" IGNORE_ITEM "python;python3;Python;Python3;.Python;.Python3") if(ENABLE_EFFECTENGINE) # Detect the Python version and modules directory - find_package(Python3 3.5 REQUIRED) - execute_process( - COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" - OUTPUT_VARIABLE PYTHON_MODULES_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + if(NOT CMAKE_VERSION VERSION_LESS "3.12") + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + set(PYTHON_MODULES_DIR ${Python3_STDLIB}) + else() + find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) + set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + set(PYTHON_MODULES_DIR ${Python_STDLIB}) + endif() MESSAGE("Add Python ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} to bundle") MESSAGE("PYTHON_MODULES_DIR: ${PYTHON_MODULES_DIR}") # Copy Python modules to '/../Frameworks/Python.framework/Versions/Current/lib/PythonMAJOR.MINOR' and ignore the unnecessary stuff listed below if (PYTHON_MODULES_DIR) - set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") file( COPY ${PYTHON_MODULES_DIR}/ DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/Frameworks/Python.framework/Versions/Current/lib/python${PYTHON_VERSION_MAJOR_MINOR}" @@ -167,9 +170,9 @@ macro(DeployLinux TARGET) # Extract dependencies ignoring the system ones get_prerequisites(${TARGET_FILE} DEPENDENCIES 0 1 "" "") - + message(STATUS "Dependencies for target file: ${DEPENDENCIES}") - + # Append symlink and non-symlink dependencies to the list set(PREREQUISITE_LIBS "") foreach(DEPENDENCY ${DEPENDENCIES}) @@ -276,15 +279,13 @@ macro(DeployLinux TARGET) if(ENABLE_EFFECTENGINE) # Detect the Python version and modules directory if (NOT CMAKE_VERSION VERSION_LESS "3.12") + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") - set(PYTHON_MODULES_DIR "${Python3_STDLIB}") + set(PYTHON_MODULES_DIR ${Python3_STDLIB}) else() + find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))" - OUTPUT_VARIABLE PYTHON_MODULES_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + set(PYTHON_MODULES_DIR ${Python_STDLIB}) endif() # Copy Python modules to 'share/hyperion/lib/pythonMAJOR.MINOR' and ignore the unnecessary stuff listed below @@ -381,19 +382,25 @@ macro(DeployWindows TARGET) list(GET openssl_versions 0 openssl_version_major) list(GET openssl_versions 1 openssl_version_minor) - set(library_suffix "-${openssl_version_major}_${openssl_version_minor}") + set(open_ssl_version_suffix) + if (openssl_version_major VERSION_EQUAL 1 AND openssl_version_minor VERSION_EQUAL 1) + set(open_ssl_version_suffix "-1_1") + else() + set(open_ssl_version_suffix "-3") + endif() + if (CMAKE_SIZEOF_VOID_P EQUAL 8) - string(APPEND library_suffix "-x64") + string(APPEND open_ssl_version_suffix "-x64") endif() find_file(OPENSSL_SSL - NAMES "libssl${library_suffix}.dll" + NAMES "libssl${open_ssl_version_suffix}.dll" PATHS ${OPENSSL_INCLUDE_DIR}/.. ${OPENSSL_INCLUDE_DIR}/../bin NO_DEFAULT_PATH ) find_file(OPENSSL_CRYPTO - NAMES "libcrypto${library_suffix}.dll" + NAMES "libcrypto${open_ssl_version_suffix}.dll" PATHS ${OPENSSL_INCLUDE_DIR}/.. ${OPENSSL_INCLUDE_DIR}/../bin NO_DEFAULT_PATH ) diff --git a/cmake/Findqmdnsengine.cmake b/cmake/Findqmdnsengine.cmake index ceb7a6b8d..dac675336 100644 --- a/cmake/Findqmdnsengine.cmake +++ b/cmake/Findqmdnsengine.cmake @@ -19,4 +19,10 @@ find_package_handle_standard_args(qmdnsengine REQUIRED_VARS QMDNS_INCLUDE_DIR QMDNS_LIBRARIES ) -mark_as_advanced(QMDNS_INCLUDE_DIR QMDNS_LIBRARIES) +if(QMDNSENGINE_FOUND) + add_library(qmdnsengine STATIC IMPORTED GLOBAL) + set_target_properties(qmdnsengine PROPERTIES + IMPORTED_LOCATION ${QMDNS_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${QMDNS_INCLUDE_DIR} + ) +endif() diff --git a/cmake/LDGold.cmake b/cmake/LDGold.cmake deleted file mode 100644 index 92e596940..000000000 --- a/cmake/LDGold.cmake +++ /dev/null @@ -1,17 +0,0 @@ -option(ENABLE_LDGOLD "Use GNU gold linker" ON) - -set(LDGOLD_FOUND FALSE) -if(ENABLE_LDGOLD) - execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) - if(LD_VERSION MATCHES "GNU gold") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold") - set(LDGOLD_FOUND TRUE) - message(STATUS "Linker: GNU gold") - else() - message(STATUS "GNU gold linker is not available, falling back to default system linker") - endif() -else() - message(STATUS "Linker: Default system linker") -endif() diff --git a/cmake/desktop/hyperiond.desktop b/cmake/desktop/hyperion.desktop similarity index 61% rename from cmake/desktop/hyperiond.desktop rename to cmake/desktop/hyperion.desktop index d47a38d33..67d02cbd1 100644 --- a/cmake/desktop/hyperiond.desktop +++ b/cmake/desktop/hyperion.desktop @@ -1,8 +1,8 @@ [Desktop Entry] Name=Hyperion GenericName=Hyperion Ambient Lighting -Comment=Hyperion mimics the well known Ambilight from Philips -Icon=/usr/share/pixmaps/hyperion/hyperiond_128.png +Comment=Hyperion is an opensource Bias or Ambient Lighting implementation +Icon=hyperion Terminal=false TryExec=hyperiond Exec=hyperiond diff --git a/cmake/desktop/hyperion.metainfo.xml b/cmake/desktop/hyperion.metainfo.xml new file mode 100644 index 000000000..bc1ac7e60 --- /dev/null +++ b/cmake/desktop/hyperion.metainfo.xml @@ -0,0 +1,48 @@ + + + + com.hyperion-project.hyperion + MIT + MIT + Hyperion + The successor to Hyperion aka Hyperion Next Generation. + + +

+ Hyperion is an opensource Bias or Ambient Lighting implementation which you might know from TV manufacturers. + It supports many LED devices and video grabbers. +

+
+ + https://hyperion-project.org + https://github.com/hyperion-project/hyperion.ng/issues + https://hyperion-project.org + https://docs.hyperion-project.org/ + https://www.paypal.me/HyperionAmbi + https://poeditor.com/join/project/Y4F6vHRFjA + + + + + + + + + + + The multi language web interface + https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/doc/screenshot.png + + + + + Application + + + com.hyperion-project.hyperion.desktop + + Hyperion Project + admin@hyperion-project.org + + +
diff --git a/cmake/desktop/hyperiond_128.png b/cmake/desktop/hyperiond_128.png deleted file mode 100644 index dc400fc70..000000000 Binary files a/cmake/desktop/hyperiond_128.png and /dev/null differ diff --git a/cmake/package-scripts/postinst b/cmake/package-scripts/postinst index 7bc633227..54cd3901c 100644 --- a/cmake/package-scripts/postinst +++ b/cmake/package-scripts/postinst @@ -105,9 +105,9 @@ ln -fs $BINSP/scripts/updateHyperionUser.sh $BINTP/updateHyperionUser 2>/dev/nul if [ "$IS_UPGRADE" = false ]; then if hash desktop-file-install 2>/dev/null; then echo "---> Install Hyperion desktop icons" - mkdir /usr/share/pixmaps/hyperion 2>/dev/null - cp /usr/share/hyperion/desktop/*.png /usr/share/pixmaps/hyperion 2>/dev/null - desktop-file-install /usr/share/hyperion/desktop/hyperiond.desktop 2>/dev/null + cp -R /usr/share/hyperion/icons /usr/share/icons/hicolor 2>/dev/null + cp /usr/share/hyperion/desktop/hyperion.metainfo.xml /usr/share/metainfo/hyperion.metainfo.xml 2>/dev/null + desktop-file-install /usr/share/hyperion/desktop/hyperion.desktop 2>/dev/null fi fi @@ -149,7 +149,7 @@ $REBOOTMESSAGE echo "-----------------------------------------------------------------------------" echo "Webpage: www.hyperion-project.org" echo "Forum: www.hyperion-project.org" -echo "Documenation: docs.hyperion-project.org" +echo "Documentation: docs.hyperion-project.org" echo "-----------------------------------------------------------------------------" diff --git a/cmake/package-scripts/prerm b/cmake/package-scripts/prerm index 648c9a2db..ea2b9d666 100644 --- a/cmake/package-scripts/prerm +++ b/cmake/package-scripts/prerm @@ -59,11 +59,29 @@ fi # In case we don't use a service kill all instances killall hyperiond 2> /dev/null -# delete desktop icons; desktop-file-edit is a workaround to hide the entry and delete it afterwards manual. -# TODO Better way for deletion and keep the desktop in sync without logout/login or desktop dependend cmds? -echo "---> Delete Hyperion desktop icons" -desktop-file-edit --set-key=NoDisplay --set-value=true /usr/share/applications/hyperiond.desktop 2> /dev/null +# remove desktop/appstream file rm -v /usr/share/applications/hyperion* 2> /dev/null -rm -rv /usr/share/pixmaps/hyperion 2> /dev/null +rm -v /usr/share/metainfo/hyperion* 2> /dev/null + +# update desktop-database (if exists) +if [ -x /usr/bin/update-desktop-database ]; then + update-desktop-database -q /usr/share/applications +fi + +# remove Hyperion icons +for i in 16x16 22x22 24x24 32x32 36x36 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512 + rm -v usr/share/icons/hicolor/$i/apps/hyperion.png 2> /dev/null +done + +# update icon-cache +if [ -e /usr/share/icons/hicolor/icon-theme.cache ] ; then + # touch it, just in case we cannot find the binary... + touch --no-create /usr/share/icons/hicolor + if hash gtk-update-icon-cache 2>/dev/null; then + gtk-update-icon-cache /usr/share/icons/hicolor + fi + # ignore errors + true +fi exit 0 diff --git a/cmake/packages.cmake b/cmake/packages.cmake index 046cefe7d..a6701545e 100644 --- a/cmake/packages.cmake +++ b/cmake/packages.cmake @@ -52,7 +52,7 @@ SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org") SET ( CPACK_PACKAGE_VENDOR "hyperion-project") SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" ) SET ( CPACK_PACKAGE_INSTALL_DIRECTORY "Hyperion" ) -SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png" ) +SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-32px.png" ) SET ( CPACK_PACKAGE_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}") SET ( CPACK_PACKAGE_VERSION_MINOR "${HYPERION_VERSION_MINOR}") diff --git a/cmake/win/win_rc.cmake b/cmake/win/win_rc.cmake deleted file mode 100644 index 203e37942..000000000 --- a/cmake/win/win_rc.cmake +++ /dev/null @@ -1,15 +0,0 @@ -# process a .rc file for windows -# Provides (BINARY_NAME)_WIN_RC_PATH with path to generated file -function(generate_win_rc_file BINARY_NAME) - # target path to store generated files - set(TARGET_PATH ${CMAKE_BINARY_DIR}/win_rc_file/${BINARY_NAME}) - # assets - string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico) - # configure the rc file - configure_file( - ${CMAKE_SOURCE_DIR}/cmake/win/win.rc.in - ${TARGET_PATH}/win.rc - ) - # provide var for parent scope - set(${BINARY_NAME}_WIN_RC_PATH ${TARGET_PATH}/win.rc PARENT_SCOPE) -endfunction() diff --git a/debian/control.in b/debian/control.in deleted file mode 100644 index e52b69354..000000000 --- a/debian/control.in +++ /dev/null @@ -1,12 +0,0 @@ -Source: hyperion -Section: devel -Priority: optional -Build-Depends: @BUILD_DEPENDS@ -Standards-Version: @STANDARDS_VERSION@ -Maintainer: Hyperion Project -Homepage: https://hyperion-project.org/ - -Package: hyperion -Architecture: @ARCHITECTURE@ -Depends: @DEPENDS@ -Description: Hyperion is an opensource Bias or Ambient Lighting implementation which you might know from TV manufactures. It supports many LED devices and video grabbers. diff --git a/debian/distributions b/debian/distributions deleted file mode 100644 index 12da7848c..000000000 --- a/debian/distributions +++ /dev/null @@ -1,58 +0,0 @@ -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Codename: focal -Architectures: amd64 armhf arm64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Codename: jammy -Architectures: amd64 armhf arm64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Codename: kinetic -Architectures: amd64 armhf arm64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Codename: lunar -Architectures: amd64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Suite: oldstable -Codename: buster -Architectures: amd64 armhf arm64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Suite: stable -Codename: bullseye -Architectures: amd64 armhf arm64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes - -Origin: Hyperion-Project -Label: apt.hyperion-project.org -Suite: unstable -Codename: bookworm -Architectures: amd64 -Components: main -Description: Official APT Repository by Hyperion Project -SignWith: yes diff --git a/debian/rules.in b/debian/rules.in deleted file mode 100644 index a8d28d845..000000000 --- a/debian/rules.in +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/make -f -export DH_VERBOSE = 1 - -BUILDDIR = build - -build: - mkdir $(BUILDDIR); - cd $(BUILDDIR); cmake @CMAKE_ENVIRONMENT@ -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr .. - make -j4 -C $(BUILDDIR) - -binary: binary-indep binary-arch - -binary-indep: - -binary-arch: - cd $(BUILDDIR); cmake -P cmake_install.cmake - rm -rf debian/tmp/usr/include debian/tmp/usr/lib debian/tmp/usr/bin/flatc - mkdir debian/tmp/DEBIAN - cp cmake/package-scripts/postinst debian/tmp/DEBIAN - chmod 0775 debian/tmp/DEBIAN/postinst - cp cmake/package-scripts/preinst debian/tmp/DEBIAN - chmod 0775 debian/tmp/DEBIAN/preinst - cp cmake/package-scripts/prerm debian/tmp/DEBIAN - chmod 0775 debian/tmp/DEBIAN/prerm - dpkg-gencontrol -phyperion - dpkg --build debian/tmp .. - rm -rf debian/tmp $(BUILDDIR) - -clean: - rm -rf $(BUILDDIR) - -.PHONY: build binary binary-arch binary-indep clean diff --git a/dependencies/CMakeLists-qmdnsengine.txt.in b/dependencies/CMakeLists-qmdnsengine.txt.in deleted file mode 100644 index b3f0812a2..000000000 --- a/dependencies/CMakeLists-qmdnsengine.txt.in +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(qmdnsengine) - -set(WORK_DIR "@QMDNS_WORK_DIR@") -set(SOURCE_DIR "@QMDNS_SOURCE_DIR@") -set(INSTALL_DIR "@QMDNS_INSTALL_DIR@") -set(CMAKE_ARGS "@QMDNS_CMAKE_ARGS@") -set(QMDNS_LOGGING "@QMDNS_LOGGING@") - -include(ExternalProject) - -ExternalProject_Add(qmdnsengine - PREFIX ${WORK_DIR} - BUILD_ALWAYS OFF - DOWNLOAD_COMMAND "" - SOURCE_DIR ${SOURCE_DIR} - INSTALL_DIR ${INSTALL_DIR} - CMAKE_ARGS ${CMAKE_ARGS} - LOG_DOWNLOAD ${QMDNS_LOGGING} - LOG_UPDATE ${QMDNS_LOGGING} - LOG_CONFIGURE ${QMDNS_LOGGING} - LOG_BUILD ${QMDNS_LOGGING} - LOG_INSTALL ${QMDNS_LOGGING} - LOG_TEST ${QMDNS_LOGGING} -) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index bc5044beb..28ba5d049 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -24,46 +24,46 @@ if (ENABLE_MDNS) if (USE_SYSTEM_QMDNS_LIBS) find_package(qmdnsengine REQUIRED) else () - if (NOT DEFINED BUILD_QMDNS_ONCE) - set(BUILD_QMDNS_ONCE CACHE INTERNAL "Done") - set(QMDNS_WORK_DIR "${CMAKE_BINARY_DIR}/dependencies/external/qmdnsengine") - set(QMDNS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/qmdnsengine") - set(QMDNS_INSTALL_DIR ${CMAKE_BINARY_DIR}) - set(QMDNS_CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR} - -DBIN_INSTALL_DIR:STRING=lib - -DLIB_INSTALL_DIR:STRING=lib - -DINCLUDE_INSTALL_DIR:STRING=include - -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} - -Wno-dev - ) - - if(${CMAKE_BUILD_TYPE} AND ${CMAKE_BUILD_TYPE} EQUAL "Debug") - set(QMDNS_LOGGING 1) - else () - set(QMDNS_LOGGING 0) - endif () - - configure_file(${CMAKE_SOURCE_DIR}/dependencies/CMakeLists-qmdnsengine.txt.in ${QMDNS_WORK_DIR}/CMakeLists.txt @ONLY) - execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${QMDNS_WORK_DIR}) - execute_process(COMMAND ${CMAKE_COMMAND} --build . --config "${CMAKE_BUILD_TYPE}" WORKING_DIRECTORY ${QMDNS_WORK_DIR}) - endif() - - set(QMDNS_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include") - if(WIN32) set(QMDNS_LIBRARIES ${CMAKE_BINARY_DIR}/lib/qmdnsengine${CMAKE_STATIC_LIBRARY_SUFFIX}) else() set(QMDNS_LIBRARIES ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}qmdnsengine${CMAKE_STATIC_LIBRARY_SUFFIX}) endif() - mark_as_advanced (QMDNS_INCLUDE_DIR QMDNS_LIBRARIES) + get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + set(QMDNS_CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=OFF + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR} + -DBIN_INSTALL_DIR:STRING=lib + -DLIB_INSTALL_DIR:STRING=lib + -DINCLUDE_INSTALL_DIR:STRING=include + -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} + $<$>:-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}> + -Wno-dev + ) + + include(ExternalProject) + ExternalProject_Add(qmdns + PREFIX ${CMAKE_BINARY_DIR}/dependencies/external/qmdnsengine + BUILD_ALWAYS OFF + DOWNLOAD_COMMAND "" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/qmdnsengine + BINARY_DIR ${CMAKE_BINARY_DIR}/dependencies/external/qmdnsengine/build + CMAKE_ARGS ${QMDNS_CMAKE_ARGS} + CONFIGURE_COMMAND ${CMAKE_COMMAND} -S -B ${QMDNS_CMAKE_ARGS} -G ${CMAKE_GENERATOR} + BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ + INSTALL_DIR ${CMAKE_BINARY_DIR} + BUILD_BYPRODUCTS ${QMDNS_LIBRARIES} + ) + + add_library(qmdnsengine STATIC IMPORTED GLOBAL) + set_target_properties(qmdnsengine PROPERTIES + IMPORTED_LOCATION ${QMDNS_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include + ) + + add_dependencies(qmdnsengine qmdns) endif () - - set(QMDNS_INCLUDE_DIR ${QMDNS_INCLUDE_DIR} PARENT_SCOPE) - set(QMDNS_LIBRARIES ${QMDNS_LIBRARIES} PARENT_SCOPE) - include_directories(${QMDNS_INCLUDE_DIR}) endif() #============================================================================= @@ -75,8 +75,18 @@ if(ENABLE_FLATBUF_SERVER OR ENABLE_FLATBUF_CONNECT) if (USE_SYSTEM_FLATBUFFERS_LIBS) find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc REQUIRED) - find_package(Flatbuffers REQUIRED) - else () + find_package(Flatbuffers QUIET) + if (NOT Flatbuffers_FOUND) + find_package(FlatBuffers QUIET) + if (NOT FlatBuffers_FOUND) + message(STATUS "Could not find Flatbuffers system library, build static Flatbuffers library") + set(DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF PARENT_SCOPE) + set(USE_SYSTEM_FLATBUFFERS_LIBS OFF) + endif() + endif() + endif() + + if (NOT USE_SYSTEM_FLATBUFFERS_LIBS) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared flatbuffers library") set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Build Flatbuffers with tests") add_subdirectory(external/flatbuffers) @@ -133,9 +143,9 @@ endif() if(ENABLE_PROTOBUF_SERVER) set(USE_SYSTEM_PROTO_LIBS ${DEFAULT_USE_SYSTEM_PROTO_LIBS} CACHE BOOL "use protobuf library from system") - + # defines for 3rd party sub-modules - set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated") + set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated") if (USE_SYSTEM_PROTO_LIBS) find_package(Protobuf REQUIRED) @@ -163,7 +173,7 @@ if(ENABLE_PROTOBUF_SERVER) # define the protobuf library set(PROTOBUF_LIBRARIES protobuf::libprotobuf) - + endif() # redefine at parent scope diff --git a/dependencies/external/mbedtls b/dependencies/external/mbedtls index 1873d3bfc..edb8fec98 160000 --- a/dependencies/external/mbedtls +++ b/dependencies/external/mbedtls @@ -1 +1 @@ -Subproject commit 1873d3bfc2da771672bd8e7e8f41f57e0af77f33 +Subproject commit edb8fec9882084344a314368ac7fd957a187519c diff --git a/include/grabber/OsxFrameGrabberMock.h b/include/grabber/OsxFrameGrabberMock.h deleted file mode 100644 index bdc622c4a..000000000 --- a/include/grabber/OsxFrameGrabberMock.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once -#ifndef __APPLE__ - -/* - * this is a mock up for compiling and testing osx wrapper on no osx platform. - * this will show a test image and rotate the colors. - * - * see https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.8.sdk/System/Library/Frameworks/CoreGraphics.framework/Versions/A/Headers - * - */ - -#include -#include - -enum _CGError { - kCGErrorSuccess = 0, - kCGErrorFailure = 1000, - kCGErrorIllegalArgument = 1001, - kCGErrorInvalidConnection = 1002, - kCGErrorInvalidContext = 1003, - kCGErrorCannotComplete = 1004, - kCGErrorNotImplemented = 1006, - kCGErrorRangeCheck = 1007, - kCGErrorTypeCheck = 1008, - kCGErrorInvalidOperation = 1010, - kCGErrorNoneAvailable = 1011, - - /* Obsolete errors. */ - kCGErrorNameTooLong = 1005, - kCGErrorNoCurrentPoint = 1009, - kCGErrorApplicationRequiresNewerSystem = 1015, - kCGErrorApplicationNotPermittedToExecute = 1016, - kCGErrorApplicationIncorrectExecutableFormatFound = 1023, - kCGErrorApplicationIsLaunching = 1024, - kCGErrorApplicationAlreadyRunning = 1025, - kCGErrorApplicationCanOnlyBeRunInOneSessionAtATime = 1026, - kCGErrorClassicApplicationsMustBeLaunchedByClassic = 1027, - kCGErrorForkFailed = 1028, - kCGErrorRetryRegistration = 1029, - kCGErrorFirst = 1000, - kCGErrorLast = 1029 -}; -typedef int32_t CGError; -typedef double CGFloat; - -struct CGSize { - CGFloat width; - CGFloat height; -}; -typedef struct CGSize CGSize; - -struct CGPoint { - float x; - float y; -}; -typedef struct CGPoint CGPoint; - -struct CGRect { - CGPoint origin; - CGSize size; -}; -typedef struct CGRect CGRect; - -typedef CGError CGDisplayErr; -typedef uint32_t CGDirectDisplayID; -typedef uint32_t CGDisplayCount;; -typedef struct CGDisplayMode *CGDisplayModeRef; - -typedef Image CGImage; -typedef CGImage* CGImageRef; -typedef unsigned char CFData; -typedef CFData* CFDataRef; - -const int kCGDirectMainDisplay = 0; - -CGError CGGetActiveDisplayList(uint32_t maxDisplays, CGDirectDisplayID *activeDisplays, uint32_t *displayCount); -CGDisplayModeRef CGDisplayCopyDisplayMode(CGDirectDisplayID display); -CGRect CGDisplayBounds(CGDirectDisplayID display); -void CGDisplayModeRelease(CGDisplayModeRef mode); - -CGImageRef CGDisplayCreateImage(CGDirectDisplayID display); -void CGImageRelease(CGImageRef image); -CGImageRef CGImageGetDataProvider(CGImageRef image); -CFDataRef CGDataProviderCopyData(CGImageRef image); -unsigned char* CFDataGetBytePtr(CFDataRef imgData); -unsigned CGImageGetWidth(CGImageRef image); -unsigned CGImageGetHeight(CGImageRef image); -unsigned CGImageGetBitsPerPixel(CGImageRef image); -unsigned CGImageGetBytesPerRow(CGImageRef image); -void CFRelease(CFDataRef imgData); - - -#endif diff --git a/include/grabber/AmlogicGrabber.h b/include/grabber/amlogic/AmlogicGrabber.h similarity index 97% rename from include/grabber/AmlogicGrabber.h rename to include/grabber/amlogic/AmlogicGrabber.h index 972313544..f61742aa8 100644 --- a/include/grabber/AmlogicGrabber.h +++ b/include/grabber/amlogic/AmlogicGrabber.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include /// /// diff --git a/include/grabber/AmlogicWrapper.h b/include/grabber/amlogic/AmlogicWrapper.h similarity index 95% rename from include/grabber/AmlogicWrapper.h rename to include/grabber/amlogic/AmlogicWrapper.h index 87796bcd9..d97c45c10 100644 --- a/include/grabber/AmlogicWrapper.h +++ b/include/grabber/amlogic/AmlogicWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include /// /// The Amlogic uses an instance of the AmlogicGrabber to obtain ImageRgb's from the diff --git a/include/grabber/AudioGrabber.h b/include/grabber/audio/AudioGrabber.h similarity index 100% rename from include/grabber/AudioGrabber.h rename to include/grabber/audio/AudioGrabber.h diff --git a/include/grabber/AudioGrabberLinux.h b/include/grabber/audio/AudioGrabberLinux.h similarity index 86% rename from include/grabber/AudioGrabberLinux.h rename to include/grabber/audio/AudioGrabberLinux.h index 0f19ae6c1..272ab2f53 100644 --- a/include/grabber/AudioGrabberLinux.h +++ b/include/grabber/audio/AudioGrabberLinux.h @@ -6,7 +6,7 @@ #include // Hyperion-utils includes -#include +#include /// /// @brief The Linux Audio capture implementation @@ -18,74 +18,69 @@ class AudioGrabberLinux : public AudioGrabber AudioGrabberLinux(); ~AudioGrabberLinux() override; - /// + /// /// Process audio buffer /// void processAudioBuffer(snd_pcm_sframes_t frames); - /// + /// /// Is Running Flag /// std::atomic _isRunning; - /// + /// /// Current capture device /// snd_pcm_t * _captureDevice; public slots: - /// + /// /// Start audio capturing session /// /// @returns true if successful bool start() override; - /// + /// /// Stop audio capturing session /// void stop() override; - /// + /// /// Discovery audio devices /// QJsonArray discover(const QJsonObject& params) override; private: - /// + /// /// Refresh audio devices /// void refreshDevices(); - /// + /// /// Configure current audio capture interface /// bool configureCaptureInterface(); - /// + /// /// Get device name from path /// QString getDeviceName(const QString& devicePath) const; - /// + /// /// Current sample rate /// unsigned int _sampleRate; - /// + /// /// Audio capture thread /// pthread_t _audioThread; - /// + /// /// ALSA device configuration parameters /// snd_pcm_hw_params_t * _captureDeviceConfig; }; -/// -/// Audio processing thread function -/// -static void* AudioThreadRunner(void* params); - #endif // AUDIOGRABBERLINUX_H diff --git a/include/grabber/AudioGrabberWindows.h b/include/grabber/audio/AudioGrabberWindows.h similarity index 98% rename from include/grabber/AudioGrabberWindows.h rename to include/grabber/audio/AudioGrabberWindows.h index 9c3945b6d..ee7f53c42 100644 --- a/include/grabber/AudioGrabberWindows.h +++ b/include/grabber/audio/AudioGrabberWindows.h @@ -2,7 +2,7 @@ #define AUDIOGRABBERWINDOWS_H // Hyperion-utils includes -#include +#include #include /// @@ -14,7 +14,7 @@ class AudioGrabberWindows : public AudioGrabber AudioGrabberWindows(); ~AudioGrabberWindows() override; - + public slots: bool start() override; void stop() override; diff --git a/include/grabber/AudioWrapper.h b/include/grabber/audio/AudioWrapper.h similarity index 90% rename from include/grabber/AudioWrapper.h rename to include/grabber/audio/AudioWrapper.h index 9e13c933d..4f3017908 100644 --- a/include/grabber/AudioWrapper.h +++ b/include/grabber/audio/AudioWrapper.h @@ -3,14 +3,14 @@ #include #ifdef WIN32 - #include + #include #endif #ifdef __linux__ - #include + #include #endif -/// +/// /// Audio Grabber wrapper /// class AudioWrapper : public GrabberWrapper @@ -32,7 +32,7 @@ class AudioWrapper : public GrabberWrapper /// ~AudioWrapper() override; - /// + /// /// Settings update handler /// void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override; @@ -43,13 +43,13 @@ class AudioWrapper : public GrabberWrapper /// void action() override; - /// + /// /// Start audio capturing session /// /// @returns true if successful bool start() override; - /// + /// /// Stop audio capturing session /// void stop() override; diff --git a/include/grabber/DirectXGrabber.h b/include/grabber/directx/DirectXGrabber.h similarity index 100% rename from include/grabber/DirectXGrabber.h rename to include/grabber/directx/DirectXGrabber.h diff --git a/include/grabber/DirectXWrapper.h b/include/grabber/directx/DirectXWrapper.h similarity index 96% rename from include/grabber/DirectXWrapper.h rename to include/grabber/directx/DirectXWrapper.h index d063497da..56ec68798 100644 --- a/include/grabber/DirectXWrapper.h +++ b/include/grabber/directx/DirectXWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include class DirectXWrapper: public GrabberWrapper { diff --git a/include/grabber/DispmanxFrameGrabber.h b/include/grabber/dispmanx/DispmanxFrameGrabber.h similarity index 100% rename from include/grabber/DispmanxFrameGrabber.h rename to include/grabber/dispmanx/DispmanxFrameGrabber.h diff --git a/include/grabber/DispmanxWrapper.h b/include/grabber/dispmanx/DispmanxWrapper.h similarity index 95% rename from include/grabber/DispmanxWrapper.h rename to include/grabber/dispmanx/DispmanxWrapper.h index 303391fa9..499316fc4 100644 --- a/include/grabber/DispmanxWrapper.h +++ b/include/grabber/dispmanx/DispmanxWrapper.h @@ -3,7 +3,7 @@ // Utils includes #include #include -#include +#include /// /// The DispmanxWrapper uses an instance of the DispmanxFrameGrabber to obtain ImageRgb's from the diff --git a/include/grabber/FramebufferFrameGrabber.h b/include/grabber/framebuffer/FramebufferFrameGrabber.h similarity index 100% rename from include/grabber/FramebufferFrameGrabber.h rename to include/grabber/framebuffer/FramebufferFrameGrabber.h diff --git a/include/grabber/FramebufferWrapper.h b/include/grabber/framebuffer/FramebufferWrapper.h similarity index 94% rename from include/grabber/FramebufferWrapper.h rename to include/grabber/framebuffer/FramebufferWrapper.h index 2098d362a..084eb96cb 100644 --- a/include/grabber/FramebufferWrapper.h +++ b/include/grabber/framebuffer/FramebufferWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include /// /// The FramebufferWrapper uses an instance of the FramebufferFrameGrabber to obtain ImageRgb's from the diff --git a/include/grabber/OsxFrameGrabber.h b/include/grabber/osx/OsxFrameGrabber.h similarity index 95% rename from include/grabber/OsxFrameGrabber.h rename to include/grabber/osx/OsxFrameGrabber.h index 175308887..afb430fc5 100644 --- a/include/grabber/OsxFrameGrabber.h +++ b/include/grabber/osx/OsxFrameGrabber.h @@ -1,11 +1,7 @@ #pragma once // OSX includes -#ifdef __APPLE__ #include -#else -#include -#endif // Utils includes #include diff --git a/include/grabber/OsxWrapper.h b/include/grabber/osx/OsxWrapper.h similarity index 95% rename from include/grabber/OsxWrapper.h rename to include/grabber/osx/OsxWrapper.h index c9520f7e9..fd367184b 100644 --- a/include/grabber/OsxWrapper.h +++ b/include/grabber/osx/OsxWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include /// /// The OsxWrapper uses an instance of the OsxFrameGrabber to obtain ImageRgb's from the displayed content. diff --git a/include/grabber/QtGrabber.h b/include/grabber/qt/QtGrabber.h similarity index 100% rename from include/grabber/QtGrabber.h rename to include/grabber/qt/QtGrabber.h diff --git a/include/grabber/QtWrapper.h b/include/grabber/qt/QtWrapper.h similarity index 97% rename from include/grabber/QtWrapper.h rename to include/grabber/qt/QtWrapper.h index 3bba4a821..3df2a64e6 100644 --- a/include/grabber/QtWrapper.h +++ b/include/grabber/qt/QtWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include /// /// The QtWrapper uses QtFramework API's to get a picture from system diff --git a/include/grabber/EncoderThread.h b/include/grabber/video/EncoderThread.h similarity index 91% rename from include/grabber/EncoderThread.h rename to include/grabber/video/EncoderThread.h index 93a3ed882..51008d3ed 100644 --- a/include/grabber/EncoderThread.h +++ b/include/grabber/video/EncoderThread.h @@ -136,11 +136,11 @@ class EncoderThreadManager : public QObject public: explicit EncoderThreadManager(QObject *parent = nullptr) : QObject(parent) - , _threadCount(static_cast(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT))) + , _threadCount(qMax(QThread::idealThreadCount(), DEFAULT_THREAD_COUNT)) , _threads(nullptr) { _threads = new Thread*[_threadCount]; - for (unsigned long i = 0; i < _threadCount; i++) + for (int i = 0; i < _threadCount; i++) { _threads[i] = new Thread(new EncoderThread, this); _threads[i]->setObjectName("Encoder " + QString::number(i)); @@ -151,7 +151,7 @@ class EncoderThreadManager : public QObject { if (_threads != nullptr) { - for(unsigned long i = 0; i < _threadCount; i++) + for(int i = 0; i < _threadCount; i++) { _threads[i]->deleteLater(); _threads[i] = nullptr; @@ -165,18 +165,18 @@ class EncoderThreadManager : public QObject void start() { if (_threads != nullptr) - for (unsigned long i = 0; i < _threadCount; i++) + for (int i = 0; i < _threadCount; i++) connect(_threads[i]->thread(), &EncoderThread::newFrame, this, &EncoderThreadManager::newFrame); } void stop() { if (_threads != nullptr) - for(unsigned long i = 0; i < _threadCount; i++) + for(int i = 0; i < _threadCount; i++) disconnect(_threads[i]->thread(), nullptr, nullptr, nullptr); } - unsigned long _threadCount; + int _threadCount; Thread** _threads; signals: diff --git a/include/grabber/VideoWrapper.h b/include/grabber/video/VideoWrapper.h similarity index 89% rename from include/grabber/VideoWrapper.h rename to include/grabber/video/VideoWrapper.h index 932ff1ab6..19422f251 100644 --- a/include/grabber/VideoWrapper.h +++ b/include/grabber/video/VideoWrapper.h @@ -4,9 +4,9 @@ #include #if defined(ENABLE_MF) - #include + #include #elif defined(ENABLE_V4L2) - #include + #include #endif #if defined(ENABLE_CEC) diff --git a/include/grabber/MFGrabber.h b/include/grabber/video/mediafoundation/MFGrabber.h similarity index 98% rename from include/grabber/MFGrabber.h rename to include/grabber/video/mediafoundation/MFGrabber.h index f778f8e89..301420698 100644 --- a/include/grabber/MFGrabber.h +++ b/include/grabber/video/mediafoundation/MFGrabber.h @@ -21,7 +21,7 @@ #include // decoder thread includes -#include +#include /// Forward class declaration class SourceReaderCB; diff --git a/include/grabber/V4L2Grabber.h b/include/grabber/video/v4l2/V4L2Grabber.h similarity index 99% rename from include/grabber/V4L2Grabber.h rename to include/grabber/video/v4l2/V4L2Grabber.h index 22f8cdba9..6c72be949 100644 --- a/include/grabber/V4L2Grabber.h +++ b/include/grabber/video/v4l2/V4L2Grabber.h @@ -19,7 +19,7 @@ #include // decoder thread includes -#include +#include // Determine the cmake options #include diff --git a/include/grabber/X11Grabber.h b/include/grabber/x11/X11Grabber.h similarity index 100% rename from include/grabber/X11Grabber.h rename to include/grabber/x11/X11Grabber.h diff --git a/include/grabber/X11Wrapper.h b/include/grabber/x11/X11Wrapper.h similarity index 97% rename from include/grabber/X11Wrapper.h rename to include/grabber/x11/X11Wrapper.h index 79b6da925..dae62ad70 100644 --- a/include/grabber/X11Wrapper.h +++ b/include/grabber/x11/X11Wrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include // some include of xorg defines "None" this is also used by QT and has to be undefined to avoid collisions #ifdef None #undef None diff --git a/include/grabber/XcbGrabber.h b/include/grabber/xcb/XcbGrabber.h similarity index 100% rename from include/grabber/XcbGrabber.h rename to include/grabber/xcb/XcbGrabber.h diff --git a/include/grabber/XcbWrapper.h b/include/grabber/xcb/XcbWrapper.h similarity index 94% rename from include/grabber/XcbWrapper.h rename to include/grabber/xcb/XcbWrapper.h index 71bb70ea9..0292937c1 100644 --- a/include/grabber/XcbWrapper.h +++ b/include/grabber/xcb/XcbWrapper.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include // some include of xorg defines "None" this is also used by QT and has to be undefined to avoid collisions #ifdef None diff --git a/include/hyperion/ImageToLedsMap.h b/include/hyperion/ImageToLedsMap.h index 45e7bb5ab..d720581a5 100644 --- a/include/hyperion/ImageToLedsMap.h +++ b/include/hyperion/ImageToLedsMap.h @@ -555,7 +555,7 @@ namespace hyperion if (pixelNum > 0) { // initial cluster with different colors - auto clusters = std::unique_ptr< ColorCluster >(new ColorCluster[_clusterCount]); + std::unique_ptr[]> clusters(new ColorCluster[_clusterCount]); for(int k = 0; k < _clusterCount; ++k) { clusters.get()[k].newColor = DEFAULT_CLUSTER_COLORS[k]; diff --git a/include/utils/Process.h b/include/utils/Process.h index f8da8e65b..07df2fe78 100644 --- a/include/utils/Process.h +++ b/include/utils/Process.h @@ -3,9 +3,8 @@ #include #include -namespace Process { - -void restartHyperion(int exitCode = 0); -QByteArray command_exec(const QString& cmd, const QByteArray& data = {}); - +namespace Process +{ + void restartHyperion(int exitCode = 0); + QByteArray command_exec(const QString& cmd, const QByteArray& data = {}); } diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index ba5716ba2..7acad42a0 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -1,7 +1,7 @@ # Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) +set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) +set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) add_subdirectory(hyperion) add_subdirectory(commandline) @@ -34,7 +34,7 @@ add_subdirectory(ssdp) if(ENABLE_MDNS) add_subdirectory(mdns) -endif() +endif() if(ENABLE_EFFECTENGINE) add_subdirectory(effectengine) diff --git a/libsrc/api/CMakeLists.txt b/libsrc/api/CMakeLists.txt index 3fd822ffc..ac5cdcfd9 100644 --- a/libsrc/api/CMakeLists.txt +++ b/libsrc/api/CMakeLists.txt @@ -1,26 +1,20 @@ -# Define the current source locations - -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/api) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/api) - -FILE ( GLOB_RECURSE Api_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -set(Api_RESOURCES ${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc ) - add_library(hyperion-api - ${Api_SOURCES} - ${Api_RESOURCES} + ${CMAKE_SOURCE_DIR}/include/api/apiStructs.h + ${CMAKE_SOURCE_DIR}/include/api/API.h + ${CMAKE_SOURCE_DIR}/include/api/JsonAPI.h + ${CMAKE_SOURCE_DIR}/include/api/JsonCB.h + ${CMAKE_SOURCE_DIR}/libsrc/api/JsonAPI.cpp + ${CMAKE_SOURCE_DIR}/libsrc/api/API.cpp + ${CMAKE_SOURCE_DIR}/libsrc/api/JsonCB.cpp + ${CMAKE_SOURCE_DIR}/libsrc/api/JSONRPC_schemas.qrc ) -if(ENABLE_DX) - include_directories(${DIRECTX9_INCLUDE_DIRS}) - target_link_libraries(hyperion-api ${DIRECTX9_LIBRARIES}) -endif(ENABLE_DX) - target_link_libraries(hyperion-api hyperion hyperion-utils - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Network + ${DIRECTX9_LIBRARIES} +) + +target_include_directories(hyperion-api PRIVATE + ${DIRECTX9_INCLUDE_DIRS} ) diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index 75863ca22..abc62a6fe 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -19,54 +19,54 @@ #include // Required to determine the cmake options #include -#include +#include #include #if defined(ENABLE_MF) - #include + #include #elif defined(ENABLE_V4L2) - #include + #include #endif #if defined(ENABLE_AUDIO) - #include + #include #ifdef WIN32 - #include + #include #endif #ifdef __linux__ - #include + #include #endif #endif #if defined(ENABLE_X11) - #include + #include #endif #if defined(ENABLE_XCB) - #include + #include #endif #if defined(ENABLE_DX) - #include + #include #endif #if defined(ENABLE_FB) - #include + #include #endif #if defined(ENABLE_DISPMANX) - #include + #include #endif #if defined(ENABLE_AMLOGIC) - #include + #include #endif #if defined(ENABLE_OSX) - #include + #include #endif #include diff --git a/libsrc/blackborder/CMakeLists.txt b/libsrc/blackborder/CMakeLists.txt index e93c5e472..d49454d82 100644 --- a/libsrc/blackborder/CMakeLists.txt +++ b/libsrc/blackborder/CMakeLists.txt @@ -1,11 +1,9 @@ - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/blackborder) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/blackborder) - -FILE ( GLOB Blackborder_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(blackborder ${Blackborder_SOURCES} ) +add_library(blackborder + ${CMAKE_SOURCE_DIR}/include/blackborder/BlackBorderDetector.h + ${CMAKE_SOURCE_DIR}/include/blackborder/BlackBorderProcessor.h + ${CMAKE_SOURCE_DIR}/libsrc/blackborder/BlackBorderDetector.cpp + ${CMAKE_SOURCE_DIR}/libsrc/blackborder/BlackBorderProcessor.cpp +) target_link_libraries(blackborder hyperion-utils diff --git a/libsrc/boblightserver/CMakeLists.txt b/libsrc/boblightserver/CMakeLists.txt index 1587d4df3..44ff51624 100644 --- a/libsrc/boblightserver/CMakeLists.txt +++ b/libsrc/boblightserver/CMakeLists.txt @@ -1,14 +1,11 @@ - -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/boblightserver) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/boblightserver) - -FILE ( GLOB BoblightServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(boblightserver ${BoblightServer_SOURCES} ) +add_library(boblightserver + ${CMAKE_SOURCE_DIR}/include/boblightserver/BoblightServer.h + ${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightServer.cpp + ${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightClientConnection.h + ${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightClientConnection.cpp +) target_link_libraries(boblightserver hyperion hyperion-utils - ${QT_LIBRARIES} ) diff --git a/libsrc/cec/CMakeLists.txt b/libsrc/cec/CMakeLists.txt index dfd80e7d2..711c33d1d 100644 --- a/libsrc/cec/CMakeLists.txt +++ b/libsrc/cec/CMakeLists.txt @@ -1,19 +1,18 @@ -# Define the current source locations find_package(CEC REQUIRED) +if(CEC_FOUND) + list(GET CEC_LIBRARIES 0 CEC_LIBRARIES) + add_definitions(-DCEC_LIBRARY="${CEC_LIBRARIES}") +else() + message(FATAL_ERROR "libCEC not found") +endif() -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/cec) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/cec) - -FILE (GLOB CEC_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp") - -add_library(cechandler ${CEC_SOURCES}) -list(GET CEC_LIBRARIES 0 CEC_LIBRARIES) -add_definitions(-DCEC_LIBRARY="${CEC_LIBRARIES}") - -include_directories(${CEC_INCLUDE_DIRS}) +add_library(cechandler + ${CMAKE_SOURCE_DIR}/include/cec/CECEvent.h + ${CMAKE_SOURCE_DIR}/include/cec/CECHandler.h + ${CMAKE_SOURCE_DIR}/libsrc/cec/CECHandler.cpp +) target_link_libraries(cechandler Qt${QT_VERSION_MAJOR}::Core ${CMAKE_DL_LIBS} ) - diff --git a/libsrc/commandline/CMakeLists.txt b/libsrc/commandline/CMakeLists.txt index 63a403acf..cd7649138 100644 --- a/libsrc/commandline/CMakeLists.txt +++ b/libsrc/commandline/CMakeLists.txt @@ -1,10 +1,27 @@ -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/commandline) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/commandline) - -FILE ( GLOB Parser_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(commandline ${Parser_SOURCES} ) +add_library(commandline + ${CMAKE_SOURCE_DIR}/include/commandline/BooleanOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/ColorOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/ColorsOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/DoubleOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/ImageOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/IntOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/Option.h + ${CMAKE_SOURCE_DIR}/include/commandline/Parser.h + ${CMAKE_SOURCE_DIR}/include/commandline/RegularExpressionOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/SwitchOption.h + ${CMAKE_SOURCE_DIR}/include/commandline/ValidatorOption.h + ${CMAKE_SOURCE_DIR}/libsrc/commandline/BooleanOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/ColorOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/ColorsOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/DoubleOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/ImageOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/IntOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/Option.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/Parser.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/RegularExpressionOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/SwitchOption.cpp + ${CMAKE_SOURCE_DIR}/libsrc/commandline/ValidatorOption.cpp +) target_link_libraries(commandline hyperion diff --git a/libsrc/db/CMakeLists.txt b/libsrc/db/CMakeLists.txt index b81991e6d..1beb3fe5d 100644 --- a/libsrc/db/CMakeLists.txt +++ b/libsrc/db/CMakeLists.txt @@ -1,16 +1,14 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/db) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/db) - -FILE ( GLOB DB_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - add_library(database - ${DB_SOURCES} + ${CMAKE_SOURCE_DIR}/include/db/AuthTable.h + ${CMAKE_SOURCE_DIR}/include/db/DBManager.h + ${CMAKE_SOURCE_DIR}/include/db/InstanceTable.h + ${CMAKE_SOURCE_DIR}/include/db/MetaTable.h + ${CMAKE_SOURCE_DIR}/include/db/SettingsTable.h + ${CMAKE_SOURCE_DIR}/libsrc/db/DBManager.cpp ) target_link_libraries(database hyperion hyperion-utils - Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql ) diff --git a/libsrc/effectengine/CMakeLists.txt b/libsrc/effectengine/CMakeLists.txt index 0059648e4..27ba48c01 100644 --- a/libsrc/effectengine/CMakeLists.txt +++ b/libsrc/effectengine/CMakeLists.txt @@ -1,47 +1,30 @@ -if (NOT CMAKE_VERSION VERSION_LESS "3.12") - find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -else() - find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake -endif() +file(GLOB effectFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/effects/*) +set(HYPERION_EFFECTS_RES "") +foreach(f ${effectFiles}) + get_filename_component(fname ${f} NAME) + set(HYPERION_EFFECTS_RES "${HYPERION_EFFECTS_RES}\n\t\t${f}") +endforeach() -# Include the python directory. Also include the parent (which is for example /usr/include) -# which may be required when it is not includes by the (cross-) compiler by default. -if (NOT CMAKE_VERSION VERSION_LESS "3.12") - include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..) -else() - include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..) -endif() - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/effectengine) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/effectengine) - -FILE ( GLOB EffectEngineSOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) -FILE ( GLOB effectFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/effects/* ) - -SET ( HYPERION_EFFECTS_RES "") -FOREACH( f ${effectFiles} ) - GET_FILENAME_COMPONENT(fname ${f} NAME) - SET(HYPERION_EFFECTS_RES "${HYPERION_EFFECTS_RES}\n\t\t${f}") -ENDFOREACH() -CONFIGURE_FILE(${CURRENT_SOURCE_DIR}/EffectEngine.qrc.in ${CMAKE_BINARY_DIR}/EffectEngine.qrc ) - -SET(EffectEngine_RESOURCES ${CMAKE_BINARY_DIR}/EffectEngine.qrc) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/EffectEngine.qrc.in ${CMAKE_BINARY_DIR}/EffectEngine.qrc) add_library(effectengine - ${EffectEngine_RESOURCES} - ${EffectEngineSOURCES} + ${CMAKE_BINARY_DIR}/EffectEngine.qrc + ${CMAKE_SOURCE_DIR}/include/effectengine/ActiveEffectDefinition.h + ${CMAKE_SOURCE_DIR}/include/effectengine/Effect.h + ${CMAKE_SOURCE_DIR}/include/effectengine/EffectDefinition.h + ${CMAKE_SOURCE_DIR}/include/effectengine/EffectEngine.h + ${CMAKE_SOURCE_DIR}/include/effectengine/EffectFileHandler.h + ${CMAKE_SOURCE_DIR}/include/effectengine/EffectModule.h + ${CMAKE_SOURCE_DIR}/include/effectengine/EffectSchema.h + ${CMAKE_SOURCE_DIR}/libsrc/effectengine/Effect.cpp + ${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectEngine.cpp + ${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectFileHandler.cpp + ${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectModule.cpp ) target_link_libraries(effectengine - hyperion python + hyperion Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui ) - -if (NOT CMAKE_VERSION VERSION_LESS "3.12") - target_link_libraries( effectengine ${Python3_LIBRARIES} ) -else() - target_link_libraries( effectengine ${PYTHON_LIBRARIES} ) -endif() diff --git a/libsrc/effectengine/EffectEngine.qrc.in b/libsrc/effectengine/EffectEngine.qrc.in index 2816f96bc..2e43ab6d6 100644 --- a/libsrc/effectengine/EffectEngine.qrc.in +++ b/libsrc/effectengine/EffectEngine.qrc.in @@ -1,6 +1,6 @@ - ${CURRENT_SOURCE_DIR}/EffectDefinition.schema.json + ${CMAKE_CURRENT_SOURCE_DIR}/EffectDefinition.schema.json ${HYPERION_EFFECTS_RES} diff --git a/libsrc/flatbufserver/CMakeLists.txt b/libsrc/flatbufserver/CMakeLists.txt index 836652f8b..5e8795174 100644 --- a/libsrc/flatbufserver/CMakeLists.txt +++ b/libsrc/flatbufserver/CMakeLists.txt @@ -1,69 +1,54 @@ +# set (compiled) Flatbuffer schema names +set(FBS_Request "hyperion_request") +set(FBS_Reply "hyperion_reply") -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/flatbufserver) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Flatbuffer_GENERATED_FBS - hyperion_reply_generated.h - hyperion_request_generated.h -) - -set(Flatbuffer_FBS - ${CURRENT_SOURCE_DIR}/hyperion_reply.fbs - ${CURRENT_SOURCE_DIR}/hyperion_request.fbs -) -FOREACH(FBS_FILE ${Flatbuffer_FBS}) - compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) -ENDFOREACH(FBS_FILE) +# define and compile flatbuffer schemas +list(APPEND Compiled_FBS ${FBS_Request}_generated.h) +list(APPEND Compiled_FBS ${FBS_Reply}_generated.h) +compile_flattbuffer_schema(${CMAKE_CURRENT_SOURCE_DIR}/${FBS_Request}.fbs ${CMAKE_CURRENT_SOURCE_DIR}) +compile_flattbuffer_schema(${CMAKE_CURRENT_SOURCE_DIR}/${FBS_Reply}.fbs ${CMAKE_CURRENT_SOURCE_DIR}) # let cmake know about new generated source files -set_source_files_properties( - ${Flatbuffer_GENERATED_FBS} PROPERTIES GENERATED TRUE -) - -### Split flatbufconnect from flatbufserver as flatbufserver relates to HyperionDaemon +set_source_files_properties(${Compiled_FBS} PROPERTIES GENERATED TRUE) +# split flatbufconnect from flatbufserver as flatbufserver relates to HyperionDaemon if(ENABLE_FLATBUF_CONNECT) -add_library(flatbufconnect - ${CURRENT_HEADER_DIR}/FlatBufferConnection.h - ${CURRENT_SOURCE_DIR}/FlatBufferConnection.cpp - ${FLATBUFSERVER_SOURCES} - ${Flatbuffer_GENERATED_FBS} - -) -target_link_libraries(flatbufconnect - hyperion-utils - flatbuffers - Qt${QT_VERSION_MAJOR}::Network - Qt${QT_VERSION_MAJOR}::Core -) + add_library(flatbufconnect + ${CMAKE_SOURCE_DIR}/include/flatbufserver/FlatBufferConnection.h + ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferConnection.cpp + ${Compiled_FBS} + ) + + target_link_libraries(flatbufconnect + hyperion-utils + flatbuffers + ) + + target_include_directories(flatbufconnect PUBLIC + ${FLATBUFFERS_INCLUDE_DIRS} + ) endif() if(ENABLE_FLATBUF_SERVER) -add_library(flatbufserver - ${CURRENT_HEADER_DIR}/FlatBufferServer.h - ${CURRENT_SOURCE_DIR}/FlatBufferServer.cpp - ${CURRENT_SOURCE_DIR}/FlatBufferClient.h - ${CURRENT_SOURCE_DIR}/FlatBufferClient.cpp - ${FLATBUFSERVER_SOURCES} - ${Flatbuffer_GENERATED_FBS} -) - -target_link_libraries(flatbufserver -hyperion-utils -flatbuffers -Qt${QT_VERSION_MAJOR}::Network -Qt${QT_VERSION_MAJOR}::Core -) - -if(ENABLE_MDNS) - target_link_libraries(flatbufserver mdns) -endif() - + add_library(flatbufserver + ${CMAKE_SOURCE_DIR}/include/flatbufserver/FlatBufferServer.h + ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferServer.cpp + ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferClient.h + ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferClient.cpp + ${Compiled_FBS} + ) + + target_link_libraries(flatbufserver + hyperion-utils + flatbuffers + ) + + target_include_directories(flatbufserver PUBLIC + ${FLATBUFFERS_INCLUDE_DIRS} + ) + + if(ENABLE_MDNS) + target_link_libraries(flatbufserver mdns) + endif() endif() diff --git a/libsrc/forwarder/CMakeLists.txt b/libsrc/forwarder/CMakeLists.txt index 60dc5a6b8..a9ee88c14 100644 --- a/libsrc/forwarder/CMakeLists.txt +++ b/libsrc/forwarder/CMakeLists.txt @@ -1,22 +1,11 @@ - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/forwarder) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/forwarder) - -if(ENABLE_FLATBUF_CONNECT) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver +add_library(forwarder + ${CMAKE_SOURCE_DIR}/include/forwarder/MessageForwarder.h + ${CMAKE_SOURCE_DIR}/libsrc/forwarder/MessageForwarder.cpp ) -endif() - -FILE ( GLOB Forwarder_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(forwarder ${Forwarder_SOURCES} ) target_link_libraries(forwarder hyperion hyperion-utils - ${QT_LIBRARIES} ) if(ENABLE_FLATBUF_CONNECT) diff --git a/libsrc/grabber/CMakeLists.txt b/libsrc/grabber/CMakeLists.txt index c729ad0ad..75f8c5291 100644 --- a/libsrc/grabber/CMakeLists.txt +++ b/libsrc/grabber/CMakeLists.txt @@ -1,39 +1,39 @@ -if (ENABLE_AMLOGIC) +if(ENABLE_AMLOGIC) add_subdirectory(amlogic) endif (ENABLE_AMLOGIC) -if (ENABLE_DISPMANX) +if(ENABLE_DISPMANX) add_subdirectory(dispmanx) endif (ENABLE_DISPMANX) -if (ENABLE_FB) +if(ENABLE_FB) add_subdirectory(framebuffer) endif (ENABLE_FB) -if (ENABLE_OSX) +if(ENABLE_OSX) add_subdirectory(osx) endif(ENABLE_OSX) -if (ENABLE_V4L2 OR ENABLE_MF) +if(ENABLE_V4L2 OR ENABLE_MF) add_subdirectory(video) -endif () +endif() -if (ENABLE_X11) +if(ENABLE_X11) add_subdirectory(x11) endif(ENABLE_X11) -if (ENABLE_XCB) +if(ENABLE_XCB) add_subdirectory(xcb) endif(ENABLE_XCB) -if (ENABLE_QT) +if(ENABLE_QT) add_subdirectory(qt) endif(ENABLE_QT) -if (ENABLE_DX) +if(ENABLE_DX) add_subdirectory(directx) endif(ENABLE_DX) -if (ENABLE_AUDIO) +if(ENABLE_AUDIO) add_subdirectory(audio) endif() diff --git a/libsrc/grabber/amlogic/AmlogicGrabber.cpp b/libsrc/grabber/amlogic/AmlogicGrabber.cpp index 4c590d0c3..0f6b05875 100644 --- a/libsrc/grabber/amlogic/AmlogicGrabber.cpp +++ b/libsrc/grabber/amlogic/AmlogicGrabber.cpp @@ -20,7 +20,7 @@ // Local includes #include -#include +#include #include "Amvideocap.h" // Constants diff --git a/libsrc/grabber/amlogic/AmlogicWrapper.cpp b/libsrc/grabber/amlogic/AmlogicWrapper.cpp index 25581b2c3..ac371ba04 100644 --- a/libsrc/grabber/amlogic/AmlogicWrapper.cpp +++ b/libsrc/grabber/amlogic/AmlogicWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include AmlogicWrapper::AmlogicWrapper(int pixelDecimation, int updateRate_Hz) : GrabberWrapper("Amlogic", &_grabber, updateRate_Hz) diff --git a/libsrc/grabber/amlogic/CMakeLists.txt b/libsrc/grabber/amlogic/CMakeLists.txt index 284f8b5f1..d59066d0d 100644 --- a/libsrc/grabber/amlogic/CMakeLists.txt +++ b/libsrc/grabber/amlogic/CMakeLists.txt @@ -1,13 +1,15 @@ -INCLUDE (CheckIncludeFiles) - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic) - -FILE ( GLOB AmlogicSOURCES "${CURRENT_HEADER_DIR}/Amlogic*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(amlogic-grabber ${AmlogicSOURCES} ) +add_library(amlogic-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/amlogic/AmlogicGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/amlogic/AmlogicWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/AmlogicGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/AmlogicWrapper.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/Amvideocap.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/ion.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/meson_ion.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/IonBuffer.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/IonBuffer.cpp +) target_link_libraries(amlogic-grabber hyperion - ${QT_LIBRARIES}) +) diff --git a/libsrc/grabber/audio/AudioGrabber.cpp b/libsrc/grabber/audio/AudioGrabber.cpp index 4f4eccbd8..995a1b7ca 100644 --- a/libsrc/grabber/audio/AudioGrabber.cpp +++ b/libsrc/grabber/audio/AudioGrabber.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/libsrc/grabber/audio/AudioGrabberLinux.cpp b/libsrc/grabber/audio/AudioGrabberLinux.cpp index 8938e043a..944b317db 100644 --- a/libsrc/grabber/audio/AudioGrabberLinux.cpp +++ b/libsrc/grabber/audio/AudioGrabberLinux.cpp @@ -1,11 +1,31 @@ -#include +#include #include #include #include -typedef void* (*THREADFUNCPTR)(void*); +static void * AudioThreadRunner(void* params) +{ + AudioGrabberLinux* This = static_cast(params); + + Debug(This->getLog(), "Audio Thread Started"); + + snd_pcm_sframes_t framesAvailable = 0; + + while (This->_isRunning.load(std::memory_order_acquire)) + { + snd_pcm_wait(This->_captureDevice, 1000); + + if ((framesAvailable = snd_pcm_avail(This->_captureDevice)) > 0) + This->processAudioBuffer(framesAvailable); + + sched_yield(); + } + + Debug(This->getLog(), "Audio Thread Shutting Down"); + return nullptr; +} AudioGrabberLinux::AudioGrabberLinux() : AudioGrabber() @@ -121,7 +141,7 @@ bool AudioGrabberLinux::configureCaptureInterface() snd_pcm_close(_captureDevice); return false; } - + if ((error = snd_pcm_hw_params_set_access(_captureDevice, _captureDeviceConfig, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) { Error(_log, "Failed to configure interleaved mode: %s", snd_strerror(error)); @@ -129,7 +149,7 @@ bool AudioGrabberLinux::configureCaptureInterface() snd_pcm_close(_captureDevice); return false; } - + if ((error = snd_pcm_hw_params_set_format(_captureDevice, _captureDeviceConfig, SND_PCM_FORMAT_S16_LE)) < 0) { Error(_log, "Failed to configure capture format: %s", snd_strerror(error)); @@ -169,7 +189,7 @@ bool AudioGrabberLinux::configureCaptureInterface() snd_pcm_close(_captureDevice); return false; } - + return true; } @@ -189,11 +209,6 @@ bool AudioGrabberLinux::start() _isRunning.store(true, std::memory_order_release); pthread_attr_t threadAttributes; - int threadPriority = 1; - - sched_param schedulerParameter; - schedulerParameter.sched_priority = threadPriority; - if (pthread_attr_init(&threadAttributes) != 0) { Debug(_log, "Failed to create thread attributes"); @@ -201,7 +216,7 @@ bool AudioGrabberLinux::start() return false; } - if (pthread_create(&_audioThread, &threadAttributes, static_cast(&AudioThreadRunner), static_cast(this)) != 0) + if (pthread_create(&_audioThread, &threadAttributes, &AudioThreadRunner, static_cast(this)) != 0) { Debug(_log, "Failed to create audio capture thread"); stop(); @@ -239,7 +254,7 @@ void AudioGrabberLinux::processAudioBuffer(snd_pcm_sframes_t frames) ssize_t bytes = snd_pcm_frames_to_bytes(_captureDevice, frames); int16_t * buffer = static_cast(calloc(static_cast(bytes / 2), sizeof(int16_t))); - + if (frames == 0) { buffer[0] = 0; @@ -293,25 +308,3 @@ QString AudioGrabberLinux::getDeviceName(const QString& devicePath) const return _deviceProperties.value(devicePath).name; } - -static void * AudioThreadRunner(void* params) -{ - AudioGrabberLinux* This = static_cast(params); - - Debug(This->getLog(), "Audio Thread Started"); - - snd_pcm_sframes_t framesAvailable = 0; - - while (This->_isRunning.load(std::memory_order_acquire)) - { - snd_pcm_wait(This->_captureDevice, 1000); - - if ((framesAvailable = snd_pcm_avail(This->_captureDevice)) > 0) - This->processAudioBuffer(framesAvailable); - - sched_yield(); - } - - Debug(This->getLog(), "Audio Thread Shutting Down"); - return nullptr; -} diff --git a/libsrc/grabber/audio/AudioGrabberWindows.cpp b/libsrc/grabber/audio/AudioGrabberWindows.cpp index 8a2228c36..d3d37597e 100644 --- a/libsrc/grabber/audio/AudioGrabberWindows.cpp +++ b/libsrc/grabber/audio/AudioGrabberWindows.cpp @@ -1,4 +1,4 @@ -#include +#include #include @@ -71,7 +71,7 @@ bool AudioGrabberWindows::configureCaptureInterface() notificationSize -= notificationSize % audioFormat.nBlockAlign; bufferCaptureSize = notificationSize * AUDIO_NOTIFICATION_COUNT; - + DSCBUFFERDESC bufferDesc; bufferDesc.dwSize = sizeof(DSCBUFFERDESC); bufferDesc.dwFlags = 0; @@ -80,7 +80,7 @@ bool AudioGrabberWindows::configureCaptureInterface() bufferDesc.lpwfxFormat = &audioFormat; bufferDesc.dwFXCount = 0; bufferDesc.lpDSCFXDesc = NULL; - + // Create Capture Device's Buffer LPDIRECTSOUNDCAPTUREBUFFER preBuffer; if (FAILED(recordingDevice->CreateCaptureBuffer(&bufferDesc, &preBuffer, NULL))) @@ -101,7 +101,7 @@ bool AudioGrabberWindows::configureCaptureInterface() } preBuffer->Release(); - + // Create Notifications LPDIRECTSOUNDNOTIFY8 notify; @@ -112,7 +112,7 @@ bool AudioGrabberWindows::configureCaptureInterface() recordingBuffer->Release(); return false; } - + // Create Events notificationEvent = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -133,11 +133,11 @@ bool AudioGrabberWindows::configureCaptureInterface() positionNotify[i].dwOffset = (notificationSize * i) + notificationSize - 1; positionNotify[i].hEventNotify = notificationEvent; } - + // Set Notifications notify->SetNotificationPositions(AUDIO_NOTIFICATION_COUNT, positionNotify); notify->Release(); - + return true; } @@ -162,12 +162,12 @@ bool AudioGrabberWindows::start() } Info(_log, "Capture audio from %s", QSTRING_CSTR(getDeviceName(_device))); - + if (!this->configureCaptureInterface()) { return false; } - + if (FAILED(recordingBuffer->Start(DSCBSTART_LOOPING))) { Error(_log, "Failed starting audio capture from '%s'", QSTRING_CSTR(getDeviceName(_device))); @@ -214,7 +214,7 @@ void AudioGrabberWindows::stop() { Error(_log, "Audio capture failed to stop: '%s'", QSTRING_CSTR(getDeviceName(_device))); } - + if (FAILED(recordingBuffer->Release())) { Error(_log, "Failed to release recording buffer: '%s'", QSTRING_CSTR(getDeviceName(_device))); @@ -306,7 +306,7 @@ void AudioGrabberWindows::processAudioBuffer() // Buffer wrapped around, read second position if (capturedAudio2 != NULL) - { + { bufferCapturePosition += capturedAudio2Length; bufferCapturePosition %= bufferCaptureSize; // Circular Buffer } @@ -318,13 +318,13 @@ void AudioGrabberWindows::processAudioBuffer() { CopyMemory(readBuffer + capturedAudioLength, capturedAudio2, capturedAudio2Length); } - + // Release Buffer Lock recordingBuffer->Unlock(capturedAudio, capturedAudioLength, capturedAudio2, capturedAudio2Length); - + // Process Audio Frame this->processAudioFrame(readBuffer, frameSize); - + delete[] readBuffer; } diff --git a/libsrc/grabber/audio/AudioWrapper.cpp b/libsrc/grabber/audio/AudioWrapper.cpp index 0dd624de0..2c47a3b80 100644 --- a/libsrc/grabber/audio/AudioWrapper.cpp +++ b/libsrc/grabber/audio/AudioWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/libsrc/grabber/audio/CMakeLists.txt b/libsrc/grabber/audio/CMakeLists.txt index 714c58832..f60ee7758 100644 --- a/libsrc/grabber/audio/CMakeLists.txt +++ b/libsrc/grabber/audio/CMakeLists.txt @@ -1,35 +1,38 @@ -# Define the current source locations -SET( CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber ) -SET( CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio ) - -if (WIN32) - add_definitions(-DUNICODE -D_UNICODE) - FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Windows.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Windows.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp") -elseif(${CMAKE_SYSTEM} MATCHES "Linux") - FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Linux.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Linux.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp") -elseif (APPLE) - #TODO - #FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Apple.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Apple.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp") +if(WIN32) + add_definitions(-DUNICODE -D_UNICODE) + set(AUDIO_GRABBER_SOURCES + ${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberWindows.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberWindows.cpp + ) +elseif(CMAKE_HOST_UNIX AND NOT APPLE) + set(AUDIO_GRABBER_SOURCES + ${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberLinux.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberLinux.cpp + ) endif() -add_library( audio-grabber ${AUDIO_GRABBER_SOURCES} ) - -set(AUDIO_LIBS hyperion) - - -if (WIN32) - set(AUDIO_LIBS ${AUDIO_LIBS} DSound) -elseif(${CMAKE_SYSTEM} MATCHES "Linux") - find_package(ALSA REQUIRED) - if (ALSA_FOUND) - include_directories(${ALSA_INCLUDE_DIRS}) - set(AUDIO_LIBS ${AUDIO_LIBS} ${ALSA_LIBRARIES}) - endif(ALSA_FOUND) - - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - set(AUDIO_LIBS ${AUDIO_LIBS} Threads::Threads) # PRIVATE +add_library(audio-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioWrapper.cpp + ${AUDIO_GRABBER_SOURCES} +) + +if(WIN32) + set(AUDIO_LIBS DSound) +elseif(CMAKE_HOST_UNIX AND NOT APPLE) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(ALSA REQUIRED) + find_package(Threads REQUIRED) + set(AUDIO_LIBS ${ALSA_LIBRARIES} Threads::Threads) endif() +target_link_libraries(audio-grabber + hyperion + ${AUDIO_LIBS} +) -target_link_libraries(audio-grabber ${AUDIO_LIBS} ${QT_LIBRARIES}) +if(CMAKE_HOST_UNIX AND NOT APPLE) + target_include_directories(audio-grabber PUBLIC ${ALSA_INCLUDE_DIRS}) +endif() diff --git a/libsrc/grabber/directx/CMakeLists.txt b/libsrc/grabber/directx/CMakeLists.txt index 16db7dd2a..3d86e8972 100644 --- a/libsrc/grabber/directx/CMakeLists.txt +++ b/libsrc/grabber/directx/CMakeLists.txt @@ -1,14 +1,17 @@ -# Define the current source locations -SET( CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber ) -SET( CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/directx ) +find_package(DirectX9 REQUIRED) -include_directories(${DIRECTX9_INCLUDE_DIRS}) - -FILE ( GLOB DIRECTX_GRAB_SOURCES "${CURRENT_HEADER_DIR}/DirectX*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library( directx-grabber ${DIRECTX_GRAB_SOURCES} ) +add_library(directx-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/directx/DirectXGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/directx/DirectXWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/directx/DirectXGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/directx/DirectXWrapper.cpp +) target_link_libraries(directx-grabber - hyperion - ${DIRECTX9_LIBRARIES} + hyperion + ${DIRECTX9_LIBRARIES} +) + +target_include_directories(directx-grabber PUBLIC + ${DIRECTX9_INCLUDE_DIRS} ) diff --git a/libsrc/grabber/directx/DirectXGrabber.cpp b/libsrc/grabber/directx/DirectXGrabber.cpp index ae9098888..24db4b4fc 100644 --- a/libsrc/grabber/directx/DirectXGrabber.cpp +++ b/libsrc/grabber/directx/DirectXGrabber.cpp @@ -1,5 +1,5 @@ #include -#include +#include #pragma comment(lib, "d3d9.lib") #pragma comment(lib,"d3dx9.lib") diff --git a/libsrc/grabber/directx/DirectXWrapper.cpp b/libsrc/grabber/directx/DirectXWrapper.cpp index 3c4188e55..cddf19cef 100644 --- a/libsrc/grabber/directx/DirectXWrapper.cpp +++ b/libsrc/grabber/directx/DirectXWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include DirectXWrapper::DirectXWrapper( int updateRate_Hz, int display, diff --git a/libsrc/grabber/dispmanx/CMakeLists.txt b/libsrc/grabber/dispmanx/CMakeLists.txt index 51292da1d..93082b9c3 100644 --- a/libsrc/grabber/dispmanx/CMakeLists.txt +++ b/libsrc/grabber/dispmanx/CMakeLists.txt @@ -1,5 +1,5 @@ # Find the BCM-package (VC control) -if( "${PLATFORM}" MATCHES rpi) +if("${PLATFORM}" MATCHES rpi) find_package(BCM) if(BCM_FOUND) add_definitions(-DBCM_FOUND) @@ -9,21 +9,20 @@ else() set(BCM_LIBRARY "") endif() -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx) - -FILE ( GLOB DispmanxGrabberSOURCES "${CURRENT_HEADER_DIR}/Dispmanx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) +add_library(dispmanx-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/dispmanx/DispmanxFrameGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/dispmanx/DispmanxWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx/DispmanxWrapper.cpp +) -add_library(dispmanx-grabber ${DispmanxGrabberSOURCES}) add_definitions(-DBCM_LIBRARY="${BCM_LIBRARY}") -target_include_directories(dispmanx-grabber PUBLIC - ${BCM_INCLUDE_DIR} -) - target_link_libraries(dispmanx-grabber hyperion - ${QT_LIBRARIES} ${CMAKE_DL_LIBS} ) + +target_include_directories(dispmanx-grabber PUBLIC + ${BCM_INCLUDE_DIR} +) diff --git a/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp b/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp index b0a46fe4e..d0486cdfa 100644 --- a/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp +++ b/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp @@ -16,7 +16,7 @@ namespace { } //End of constants // Local includes -#include "grabber/DispmanxFrameGrabber.h" +#include "grabber/dispmanx/DispmanxFrameGrabber.h" DispmanxFrameGrabber::DispmanxFrameGrabber() : Grabber("DISPMANXGRABBER") diff --git a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp index 6ffe33549..19fb1b028 100644 --- a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp +++ b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include DispmanxWrapper::DispmanxWrapper( int updateRate_Hz, int pixelDecimation diff --git a/libsrc/grabber/framebuffer/CMakeLists.txt b/libsrc/grabber/framebuffer/CMakeLists.txt index af1368ffb..bcaf4675c 100644 --- a/libsrc/grabber/framebuffer/CMakeLists.txt +++ b/libsrc/grabber/framebuffer/CMakeLists.txt @@ -1,11 +1,10 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer) - -FILE ( GLOB FramebufferGrabberSOURCES "${CURRENT_HEADER_DIR}/Framebuffer*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(framebuffer-grabber ${FramebufferGrabberSOURCES} ) +add_library(framebuffer-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/framebuffer/FramebufferFrameGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/framebuffer/FramebufferWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer/FramebufferWrapper.cpp +) target_link_libraries(framebuffer-grabber hyperion - ${QT_LIBRARIES}) +) diff --git a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp index 554f81661..c4129341f 100644 --- a/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp +++ b/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp @@ -28,7 +28,7 @@ const char DISCOVERY_FILEPATTERN[] = "fb?"; } //End of constants // Local includes -#include +#include FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device) : Grabber("FRAMEBUFFERGRABBER") diff --git a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp index 7d99f5278..9cb400462 100644 --- a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp +++ b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include FramebufferWrapper::FramebufferWrapper( int updateRate_Hz, const QString & device, diff --git a/libsrc/grabber/osx/CMakeLists.txt b/libsrc/grabber/osx/CMakeLists.txt index 3a5690c67..7d18e8d3f 100644 --- a/libsrc/grabber/osx/CMakeLists.txt +++ b/libsrc/grabber/osx/CMakeLists.txt @@ -1,11 +1,10 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx) - -FILE ( GLOB OsxGrabberSOURCES "${CURRENT_HEADER_DIR}/Osx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(osx-grabber ${OsxGrabberSOURCES} ) +add_library(osx-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/osx/OsxFrameGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/osx/OsxWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx/OsxFrameGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx/OsxWrapper.cpp +) target_link_libraries(osx-grabber hyperion - ${QT_LIBRARIES}) +) diff --git a/libsrc/grabber/osx/OsxFrameGrabber.cpp b/libsrc/grabber/osx/OsxFrameGrabber.cpp index 54ea28f72..0e42e529d 100644 --- a/libsrc/grabber/osx/OsxFrameGrabber.cpp +++ b/libsrc/grabber/osx/OsxFrameGrabber.cpp @@ -3,7 +3,7 @@ #include // Local includes -#include +#include //Qt #include diff --git a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp b/libsrc/grabber/osx/OsxFrameGrabberMock.cpp deleted file mode 100644 index 2bcab4840..000000000 --- a/libsrc/grabber/osx/OsxFrameGrabberMock.cpp +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef __APPLE__ -#include - -unsigned __osx_frame_counter = 0; -const int __screenWidth = 800; -const int __screenHeight = 600; - -CGError CGGetActiveDisplayList(uint32_t maxDisplays, CGDirectDisplayID *activeDisplays, uint32_t *displayCount) -{ - if (maxDisplays == 0 || activeDisplays == nullptr) - { - *displayCount = 2; - } - else - { - displayCount = &maxDisplays; - if (activeDisplays != nullptr) - { - for (CGDirectDisplayID i = 0; i < maxDisplays; ++i) - { - activeDisplays[i] = i; - } - } - else - { - return kCGErrorFailure; - } - } - return kCGErrorSuccess; -} - -CGImageRef CGDisplayCreateImage(CGDirectDisplayID display) -{ - CGImageRef image = new CGImage(__screenWidth / (display+1), __screenHeight / (display+1)); - - return image; -} - -void CGImageRelease(CGImageRef image) -{ - delete image; -} - -CGImageRef CGImageGetDataProvider(CGImageRef image) -{ - __osx_frame_counter++; - if (__osx_frame_counter > 100) - { - __osx_frame_counter = 0; - } - - ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE}; - if (__osx_frame_counter < 25) - { - color[0] = ColorRgb::WHITE; - color[1] = ColorRgb::RED; - color[2] = ColorRgb::BLUE; - color[3] = ColorRgb::GREEN; - } - else if(__osx_frame_counter < 50) - { - color[1] = ColorRgb::WHITE; - color[2] = ColorRgb::RED; - color[3] = ColorRgb::BLUE; - color[0] = ColorRgb::GREEN; - } - else if(__osx_frame_counter < 75) - { - color[2] = ColorRgb::WHITE; - color[3] = ColorRgb::RED; - color[0] = ColorRgb::BLUE; - color[1] = ColorRgb::GREEN; - } - unsigned w = image->width(); - unsigned h = image->height(); - - for (unsigned y=0; y= h/2) id = 2; - if (x >= w/2 && y < h/2) id = 3; - - image->memptr()[y*w + x] = color[id]; - } - } - - return image; -} - -CFDataRef CGDataProviderCopyData(CGImageRef image) -{ - const unsigned indexMax = image->width() * image->height() * CGImageGetBitsPerPixel(image); - CFDataRef data = new CFData[indexMax]; - int lineLength = CGImageGetBytesPerRow(image); - - for (unsigned y=0; yheight(); y++) - { - for (unsigned x=0; xwidth(); x++) - { - int index = lineLength * y + x * CGImageGetBitsPerPixel(image); - - data[index ] = (*image)(x,y).blue; - data[index+1] = (*image)(x,y).green; - data[index+2] = (*image)(x,y).red; - data[index+3] = 0; - } - } - return data; -} - -unsigned char* CFDataGetBytePtr(CFDataRef imgData) -{ - return imgData; -} - -unsigned CGImageGetWidth(CGImageRef image) -{ - return image->width(); -} - -unsigned CGImageGetHeight(CGImageRef image) -{ - return image->height(); -} - -unsigned CGImageGetBytesPerRow(CGImageRef image) -{ - return image->width()*CGImageGetBitsPerPixel(image); -} - -unsigned CGImageGetBitsPerPixel(CGImageRef) -{ - return 4; -} - -void CFRelease(CFDataRef imgData) -{ - delete imgData; -} - -CGDisplayModeRef CGDisplayCopyDisplayMode(CGDirectDisplayID display) -{ - return nullptr; -} -CGRect CGDisplayBounds(CGDirectDisplayID display) -{ - CGRect rect; - rect.size.width = __screenWidth / (display+1); - rect.size.height = __screenHeight / (display+1); - return rect; -} -void CGDisplayModeRelease(CGDisplayModeRef mode) -{ -} - -#endif diff --git a/libsrc/grabber/osx/OsxWrapper.cpp b/libsrc/grabber/osx/OsxWrapper.cpp index 724be2fa4..408f7a69c 100644 --- a/libsrc/grabber/osx/OsxWrapper.cpp +++ b/libsrc/grabber/osx/OsxWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include OsxWrapper::OsxWrapper( int updateRate_Hz, int display, diff --git a/libsrc/grabber/qt/CMakeLists.txt b/libsrc/grabber/qt/CMakeLists.txt index 1b0111de9..6ece8bbc1 100644 --- a/libsrc/grabber/qt/CMakeLists.txt +++ b/libsrc/grabber/qt/CMakeLists.txt @@ -1,13 +1,10 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/qt) - - -FILE ( GLOB QT_GRAB_SOURCES "${CURRENT_HEADER_DIR}/Qt*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(qt-grabber ${QT_GRAB_SOURCES} ) +add_library(qt-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/qt/QtGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/qt/QtWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/qt/QtGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/qt/QtWrapper.cpp +) target_link_libraries(qt-grabber hyperion - ${QT_LIBRARIES} ) diff --git a/libsrc/grabber/qt/QtGrabber.cpp b/libsrc/grabber/qt/QtGrabber.cpp index cb6e0c5c0..3d2cd51c6 100644 --- a/libsrc/grabber/qt/QtGrabber.cpp +++ b/libsrc/grabber/qt/QtGrabber.cpp @@ -1,5 +1,5 @@ // proj -#include +#include // qt #include @@ -226,7 +226,7 @@ int QtGrabber::grabFrame(Image& image) QPixmap originalPixmap = grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max); #else QPixmap originalPixmap = _screen->grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max); -#endif +#endif if (originalPixmap.isNull()) { rc = -1; diff --git a/libsrc/grabber/qt/QtWrapper.cpp b/libsrc/grabber/qt/QtWrapper.cpp index 90cb489bb..689f25c55 100644 --- a/libsrc/grabber/qt/QtWrapper.cpp +++ b/libsrc/grabber/qt/QtWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include QtWrapper::QtWrapper( int updateRate_Hz, int display, diff --git a/libsrc/grabber/video/CMakeLists.txt b/libsrc/grabber/video/CMakeLists.txt index 43a0e5807..c4c2f8962 100644 --- a/libsrc/grabber/video/CMakeLists.txt +++ b/libsrc/grabber/video/CMakeLists.txt @@ -1,33 +1,38 @@ # Common cmake definition for external video grabber -# Add Turbo JPEG library -if (ENABLE_V4L2 OR ENABLE_MF) - find_package(TurboJPEG) - if (TURBOJPEG_FOUND) - add_definitions(-DHAVE_TURBO_JPEG) - message( STATUS "Using Turbo JPEG library: ${TurboJPEG_LIBRARY}") - include_directories(${TurboJPEG_INCLUDE_DIRS}) - else () - message( STATUS "Turbo JPEG library not found, MJPEG camera format won't work.") - endif () -endif() +set(MF-grabber mediafoundation) +set(V4L2-grabber v4l2) -# Define the wrapper/header/source locations and collect them -SET(WRAPPER_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video) -SET(HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -if (ENABLE_MF) +if(ENABLE_MF) project(mf-grabber) - SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/mediafoundation) - FILE (GLOB SOURCES "${WRAPPER_DIR}/*.cpp" "${HEADER_DIR}/Video*.h" "${HEADER_DIR}/MF*.h" "${HEADER_DIR}/Encoder*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp") + set(grabber_project MF) + set(MediaFoundationSourceReaderCallBack ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h) elseif(ENABLE_V4L2) project(v4l2-grabber) - SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/v4l2) - FILE (GLOB SOURCES "${WRAPPER_DIR}/*.cpp" "${HEADER_DIR}/Video*.h" "${HEADER_DIR}/V4L2*.h" "${HEADER_DIR}/Encoder*.h" "${CURRENT_SOURCE_DIR}/*.cpp") + set(grabber_project V4L2) endif() -add_library(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} hyperion ${QT_LIBRARIES}) +add_library(${PROJECT_NAME} + ${CMAKE_SOURCE_DIR}/include/grabber/video/EncoderThread.h + ${CMAKE_SOURCE_DIR}/include/grabber/video/VideoWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/EncoderThread.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/VideoWrapper.cpp + ${CMAKE_SOURCE_DIR}/include/grabber/video/${${grabber_project}-grabber}/${grabber_project}Grabber.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/${${grabber_project}-grabber}/${grabber_project}Grabber.cpp + ${MediaFoundationSourceReaderCallBack} +) -if(TURBOJPEG_FOUND) - target_link_libraries(${PROJECT_NAME} ${TurboJPEG_LIBRARY}) +target_link_libraries(${PROJECT_NAME} hyperion) + +# Add Turbo JPEG library +if(ENABLE_V4L2 OR ENABLE_MF) + find_package(TurboJPEG) + if(TURBOJPEG_FOUND) + add_definitions(-DHAVE_TURBO_JPEG) + message(STATUS "Using Turbo JPEG library: ${TurboJPEG_LIBRARY}") + target_link_libraries(${PROJECT_NAME} ${TurboJPEG_LIBRARY}) + target_include_directories(${PROJECT_NAME} PUBLIC ${TurboJPEG_INCLUDE_DIRS}) + else () + message(STATUS "Turbo JPEG library not found, MJPEG camera format won't work.") + endif() endif() diff --git a/libsrc/grabber/video/EncoderThread.cpp b/libsrc/grabber/video/EncoderThread.cpp index 1de36ff70..3555bb9fd 100644 --- a/libsrc/grabber/video/EncoderThread.cpp +++ b/libsrc/grabber/video/EncoderThread.cpp @@ -1,4 +1,4 @@ -#include "grabber/EncoderThread.h" +#include "grabber/video/EncoderThread.h" #include diff --git a/libsrc/grabber/video/VideoWrapper.cpp b/libsrc/grabber/video/VideoWrapper.cpp index 7a3ed201c..3b95f5616 100644 --- a/libsrc/grabber/video/VideoWrapper.cpp +++ b/libsrc/grabber/video/VideoWrapper.cpp @@ -1,6 +1,6 @@ #include -#include +#include // qt includes #include diff --git a/libsrc/grabber/video/mediafoundation/MFGrabber.cpp b/libsrc/grabber/video/mediafoundation/MFGrabber.cpp index 5e67e6ef5..ca2b6a35a 100644 --- a/libsrc/grabber/video/mediafoundation/MFGrabber.cpp +++ b/libsrc/grabber/video/mediafoundation/MFGrabber.cpp @@ -1,5 +1,5 @@ #include "MFSourceReaderCB.h" -#include "grabber/MFGrabber.h" +#include "grabber/video/mediafoundation/MFGrabber.h" // Constants namespace { const bool verbose = false; } @@ -537,7 +537,7 @@ void MFGrabber::process_image(const void *frameImageBuffer, int size) Error(_log, "Frame too small: %d != %d", size, _frameByteSize); else if (_threadManager != nullptr) { - for (unsigned long i = 0; i < _threadManager->_threadCount; i++) + for (int i = 0; i < _threadManager->_threadCount; i++) { if (!_threadManager->_threads[i]->isBusy()) { diff --git a/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h b/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h index 8cb10ba4e..2bcef437b 100644 --- a/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h +++ b/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h @@ -19,7 +19,7 @@ #pragma comment (lib, "strmiids.lib") #pragma comment (lib, "wmcodecdspuuid.lib") -#include +#include #define SAFE_RELEASE(x) if(x) { x->Release(); x = nullptr; } diff --git a/libsrc/grabber/video/v4l2/V4L2Grabber.cpp b/libsrc/grabber/video/v4l2/V4L2Grabber.cpp index 8f5044649..cd0d273f0 100644 --- a/libsrc/grabber/video/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/video/v4l2/V4L2Grabber.cpp @@ -23,7 +23,7 @@ #include #include -#include "grabber/V4L2Grabber.h" +#include "grabber/video/v4l2/V4L2Grabber.h" #define CLEAR(x) memset(&(x), 0, sizeof(x)) diff --git a/libsrc/grabber/x11/CMakeLists.txt b/libsrc/grabber/x11/CMakeLists.txt index 08183afff..d5cd3831b 100644 --- a/libsrc/grabber/x11/CMakeLists.txt +++ b/libsrc/grabber/x11/CMakeLists.txt @@ -1,24 +1,23 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11) - -# Find X11 find_package(X11 REQUIRED) -include_directories( ${X11_INCLUDES} ) - -if(APPLE) - include_directories("/opt/X11/include") -endif(APPLE) - -FILE ( GLOB X11_SOURCES "${CURRENT_HEADER_DIR}/X11*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(x11-grabber ${X11_SOURCES} ) +add_library(x11-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/x11/X11Grabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/x11/X11Wrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11/X11Grabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11/X11Wrapper.cpp +) target_link_libraries(x11-grabber hyperion ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xrender_LIB} - ${QT_LIBRARIES} +) + +if(APPLE) + list(APPEND X11_INCLUDES "/opt/X11/include") +endif() + +target_include_directories(x11-grabber PUBLIC + ${X11_INCLUDES} ) diff --git a/libsrc/grabber/x11/X11Grabber.cpp b/libsrc/grabber/x11/X11Grabber.cpp index 46c7faa4e..cf24eea29 100644 --- a/libsrc/grabber/x11/X11Grabber.cpp +++ b/libsrc/grabber/x11/X11Grabber.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/libsrc/grabber/x11/X11Wrapper.cpp b/libsrc/grabber/x11/X11Wrapper.cpp index a453fc194..a7e36b714 100644 --- a/libsrc/grabber/x11/X11Wrapper.cpp +++ b/libsrc/grabber/x11/X11Wrapper.cpp @@ -1,4 +1,4 @@ -#include +#include X11Wrapper::X11Wrapper( int updateRate_Hz, int pixelDecimation, diff --git a/libsrc/grabber/xcb/CMakeLists.txt b/libsrc/grabber/xcb/CMakeLists.txt index 97f1ee918..d353f2bde 100644 --- a/libsrc/grabber/xcb/CMakeLists.txt +++ b/libsrc/grabber/xcb/CMakeLists.txt @@ -1,23 +1,19 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb) - find_package(XCB COMPONENTS SHM IMAGE RENDER RANDR REQUIRED) -include_directories(${XCB_INCLUDE_DIRS}) - -FILE (GLOB XCB_SOURCES "${CURRENT_HEADER_DIR}/Xcb*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(xcb-grabber ${XCB_SOURCES}) +add_library(xcb-grabber + ${CMAKE_SOURCE_DIR}/include/grabber/xcb/XcbGrabber.h + ${CMAKE_SOURCE_DIR}/include/grabber/xcb/XcbWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbCommandExecutor.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbCommands.h + ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbGrabber.cpp + ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbWrapper.cpp +) target_link_libraries(xcb-grabber hyperion ${XCB_LIBRARIES} - ${QT_LIBRARIES} ) -if (NOT APPLE) - target_link_libraries( - xcb-grabber - ) -endif() +target_include_directories(xcb-grabber PUBLIC + ${XCB_INCLUDE_DIRS} +) diff --git a/libsrc/grabber/xcb/XcbGrabber.cpp b/libsrc/grabber/xcb/XcbGrabber.cpp index a5fc97f97..bf58770d9 100644 --- a/libsrc/grabber/xcb/XcbGrabber.cpp +++ b/libsrc/grabber/xcb/XcbGrabber.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "XcbCommands.h" #include "XcbCommandExecutor.h" diff --git a/libsrc/grabber/xcb/XcbWrapper.cpp b/libsrc/grabber/xcb/XcbWrapper.cpp index 339cb4e87..129217e16 100644 --- a/libsrc/grabber/xcb/XcbWrapper.cpp +++ b/libsrc/grabber/xcb/XcbWrapper.cpp @@ -1,4 +1,4 @@ -#include +#include XcbWrapper::XcbWrapper( int updateRate_Hz, int pixelDecimation, diff --git a/libsrc/hyperion/CMakeLists.txt b/libsrc/hyperion/CMakeLists.txt index 3a880a91b..776000861 100644 --- a/libsrc/hyperion/CMakeLists.txt +++ b/libsrc/hyperion/CMakeLists.txt @@ -1,21 +1,50 @@ - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/hyperion) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/hyperion) - -if(ENABLE_FLATBUF_SERVER) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver -) -endif() - -FILE ( GLOB Hyperion_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -SET(Hyperion_RESOURCES ${CURRENT_SOURCE_DIR}/resource.qrc) - add_library(hyperion - ${Hyperion_SOURCES} - ${Hyperion_RESOURCES} + # Authorization Manager + ${CMAKE_SOURCE_DIR}/include/hyperion/AuthManager.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/AuthManager.cpp + # Background Effect Handler + ${CMAKE_SOURCE_DIR}/include/hyperion/BGEffectHandler.h + # Capture Control class + ${CMAKE_SOURCE_DIR}/include/hyperion/CaptureCont.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/CaptureCont.cpp + # Color Adjustment + ${CMAKE_SOURCE_DIR}/include/hyperion/ColorAdjustment.h + # Component Register + ${CMAKE_SOURCE_DIR}/include/hyperion/ComponentRegister.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/ComponentRegister.cpp + # Grabber/Wrapper classes + ${CMAKE_SOURCE_DIR}/include/hyperion/Grabber.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/Grabber.cpp + ${CMAKE_SOURCE_DIR}/include/hyperion/GrabberWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/GrabberWrapper.cpp + # Hyperion + Resources + ${CMAKE_SOURCE_DIR}/include/hyperion/Hyperion.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/Hyperion.cpp + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/resource.qrc + # Instance Manager + ${CMAKE_SOURCE_DIR}/include/hyperion/HyperionIManager.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/HyperionIManager.cpp + # Image Processor + ${CMAKE_SOURCE_DIR}/include/hyperion/ImageProcessor.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/ImageProcessor.cpp + # ImageToLedsMap class + ${CMAKE_SOURCE_DIR}/include/hyperion/ImageToLedsMap.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/ImageToLedsMap.cpp + # Led String + ${CMAKE_SOURCE_DIR}/include/hyperion/LedString.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/LedString.cpp + # Linear Color Smoothing + ${CMAKE_SOURCE_DIR}/include/hyperion/LinearColorSmoothing.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/LinearColorSmoothing.cpp + # Led Color Transform + ${CMAKE_SOURCE_DIR}/include/hyperion/MultiColorAdjustment.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/MultiColorAdjustment.cpp + # Priority Muxer + ${CMAKE_SOURCE_DIR}/include/hyperion/PriorityMuxer.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/PriorityMuxer.cpp + # Settings Manager + ${CMAKE_SOURCE_DIR}/include/hyperion/SettingsManager.h + ${CMAKE_SOURCE_DIR}/libsrc/hyperion/SettingsManager.cpp ) target_link_libraries(hyperion @@ -23,7 +52,6 @@ target_link_libraries(hyperion hyperion-utils leddevice database - ${QT_LIBRARIES} ) if(ENABLE_BOBLIGHT_SERVER) diff --git a/libsrc/jsonserver/CMakeLists.txt b/libsrc/jsonserver/CMakeLists.txt index 30ca13730..b8b3c5b7f 100644 --- a/libsrc/jsonserver/CMakeLists.txt +++ b/libsrc/jsonserver/CMakeLists.txt @@ -1,20 +1,15 @@ - -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/jsonserver) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/jsonserver) - -FILE ( GLOB JsonServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(jsonserver ${JsonServer_SOURCES} ) +add_library(jsonserver + ${CMAKE_SOURCE_DIR}/include/jsonserver/JsonServer.h + ${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonServer.cpp + ${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonClientConnection.h + ${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonClientConnection.cpp +) target_link_libraries(jsonserver hyperion-api hyperion - Qt${QT_VERSION_MAJOR}::Network - Qt${QT_VERSION_MAJOR}::Gui ) if(ENABLE_MDNS) target_link_libraries(jsonserver mdns) endif() - diff --git a/libsrc/leddevice/CMakeLists.txt b/libsrc/leddevice/CMakeLists.txt index 233bb9fd2..259ebf146 100644 --- a/libsrc/leddevice/CMakeLists.txt +++ b/libsrc/leddevice/CMakeLists.txt @@ -1,13 +1,13 @@ # Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice) +set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice) +set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice) -if ( ENABLE_DEV_NETWORK ) +if(ENABLE_DEV_NETWORK) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED) endif() -if ( ENABLE_DEV_SERIAL ) +if(ENABLE_DEV_SERIAL) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS SerialPort REQUIRED) endif() @@ -21,7 +21,7 @@ include_directories( dev_tinker ) -FILE ( GLOB Leddevice_SOURCES +file (GLOB Leddevice_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" @@ -29,49 +29,48 @@ FILE ( GLOB Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/*.cpp" ) -if ( ENABLE_OSX OR WIN32 ) +if(ENABLE_OSX OR WIN32) list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.h") list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.cpp") endif() -if ( ENABLE_DEV_NETWORK ) - FILE ( GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp") +if(ENABLE_DEV_NETWORK) + file (GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp") endif() -if ( ENABLE_DEV_SERIAL ) - FILE ( GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp") +if(ENABLE_DEV_SERIAL) + file (GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp") endif() -if ( ENABLE_DEV_SPI ) - FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp") +if(ENABLE_DEV_SPI) + file (GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp") endif() -if ( ENABLE_DEV_TINKERFORGE ) - FILE ( GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp") +if(ENABLE_DEV_TINKERFORGE) + file (GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp") endif() -if ( ENABLE_DEV_USB_HID ) +if(ENABLE_DEV_USB_HID) find_package(libusb-1.0 REQUIRED) include_directories( ${CMAKE_SOURCE_DIR}/include/hidapi ${LIBUSB_1_INCLUDE_DIRS} ) - FILE ( GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp") + file (GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp") endif() -if ( ENABLE_DEV_WS281XPWM ) - include_directories(../../dependencies/external/rpi_ws281x) - FILE ( GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp") +if(ENABLE_DEV_WS281XPWM) + file (GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp") endif() -set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc ) +set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc) -SET( Leddevice_SOURCES +set(Leddevice_SOURCES ${Leddevice_SOURCES} ${LedDevice_RESOURCES} ${Leddevice_NETWORK_SOURCES} ${Leddevice_PWM_SOURCES} - ${Leddevice_SERIAL_SOURCES} + ${Leddevice_SERIAL_SOURCES} ${Leddevice_SPI_SOURCES} ${Leddevice_TINKER_SOURCES} ${Leddevice_USB_HID_SOURCES} @@ -79,20 +78,20 @@ SET( Leddevice_SOURCES # auto generate header file that include all available leddevice headers # auto generate cpp file for register() calls -FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n" ) -FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n" ) -FOREACH( f ${Leddevice_SOURCES} ) - # MESSAGE (STATUS "Add led device: ${f}") - if ( "${f}" MATCHES "dev_.*/Led.evice.+h$" ) +file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n") +file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n") +foreach(f ${Leddevice_SOURCES}) + # message (STATUS "Add led device: ${f}") + if("${f}" MATCHES "dev_.*/Led.evice.+h$") GET_FILENAME_COMPONENT(fname ${f} NAME) - FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n" ) - STRING( SUBSTRING ${fname} 9 -1 dname) - STRING( REPLACE ".h" "" dname "${dname}" ) - FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n" ) + file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n") + string(SUBSTRING ${fname} 9 -1 dname) + string(REPLACE ".h" "" dname "${dname}") + file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n") endif() -ENDFOREACH() +endforeach() -add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES} ) +add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES}) target_link_libraries(leddevice hyperion @@ -106,19 +105,19 @@ endif() if(ENABLE_DEV_NETWORK) target_link_libraries(leddevice Qt${QT_VERSION_MAJOR}::Network ssdp) - - if (NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS) - if (MBEDTLS_LIBRARIES) + + if(NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS) + if(MBEDTLS_LIBRARIES) include_directories(${MBEDTLS_INCLUDE_DIR}) target_link_libraries(leddevice ${MBEDTLS_LIBRARIES}) target_include_directories(leddevice PRIVATE ${MBEDTLS_INCLUDE_DIR}) endif (MBEDTLS_LIBRARIES) - endif () + endif() string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION}) - if (MBEDTLS_MAJOR EQUAL "3") + if(MBEDTLS_MAJOR EQUAL "3") target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3) - if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_features(leddevice PRIVATE cxx_std_20) endif() endif() @@ -133,10 +132,11 @@ if(ENABLE_DEV_TINKERFORGE) endif() if(ENABLE_DEV_WS281XPWM) + target_include_directories(leddevice PUBLIC "${CMAKE_SOURCE_DIR}/dependencies/external/rpi_ws281x") target_link_libraries(leddevice ws281x) endif() -if (ENABLE_DEV_USB_HID) +if(ENABLE_DEV_USB_HID) if(APPLE) target_link_libraries(leddevice ${LIBUSB_1_LIBRARIES} hidapi-mac) else() @@ -150,17 +150,18 @@ if (ENABLE_DEV_USB_HID) #include int main() { - struct timespec t; - return clock_gettime(CLOCK_REALTIME, &t); + struct timespec t; + return clock_gettime(CLOCK_REALTIME, &t); } " GLIBC_HAS_CLOCK_GETTIME) - IF(NOT GLIBC_HAS_CLOCK_GETTIME) + if(NOT GLIBC_HAS_CLOCK_GETTIME) target_link_libraries(leddevice rt) endif() endif() endif() if(ENABLE_MDNS) - target_link_libraries(leddevice mdns) + + target_link_libraries(leddevice mdns) endif() diff --git a/libsrc/mdns/CMakeLists.txt b/libsrc/mdns/CMakeLists.txt index 4fdd5ed55..58bd4bcfa 100644 --- a/libsrc/mdns/CMakeLists.txt +++ b/libsrc/mdns/CMakeLists.txt @@ -1,16 +1,13 @@ - -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/mdns) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/mdns) - -FILE ( GLOB MDNS_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) -add_library(mdns ${MDNS_SOURCES}) - -include_directories(${QMDNS_INCLUDE_DIR}) +add_library(mdns + ${CMAKE_SOURCE_DIR}/include/mdns/MdnsServiceRegister.h + ${CMAKE_SOURCE_DIR}/include/mdns/MdnsBrowser.h + ${CMAKE_SOURCE_DIR}/include/mdns/MdnsProvider.h + ${CMAKE_SOURCE_DIR}/libsrc/mdns/MdnsBrowser.cpp + ${CMAKE_SOURCE_DIR}/libsrc/mdns/MdnsProvider.cpp +) target_link_libraries(mdns -hyperion-utils -${QMDNS_LIBRARIES} + hyperion + qmdnsengine + $<$:bcrypt.lib> ) - -target_include_directories(mdns PUBLIC ${QMDNS_INCLUDE_DIR}) diff --git a/libsrc/protoserver/CMakeLists.txt b/libsrc/protoserver/CMakeLists.txt index 5fefa7ef9..a463f53ce 100644 --- a/libsrc/protoserver/CMakeLists.txt +++ b/libsrc/protoserver/CMakeLists.txt @@ -1,37 +1,22 @@ +# set and compile proto schema +set(ProtoServer_PROTOS ${CMAKE_SOURCE_DIR}/libsrc/protoserver/message.proto) +protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS}) -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/protoserver) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/protoserver) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${PROTOBUF_INCLUDE_DIRS} -) - -set(ProtoServer_PROTOS ${CURRENT_SOURCE_DIR}/message.proto ) +# disable warnings for auto generated proto files, we can't change the files .... +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "-w -Wno-return-local-addr") +elseif(MSVC) + set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "/W0") +endif() -protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS} ) ### Split protoclient from protoserver as protoserver relates to HyperionDaemon and standalone capture binarys can't link to it - add_library(protoclient - ${CURRENT_SOURCE_DIR}/ProtoClientConnection.h - ${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp + ${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoClientConnection.h + ${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoClientConnection.cpp ${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ) -add_library(protoserver - ${CURRENT_HEADER_DIR}/ProtoServer.h - ${CURRENT_SOURCE_DIR}/ProtoServer.cpp -) - -# disable warnings for auto generated proto files, we can't change the files .... -if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "-w -Wno-return-local-addr") -elseif(MSVC) - set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "/W0") -endif() - target_link_libraries(protoclient hyperion hyperion-utils @@ -39,6 +24,16 @@ target_link_libraries(protoclient Qt${QT_VERSION_MAJOR}::Gui ) +target_include_directories(protoclient PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} + ${PROTOBUF_INCLUDE_DIRS} +) + +add_library(protoserver + ${CMAKE_SOURCE_DIR}/include/protoserver/ProtoServer.h + ${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoServer.cpp +) + target_link_libraries(protoserver hyperion hyperion-utils diff --git a/libsrc/python/CMakeLists.txt b/libsrc/python/CMakeLists.txt index 6b83eb142..d39d34af3 100644 --- a/libsrc/python/CMakeLists.txt +++ b/libsrc/python/CMakeLists.txt @@ -1,34 +1,30 @@ -# Include the python directory. Also include the parent (which is for example /usr/include) -# which may be required when it is not includes by the (cross-) compiler by default. -if (NOT CMAKE_VERSION VERSION_LESS "3.12") +add_library(python + ${CMAKE_SOURCE_DIR}/include/python/PythonInit.h + ${CMAKE_SOURCE_DIR}/include/python/PythonProgram.h + ${CMAKE_SOURCE_DIR}/include/python/PythonUtils.h + ${CMAKE_SOURCE_DIR}/libsrc/python/PythonInit.cpp + ${CMAKE_SOURCE_DIR}/libsrc/python/PythonProgram.cpp +) + +if(NOT CMAKE_VERSION VERSION_LESS "3.12") find_package(Python3 COMPONENTS Interpreter Development REQUIRED) - include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..) - add_compile_definitions(PYTHON_VERSION_MAJOR=${Python3_VERSION_MAJOR}) - add_compile_definitions(PYTHON_VERSION_MINOR=${Python3_VERSION_MINOR}) else() - find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake - include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..) - add_definitions(-DPYTHON_VERSION_MAJOR=${PYTHON_VERSION_MAJOR}) - add_definitions(-DPYTHON_VERSION_MINOR=${PYTHON_VERSION_MINOR}) + find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) endif() -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/python) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/python) - -FILE ( GLOB PYTHON_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -add_library(python - ${PYTHON_SOURCES} -) - target_link_libraries(python effectengine hyperion-utils + ${Python3_LIBRARIES} + ${PYTHON_LIBRARIES} ) -if (NOT CMAKE_VERSION VERSION_LESS "3.12") - target_link_libraries( python ${Python3_LIBRARIES} ) -else() - target_link_libraries( python ${PYTHON_LIBRARIES} ) -endif() +target_include_directories(python PUBLIC + ${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/.. + ${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/.. +) + +target_compile_definitions(python PRIVATE + PYTHON_VERSION_MAJOR=$<$:${Python3_VERSION_MAJOR}>$<$:${PYTHON_VERSION_MAJOR}> + PYTHON_VERSION_MINOR=$<$:${Python3_VERSION_MINOR}>$<$:${PYTHON_VERSION_MINOR}> +) diff --git a/libsrc/ssdp/CMakeLists.txt b/libsrc/ssdp/CMakeLists.txt index 2c007c0c9..b773b6f92 100644 --- a/libsrc/ssdp/CMakeLists.txt +++ b/libsrc/ssdp/CMakeLists.txt @@ -1,14 +1,13 @@ -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/ssdp) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/ssdp) - -FILE ( GLOB SSDP_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - add_library(ssdp - ${SSDP_SOURCES} + ${CMAKE_SOURCE_DIR}/include/ssdp/SSDPDiscover.h + ${CMAKE_SOURCE_DIR}/include/ssdp/SSDPHandler.h + ${CMAKE_SOURCE_DIR}/include/ssdp/SSDPServer.h + ${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPDescription.h + ${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPDiscover.cpp + ${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPHandler.cpp + ${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPServer.cpp ) target_link_libraries(ssdp - Qt${QT_VERSION_MAJOR}::Network webserver ) diff --git a/libsrc/utils/CMakeLists.txt b/libsrc/utils/CMakeLists.txt index e51fcb5d0..b7d28eebb 100644 --- a/libsrc/utils/CMakeLists.txt +++ b/libsrc/utils/CMakeLists.txt @@ -1,32 +1,94 @@ -# Define the current source locations - -if(ENABLE_EFFECTENGINE) - # Include the python directory. Also include the parent (which is for example /usr/include) - # which may be required when it is not includes by the (cross-) compiler by default. - if (NOT CMAKE_VERSION VERSION_LESS "3.12") - find_package(Python3 COMPONENTS Interpreter Development REQUIRED) - include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..) - add_compile_definitions(PYTHON_VERSION_MAJOR_MINOR=${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}) - else() - find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake - include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..) - add_definitions(-DPYTHON_VERSION_MAJOR_MINOR=${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) - endif() -endif() - -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils) - -FILE ( GLOB_RECURSE Utils_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) - -list(APPEND Utils_SOURCES "${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h") - -if ( NOT ENABLE_PROFILER ) - LIST ( REMOVE_ITEM Utils_SOURCES ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp ) +if(ENABLE_PROFILER) + set(PROFILER ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp) endif() add_library(hyperion-utils - ${Utils_SOURCES} + # Global defines/signal sharing + ${CMAKE_SOURCE_DIR}/include/utils/global_defines.h + ${CMAKE_SOURCE_DIR}/include/utils/GlobalSignals.h + # JSON Schema Checker + ${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonFactory.h + ${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonUtils.h + ${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonSchemaChecker.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp + # Color ARGB/BGR/RGB/RGBA/RGBW etc. structures + ${CMAKE_SOURCE_DIR}/include/utils/ColorArgb.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorArgb.cpp + ${CMAKE_SOURCE_DIR}/include/utils/ColorBgr.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorBgr.cpp + ${CMAKE_SOURCE_DIR}/include/utils/ColorRgb.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgb.cpp + ${CMAKE_SOURCE_DIR}/include/utils/ColorRgba.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgba.cpp + ${CMAKE_SOURCE_DIR}/include/utils/ColorRgbScalar.h + ${CMAKE_SOURCE_DIR}/include/utils/ColorRgbw.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgbw.cpp + # Image declaration + ${CMAKE_SOURCE_DIR}/include/utils/Image.h + ${CMAKE_SOURCE_DIR}/include/utils/ImageData.h + # Image resampler + ${CMAKE_SOURCE_DIR}/include/utils/ImageResampler.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ImageResampler.cpp + # Color transformation (saturation/luminance) of RGB colors + ${CMAKE_SOURCE_DIR}/include/utils/ColorSys.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/ColorSys.cpp + # Color transformation (saturation/value) of Okhsv colors + ${CMAKE_SOURCE_DIR}/include/utils/OkhsvTransform.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/OkhsvTransform.cpp + # Signal handler + ${CMAKE_SOURCE_DIR}/include/utils/DefaultSignalHandler.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/DefaultSignalHandler.cpp + # File utilities + ${CMAKE_SOURCE_DIR}/include/utils/FileUtils.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/FileUtils.cpp + # JSON utilities + ${CMAKE_SOURCE_DIR}/include/utils/JsonUtils.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/JsonUtils.cpp + # Logger + ${CMAKE_SOURCE_DIR}/include/utils/Logger.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/Logger.cpp + # IP adress/Port checker + ${CMAKE_SOURCE_DIR}/include/utils/NetOrigin.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/NetOrigin.cpp + ${CMAKE_SOURCE_DIR}/include/utils/NetUtils.h + # Process namespace (Hyperion restart) + ${CMAKE_SOURCE_DIR}/include/utils/Process.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/Process.cpp + # Rgb single color adjustment/correction + ${CMAKE_SOURCE_DIR}/include/utils/RgbChannelAdjustment.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/RgbChannelAdjustment.cpp + # Color conversion/transformation + ${CMAKE_SOURCE_DIR}/include/utils/RgbToRgbw.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/RgbToRgbw.cpp + ${CMAKE_SOURCE_DIR}/include/utils/RgbTransform.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/RgbTransform.cpp + # System info class + ${CMAKE_SOURCE_DIR}/include/utils/SysInfo.h + ${CMAKE_SOURCE_DIR}/libsrc/utils/SysInfo.cpp + # Grabber pixel formats enumeration + ${CMAKE_SOURCE_DIR}/include/utils/PixelFormat.h + # Grabber playing modes enumeration + ${CMAKE_SOURCE_DIR}/include/utils/VideoMode.h + # Grabber video standards enumeration + ${CMAKE_SOURCE_DIR}/include/utils/VideoStandard.h + # SettingsManager utilities + ${CMAKE_SOURCE_DIR}/include/utils/settings.h + # Qt string utilities + ${CMAKE_SOURCE_DIR}/include/utils/QStringUtils.h + # QThread sleep class + ${CMAKE_SOURCE_DIR}/include/utils/Sleep.h + # Wait event loop function + ${CMAKE_SOURCE_DIR}/include/utils/WaitTime.h + # Weak connection + ${CMAKE_SOURCE_DIR}/include/utils/WeakConnect.h + # Semver namespace + ${CMAKE_SOURCE_DIR}/include/utils/version.hpp + # Utility methods for Hyperion class + ${CMAKE_SOURCE_DIR}/include/utils/hyperion.h + # Oklab color space + ${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h + # Performance tester + ${PROFILER} ) target_link_libraries(hyperion-utils diff --git a/libsrc/utils/Process.cpp b/libsrc/utils/Process.cpp index 9fdd72642..baa2723af 100644 --- a/libsrc/utils/Process.cpp +++ b/libsrc/utils/Process.cpp @@ -1,93 +1,92 @@ #ifdef _WIN32 -#include -#include -#include -#include -#include -namespace Process { + #include + #include + #include + #include + #include -void restartHyperion(int exitCode) -{ - Logger* log = Logger::getInstance("Process"); - Info(log, "Restarting hyperion ..."); + namespace Process + { + void restartHyperion(int exitCode) + { + Logger* log = Logger::getInstance("Process"); + Info(log, "Restarting hyperion ..."); - auto arguments = QCoreApplication::arguments(); - if (!arguments.contains("--wait-hyperion")) - arguments << "--wait-hyperion"; + auto arguments = QCoreApplication::arguments(); + if (!arguments.contains("--wait-hyperion")) + arguments << "--wait-hyperion"; - QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments); + QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments); - //Exit with non-zero code to ensure service deamon restarts hyperion - QCoreApplication::exit(exitCode); -} + //Exit with non-zero code to ensure service deamon restarts hyperion + QCoreApplication::exit(exitCode); + } -QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/) -{ - return QSTRING_CSTR(QString()); -} -}; + QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/) + { + return QSTRING_CSTR(QString()); + } + }; #else -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include + #include + #include -#include + #include + #include + #include -#include -#include + #include + #include + #include + #include + #include -namespace Process { + #include + #include + #include -void restartHyperion(int exitCode) -{ - Logger* log = Logger::getInstance("Process"); - Info(log, "Restarting hyperion ..."); - - std::cout << std::endl - << " *******************************************" << std::endl - << " * hyperion will restart now *" << std::endl - << " *******************************************" << std::endl << std::endl; + namespace Process + { + void restartHyperion(int exitCode) + { + Logger* log = Logger::getInstance("Process"); + Info(log, "Restarting hyperion ..."); - auto arguments = QCoreApplication::arguments(); - if (!arguments.contains("--wait-hyperion")) - arguments << "--wait-hyperion"; + std::cout << std::endl + << " *******************************************" << std::endl + << " * hyperion will restart now *" << std::endl + << " *******************************************" << std::endl << std::endl; - QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments); + auto arguments = QCoreApplication::arguments(); + if (!arguments.contains("--wait-hyperion")) + arguments << "--wait-hyperion"; - //Exit with non-zero code to ensure service deamon restarts hyperion - QCoreApplication::exit(exitCode); -} + QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments); -QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/) -{ - char buffer[128]; - QString result; + //Exit with non-zero code to ensure service deamon restarts hyperion + QCoreApplication::exit(exitCode); + } - std::shared_ptr pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose); - if (pipe) - { - while (!feof(pipe.get())) + QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/) { - if (fgets(buffer, 128, pipe.get()) != nullptr) - result += buffer; + char buffer[128]; + QString result; + + std::shared_ptr pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose); + if (pipe) + { + while (!feof(pipe.get())) + { + if (fgets(buffer, 128, pipe.get()) != nullptr) + result += buffer; + } + } + return QSTRING_CSTR(result); } - } - return QSTRING_CSTR(result); -} - -}; + }; #endif diff --git a/libsrc/webserver/CMakeLists.txt b/libsrc/webserver/CMakeLists.txt index 3dcfde153..12e5345f2 100644 --- a/libsrc/webserver/CMakeLists.txt +++ b/libsrc/webserver/CMakeLists.txt @@ -1,29 +1,43 @@ -# Define the current source locations -set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/webserver) -set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/webserver) +file(GLOB_RECURSE webFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig/*) +file(RELATIVE_PATH webConfigPath ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig) -FILE ( GLOB WebConfig_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" ) -FILE ( GLOB_RECURSE webFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig/* ) -FILE ( RELATIVE_PATH webConfigPath ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig) +foreach(f ${webFiles}) + string(REPLACE "${webConfigPath}/" "" fname ${f}) + set(HYPERION_WEBCONFIG_RES "${HYPERION_WEBCONFIG_RES}\n\t\t${f}") +endforeach() -FOREACH( f ${webFiles} ) - STRING ( REPLACE "${webConfigPath}/" "" fname ${f}) - SET(HYPERION_WEBCONFIG_RES "${HYPERION_WEBCONFIG_RES}\n\t\t${f}") -ENDFOREACH() -CONFIGURE_FILE(${CURRENT_SOURCE_DIR}/WebConfig.qrc.in ${CMAKE_BINARY_DIR}/WebConfig.qrc ) -SET(WebConfig_RESOURCES ${CMAKE_BINARY_DIR}/WebConfig.qrc) +configure_file(${CMAKE_SOURCE_DIR}/libsrc/webserver/WebConfig.qrc.in ${CMAKE_BINARY_DIR}/WebConfig.qrc) add_library(webserver - ${WebConfig_SOURCES} - ${WebConfig_RESOURCES} + ${CMAKE_SOURCE_DIR}/include/webserver/WebServer.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebServer.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/CgiHandler.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/CgiHandler.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpClientWrapper.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpClientWrapper.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpHeader.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpHeader.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpReply.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpReply.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpRequest.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpRequest.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpServer.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpServer.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/StaticFileServing.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/StaticFileServing.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebJsonRpc.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebJsonRpc.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketClient.h + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketClient.cpp + ${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketUtils.h + ${CMAKE_BINARY_DIR}/WebConfig.qrc ) target_link_libraries(webserver hyperion hyperion-utils hyperion-api - Qt${QT_VERSION_MAJOR}::Network ) if(ENABLE_MDNS) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index affe720b4..1fba840c1 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -2,20 +2,20 @@ # All files are available with their file name by calling ":/FILENAME". Probably you need to call Q_INIT_RESOURCE("resources") once # # Define the current source locations -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/resources) +set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/resources) # catch all files -FILE ( GLOB Hyperion_RESFILES "${CURRENT_SOURCE_DIR}/icons/*" "${CURRENT_SOURCE_DIR}/ssl/*" ) +file(GLOB Hyperion_RESFILES "${CURRENT_SOURCE_DIR}/icons/*" "${CURRENT_SOURCE_DIR}/ssl/*") # fill resources.qrc with RESFILES -FOREACH( f ${Hyperion_RESFILES} ) +foreach(f ${Hyperion_RESFILES}) get_filename_component(fname ${f} NAME) - SET(HYPERION_RES "${HYPERION_RES}\n\t\t${f}") -ENDFOREACH() + set(HYPERION_RES "${HYPERION_RES}\n\t\t${f}") +endforeach() # prep file -CONFIGURE_FILE(${CURRENT_SOURCE_DIR}/resources.qrc.in ${CMAKE_BINARY_DIR}/resources.qrc ) -SET(Hyperion_RES ${CMAKE_BINARY_DIR}/resources.qrc) +configure_file(${CURRENT_SOURCE_DIR}/resources.qrc.in ${CMAKE_BINARY_DIR}/resources.qrc) +set(Hyperion_RES ${CMAKE_BINARY_DIR}/resources.qrc) add_library(resources ${Hyperion_RES} diff --git a/resources/icons/hyperion-128px.png b/resources/icons/hyperion-128px.png new file mode 100644 index 000000000..b208c95ea Binary files /dev/null and b/resources/icons/hyperion-128px.png differ diff --git a/resources/icons/hyperion-16px.png b/resources/icons/hyperion-16px.png new file mode 100644 index 000000000..f359583f8 Binary files /dev/null and b/resources/icons/hyperion-16px.png differ diff --git a/resources/icons/hyperion-192px.png b/resources/icons/hyperion-192px.png new file mode 100644 index 000000000..1aae38ac1 Binary files /dev/null and b/resources/icons/hyperion-192px.png differ diff --git a/resources/icons/hyperion-22px.png b/resources/icons/hyperion-22px.png new file mode 100644 index 000000000..cf78de64c Binary files /dev/null and b/resources/icons/hyperion-22px.png differ diff --git a/resources/icons/hyperion-24px.png b/resources/icons/hyperion-24px.png new file mode 100644 index 000000000..be90363c8 Binary files /dev/null and b/resources/icons/hyperion-24px.png differ diff --git a/resources/icons/hyperion-256px.png b/resources/icons/hyperion-256px.png new file mode 100644 index 000000000..43121db3f Binary files /dev/null and b/resources/icons/hyperion-256px.png differ diff --git a/resources/icons/hyperion-32px.png b/resources/icons/hyperion-32px.png new file mode 100644 index 000000000..24f24a9b8 Binary files /dev/null and b/resources/icons/hyperion-32px.png differ diff --git a/resources/icons/hyperion-36px.png b/resources/icons/hyperion-36px.png new file mode 100644 index 000000000..6d50eff43 Binary files /dev/null and b/resources/icons/hyperion-36px.png differ diff --git a/resources/icons/hyperion-48px.png b/resources/icons/hyperion-48px.png new file mode 100644 index 000000000..851676be2 Binary files /dev/null and b/resources/icons/hyperion-48px.png differ diff --git a/resources/icons/hyperion-512px.png b/resources/icons/hyperion-512px.png new file mode 100644 index 000000000..3ede06dc9 Binary files /dev/null and b/resources/icons/hyperion-512px.png differ diff --git a/resources/icons/hyperion-64px.png b/resources/icons/hyperion-64px.png new file mode 100644 index 000000000..fc1152813 Binary files /dev/null and b/resources/icons/hyperion-64px.png differ diff --git a/resources/icons/hyperion-72px.png b/resources/icons/hyperion-72px.png new file mode 100644 index 000000000..5cb47103e Binary files /dev/null and b/resources/icons/hyperion-72px.png differ diff --git a/resources/icons/hyperion-96px.png b/resources/icons/hyperion-96px.png new file mode 100644 index 000000000..e6af0ed98 Binary files /dev/null and b/resources/icons/hyperion-96px.png differ diff --git a/resources/icons/hyperion-icon-32px.png b/resources/icons/hyperion-icon-32px.png deleted file mode 100644 index ee60b83b4..000000000 Binary files a/resources/icons/hyperion-icon-32px.png and /dev/null differ diff --git a/resources/icons/hyperion-icon-512px.png b/resources/icons/hyperion-icon-512px.png deleted file mode 100644 index 53ea8fe8f..000000000 Binary files a/resources/icons/hyperion-icon-512px.png and /dev/null differ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 66f12b5a2..0f91cee39 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -6,7 +6,7 @@ description: | It supports many LED devices and video grabbers. license: MIT -icon: resources/icons/hyperion-icon-512px.png +icon: resources/icons/hyperion-512px.png adopt-info: hyperion-ng architectures: - build-on: amd64 @@ -59,7 +59,7 @@ parts: apps: hyperion-ng: command: usr/local/bin/hyperiond - desktop: usr/local/share/hyperion/desktop/hyperiond.desktop + desktop: /usr/share/applications/hyperion.desktop plugs: - camera - framebuffer diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8525c3f0a..eceb02607 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,11 @@ add_subdirectory(hyperiond) -# The following binaries are just compiled if requested -if (ENABLE_REMOTE_CTL) +# The following binaries are just compiled ifrequested +if(ENABLE_REMOTE_CTL) add_subdirectory(hyperion-remote) endif() -if (ENABLE_AMLOGIC AND ENABLE_FLATBUF_CONNECT) +if(ENABLE_AMLOGIC AND ENABLE_FLATBUF_CONNECT) add_subdirectory(hyperion-aml) endif() diff --git a/src/hyperion-aml/AmlogicWrapper.h b/src/hyperion-aml/AmlogicWrapper.h index e6b70d078..58ec3fdd9 100644 --- a/src/hyperion-aml/AmlogicWrapper.h +++ b/src/hyperion-aml/AmlogicWrapper.h @@ -2,7 +2,7 @@ // QT includes #include -#include +#include #include class AmlogicWrapper : public QObject diff --git a/src/hyperion-aml/CMakeLists.txt b/src/hyperion-aml/CMakeLists.txt index cdea66fa8..40b04df3f 100644 --- a/src/hyperion-aml/CMakeLists.txt +++ b/src/hyperion-aml/CMakeLists.txt @@ -1,25 +1,10 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-aml) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_AML_HEADERS +add_executable(${PROJECT_NAME} AmlogicWrapper.h -) - -set(Hyperion_AML_SOURCES - hyperion-aml.cpp AmlogicWrapper.cpp -) - -add_executable(${PROJECT_NAME} - ${Hyperion_AML_HEADERS} - ${Hyperion_AML_SOURCES} + hyperion-aml.cpp ) target_link_libraries(${PROJECT_NAME} @@ -29,27 +14,23 @@ target_link_libraries(${PROJECT_NAME} flatbuffers amlogic-grabber framebuffer-grabber - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -if (ENABLE_AMLOGIC) - target_link_libraries(${PROJECT_NAME} - pcre16 dl z - ) +if(ENABLE_AMLOGIC) + target_link_libraries(${PROJECT_NAME} pcre16 dl z) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_aml" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_aml") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_aml" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_aml" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_aml" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_aml") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_aml") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_aml") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-dispmanx/CMakeLists.txt b/src/hyperion-dispmanx/CMakeLists.txt index 07862bbda..c81d0fdbe 100644 --- a/src/hyperion-dispmanx/CMakeLists.txt +++ b/src/hyperion-dispmanx/CMakeLists.txt @@ -1,48 +1,31 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-dispmanx) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_Dispmanx_HEADERS +add_executable(${PROJECT_NAME} DispmanxWrapper.h -) - -set(Hyperion_Dispmanx_SOURCES - hyperion-dispmanx.cpp DispmanxWrapper.cpp + hyperion-dispmanx.cpp ) -add_executable( ${PROJECT_NAME} - ${Hyperion_Dispmanx_HEADERS} - ${Hyperion_Dispmanx_SOURCES} -) - -target_link_libraries( ${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} commandline hyperion-utils flatbufconnect flatbuffers dispmanx-grabber - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_dispmanx" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_dispmanx") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_dispmanx" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_dispmanx" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_dispmanx" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_dispmanx") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_dispmanx") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_dispmanx") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-dispmanx/DispmanxWrapper.h b/src/hyperion-dispmanx/DispmanxWrapper.h index e02e2c5fa..ddbb8a775 100644 --- a/src/hyperion-dispmanx/DispmanxWrapper.h +++ b/src/hyperion-dispmanx/DispmanxWrapper.h @@ -2,7 +2,7 @@ // QT includes #include -#include +#include #include class DispmanxWrapper : public QObject @@ -16,7 +16,7 @@ class DispmanxWrapper : public QObject ); const Image & getScreenshot(); - + bool open(); /// diff --git a/src/hyperion-framebuffer/CMakeLists.txt b/src/hyperion-framebuffer/CMakeLists.txt index 14ea2ce9b..a9470f5c9 100644 --- a/src/hyperion-framebuffer/CMakeLists.txt +++ b/src/hyperion-framebuffer/CMakeLists.txt @@ -1,55 +1,35 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-framebuffer) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_FB_HEADERS +add_executable(${PROJECT_NAME} FramebufferWrapper.h -) - -set(Hyperion_FB_SOURCES - hyperion-framebuffer.cpp FramebufferWrapper.cpp + hyperion-framebuffer.cpp ) -add_executable( ${PROJECT_NAME} - ${Hyperion_FB_HEADERS} - ${Hyperion_FB_SOURCES} -) - -target_link_libraries( ${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} commandline hyperion-utils flatbufconnect flatbuffers framebuffer-grabber - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -if (ENABLE_AMLOGIC) - target_link_libraries( ${PROJECT_NAME} - pcre16 dl z - ) +if(ENABLE_AMLOGIC) + target_link_libraries(${PROJECT_NAME} pcre16 dl z) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_framebuffer" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_framebuffer") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_framebuffer" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_framebuffer" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_framebuffer" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_framebuffer") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_framebuffer") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_framebuffer") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-framebuffer/FramebufferWrapper.h b/src/hyperion-framebuffer/FramebufferWrapper.h index d9bbdfb13..9f1b74f28 100644 --- a/src/hyperion-framebuffer/FramebufferWrapper.h +++ b/src/hyperion-framebuffer/FramebufferWrapper.h @@ -3,7 +3,7 @@ // QT includes #include -#include +#include #include class FramebufferWrapper : public QObject diff --git a/src/hyperion-osx/CMakeLists.txt b/src/hyperion-osx/CMakeLists.txt index efb15cd15..48a127b7c 100644 --- a/src/hyperion-osx/CMakeLists.txt +++ b/src/hyperion-osx/CMakeLists.txt @@ -1,43 +1,25 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-osx) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_OSX_HEADERS +add_executable(${PROJECT_NAME} OsxWrapper.h -) - -set(Hyperion_OSX_SOURCES - hyperion-osx.cpp OsxWrapper.cpp + hyperion-osx.cpp ) -add_executable( ${PROJECT_NAME} - ${Hyperion_OSX_HEADERS} - ${Hyperion_OSX_SOURCES} -) - -target_link_libraries( ${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} commandline hyperion-utils flatbufconnect flatbuffers osx-grabber - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_osx" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_osx") diff --git a/src/hyperion-osx/OsxWrapper.h b/src/hyperion-osx/OsxWrapper.h index ef352bd0a..335e6519d 100644 --- a/src/hyperion-osx/OsxWrapper.h +++ b/src/hyperion-osx/OsxWrapper.h @@ -2,7 +2,7 @@ // QT includes #include -#include +#include #include class OsxWrapper : public QObject diff --git a/src/hyperion-qt/CMakeLists.txt b/src/hyperion-qt/CMakeLists.txt index f35b8534b..fe87ef8b2 100644 --- a/src/hyperion-qt/CMakeLists.txt +++ b/src/hyperion-qt/CMakeLists.txt @@ -1,32 +1,18 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-qt) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) +if(WIN32) + # generate windows .rc file for this binary + string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico) + configure_file(${CMAKE_SOURCE_DIR}/cmake/win/win.rc.in ${CMAKE_BINARY_DIR}/win.rc) + set(WIN_RC_FILE ${CMAKE_BINARY_DIR}/win.rc) +endif() -set(Hyperion_QT_HEADERS +add_executable(${PROJECT_NAME} QtWrapper.h -) - -set(Hyperion_QT_SOURCES QtWrapper.cpp hyperion-qt.cpp -) - -# generate windows .rc file for this binary -if (WIN32) - include(${CMAKE_SOURCE_DIR}/cmake/win/win_rc.cmake) - generate_win_rc_file(${PROJECT_NAME}) -endif() - -add_executable(${PROJECT_NAME} - ${Hyperion_QT_HEADERS} - ${Hyperion_QT_SOURCES} - ${${PROJECT_NAME}_WIN_RC_PATH} + ${WIN_RC_FILE} ) target_link_libraries(${PROJECT_NAME} @@ -34,28 +20,25 @@ target_link_libraries(${PROJECT_NAME} qt-grabber flatbufconnect flatbuffers - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() if(APPLE) - install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_qt" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_qt") elseif(NOT WIN32) - install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_qt" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_qt") else() - install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_qt" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_qt") endif() if(CMAKE_HOST_UNIX AND NOT APPLE) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_qt" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_qt" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_qt" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_qt") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_qt") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_qt") endif() diff --git a/src/hyperion-qt/QtWrapper.h b/src/hyperion-qt/QtWrapper.h index e4e689a39..979b27aa3 100644 --- a/src/hyperion-qt/QtWrapper.h +++ b/src/hyperion-qt/QtWrapper.h @@ -4,7 +4,7 @@ #include // Hyperion-Qt includes -#include +#include #include class QtWrapper : public QObject diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index a2805cadf..ef60a7dc5 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -1,68 +1,50 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-remote) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -# The following I do not understand completely... -# libQtCore.so uses some hardcoded library path inside which are incorrect after copying the file RPi file system -# Therefore, an extra path is needed on which to find the required libraries -IF ( EXISTS ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf ) - LINK_DIRECTORIES(${LINK_DIRECTORIES} ${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) -ENDIF() - -set(hyperion-remote_HEADERS - JsonConnection.h) - -set(hyperion-remote_SOURCES - hyperion-remote.cpp - JsonConnection.cpp) - -# generate windows .rc file for this binary -if (WIN32) - include(${CMAKE_SOURCE_DIR}/cmake/win/win_rc.cmake) - generate_win_rc_file(${PROJECT_NAME}) +if(WIN32) + # generate windows .rc file for this binary + string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico) + configure_file(${CMAKE_SOURCE_DIR}/cmake/win/win.rc.in ${CMAKE_BINARY_DIR}/win.rc) + set(WIN_RC_FILE ${CMAKE_BINARY_DIR}/win.rc) endif() add_executable(${PROJECT_NAME} - ${hyperion-remote_HEADERS} - ${hyperion-remote_SOURCES} - ${${PROJECT_NAME}_WIN_RC_PATH} + JsonConnection.h + JsonConnection.cpp + hyperion-remote.cpp + ${WIN_RC_FILE} ) target_link_libraries(${PROJECT_NAME} commandline hyperion-utils - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) -if (ENABLE_AMLOGIC) - target_link_libraries(${PROJECT_NAME} - pcre16 dl z - ) +if(ENABLE_AMLOGIC) + target_link_libraries(${PROJECT_NAME} pcre16 dl z) endif() if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() if(ENABLE_EFFECTENGINE) - target_link_libraries(${PROJECT_NAME} effectengine) + target_link_libraries(${PROJECT_NAME} effectengine) endif() if(APPLE) - install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_remote" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_remote") elseif(NOT WIN32) - install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_remote" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_remote") else() - install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_remote" ) + install (TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_remote") endif() if(CMAKE_HOST_UNIX AND NOT APPLE) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_remote" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_remote" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_remote" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_remote") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_remote") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_remote") endif() diff --git a/src/hyperion-v4l2/CMakeLists.txt b/src/hyperion-v4l2/CMakeLists.txt index 1404d2ad8..37189cdc2 100644 --- a/src/hyperion-v4l2/CMakeLists.txt +++ b/src/hyperion-v4l2/CMakeLists.txt @@ -1,25 +1,10 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-v4l2) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_V4L2_HEADERS +add_executable(${PROJECT_NAME} ScreenshotHandler.h -) - -set(Hyperion_V4L2_SOURCES - hyperion-v4l2.cpp ScreenshotHandler.cpp -) - -add_executable(${PROJECT_NAME} - ${Hyperion_V4L2_HEADERS} - ${Hyperion_V4L2_SOURCES} + hyperion-v4l2.cpp ) target_link_libraries(${PROJECT_NAME} @@ -28,27 +13,23 @@ target_link_libraries(${PROJECT_NAME} hyperion-utils flatbufconnect flatbuffers - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -if (ENABLE_AMLOGIC) - target_link_libraries(${PROJECT_NAME} - pcre16 dl z - ) +if(ENABLE_AMLOGIC) + target_link_libraries(${PROJECT_NAME} pcre16 dl z) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_v4l2" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_v4l2") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_v4l2" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_v4l2" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_v4l2" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_v4l2") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_v4l2") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_v4l2") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-v4l2/hyperion-v4l2.cpp b/src/hyperion-v4l2/hyperion-v4l2.cpp index 731951777..daef95671 100644 --- a/src/hyperion-v4l2/hyperion-v4l2.cpp +++ b/src/hyperion-v4l2/hyperion-v4l2.cpp @@ -10,7 +10,7 @@ #include // grabber includes -#include "grabber/V4L2Grabber.h" +#include "grabber/video/v4l2/V4L2Grabber.h" // flatbuf includes #include @@ -255,7 +255,7 @@ int main(int argc, char** argv) SSDPDiscover discover; host = discover.getFirstService(searchType::STY_FLATBUFSERVER); #endif - + QHostAddress address; if (!NetUtils::resolveHostToAddress(log, host, address, port)) { diff --git a/src/hyperion-x11/CMakeLists.txt b/src/hyperion-x11/CMakeLists.txt index 88095ae38..20ca0f7ac 100644 --- a/src/hyperion-x11/CMakeLists.txt +++ b/src/hyperion-x11/CMakeLists.txt @@ -1,32 +1,14 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-x11) -find_package(X11 REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Network Widgets REQUIRED) - - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${X11_INCLUDES} - ${FLATBUFFERS_INCLUDE_DIRS} -) - if(APPLE) include_directories("/opt/X11/include") endif(APPLE) -set(Hyperion_X11_HEADERS +add_executable(${PROJECT_NAME} X11Wrapper.h -) - -set(Hyperion_X11_SOURCES - hyperion-x11.cpp X11Wrapper.cpp -) - -add_executable(${PROJECT_NAME} - ${Hyperion_X11_HEADERS} - ${Hyperion_X11_SOURCES} + hyperion-x11.cpp ) target_link_libraries(${PROJECT_NAME} @@ -35,25 +17,19 @@ target_link_libraries(${PROJECT_NAME} flatbufconnect flatbuffers x11-grabber - ${X11_LIBRARIES} - ${X11_Xrandr_LIB} - ${X11_Xrender_LIB} - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() -install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_x11" ) +install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_x11") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_x11" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_x11" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_x11" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_x11") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_x11") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_x11") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-x11/X11Wrapper.h b/src/hyperion-x11/X11Wrapper.h index d0f9f1f22..13dbfdff2 100644 --- a/src/hyperion-x11/X11Wrapper.h +++ b/src/hyperion-x11/X11Wrapper.h @@ -4,7 +4,7 @@ #include // Hyperion-X11 includes -#include +#include #include class X11Wrapper : public QObject diff --git a/src/hyperion-xcb/CMakeLists.txt b/src/hyperion-xcb/CMakeLists.txt index f378aef22..98b2ba323 100644 --- a/src/hyperion-xcb/CMakeLists.txt +++ b/src/hyperion-xcb/CMakeLists.txt @@ -1,48 +1,31 @@ cmake_minimum_required(VERSION 3.5.0) project(hyperion-xcb) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver - ${FLATBUFFERS_INCLUDE_DIRS} -) - -set(Hyperion_XCB_HEADERS +add_executable(${PROJECT_NAME} XcbWrapper.h -) - -set(Hyperion_XCB_SOURCES hyperion-xcb.cpp XcbWrapper.cpp ) -add_executable(${PROJECT_NAME} - ${Hyperion_XCB_HEADERS} - ${Hyperion_XCB_SOURCES} -) - target_link_libraries(${PROJECT_NAME} commandline hyperion-utils flatbufconnect flatbuffers xcb-grabber - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ) if(ENABLE_MDNS) - target_link_libraries(${PROJECT_NAME} mdns) + target_link_libraries(${PROJECT_NAME} mdns) else() - target_link_libraries(${PROJECT_NAME} ssdp) + target_link_libraries(${PROJECT_NAME} ssdp) endif() install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_xcb") if(CMAKE_HOST_UNIX) - install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_xcb" ) - install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_xcb" ) - install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_xcb" ) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "hyperion_xcb") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_xcb") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "hyperion_xcb") endif(CMAKE_HOST_UNIX) diff --git a/src/hyperion-xcb/XcbWrapper.h b/src/hyperion-xcb/XcbWrapper.h index d75aa63f7..e3806ade5 100644 --- a/src/hyperion-xcb/XcbWrapper.h +++ b/src/hyperion-xcb/XcbWrapper.h @@ -4,7 +4,7 @@ #include // Hyperion-Xcb includes -#include +#include #include //Utils includes diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 35326c221..4d227d81e 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -1,41 +1,32 @@ -if (APPLE) +if(APPLE) project(Hyperion) else() project(hyperiond) endif() -if(ENABLE_EFFECTENGINE) - if (NOT CMAKE_VERSION VERSION_LESS "3.12") - find_package(Python3 COMPONENTS Interpreter Development REQUIRED) - include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..) - else() - find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake - include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..) - endif() -endif () - -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Gui Widgets REQUIRED) +##################################### +############ Preparation ############ +##################################### -# generate windows .rc file for this binary -if (WIN32) - include(${CMAKE_SOURCE_DIR}/cmake/win/win_rc.cmake) - generate_win_rc_file(${PROJECT_NAME}) -endif(WIN32) +if(WIN32) + # generate windows .rc file for this binary + string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico) + configure_file(${CMAKE_SOURCE_DIR}/cmake/win/win.rc.in ${CMAKE_BINARY_DIR}/win.rc) + set(WIN_RC_FILE ${CMAKE_BINARY_DIR}/win.rc) -# include resource files for macos bundle (copy LICENSE file and correct line breaks) -if (APPLE) + # promote hyperiond as GUI app + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup") +elseif(APPLE) + # include resource files for macos bundle (copy LICENSE file and correct line breaks) configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_BINARY_DIR}/LICENSE COPYONLY) execute_process(COMMAND bash -c "perl -pi -e 's/\n/\r/g' ${CMAKE_BINARY_DIR}/LICENSE") - set(BUNDLE_RESOURCE_FILES ${CMAKE_SOURCE_DIR}/cmake/osxbundle/Hyperion.icns ${CMAKE_BINARY_DIR}/LICENSE) - set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) -endif(APPLE) - -if (UNIX) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus QUIET ) - if (Qt${QT_VERSION_MAJOR}DBus_FOUND) - set(hyperiond_POWER_MNG_DBUS "Qt${QT_VERSION_MAJOR}::DBus") - endif() -endif(UNIX) + set(MACOS_BUNDLE_RESOURCE_FILES ${CMAKE_SOURCE_DIR}/cmake/osxbundle/Hyperion.icns ${CMAKE_BINARY_DIR}/LICENSE) + set_source_files_properties(${MACOS_BUNDLE_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +endif() + +##################################### +########### General steps ########### +##################################### add_executable(${PROJECT_NAME} console.h @@ -45,19 +36,10 @@ add_executable(${PROJECT_NAME} systray.cpp SuspendHandler.cpp main.cpp - ${hyperiond_WIN_RC_PATH} - ${BUNDLE_RESOURCE_FILES} + ${WIN_RC_FILE} + ${MACOS_BUNDLE_RESOURCE_FILES} ) -if (UNIX AND NOT APPLE AND Qt${QT_VERSION_MAJOR}DBus_FOUND) - target_compile_definitions(${PROJECT_NAME} PUBLIC HYPERION_HAS_DBUS) -endif() - -# promote hyperiond as GUI app -if (WIN32) - target_link_options(${PROJECT_NAME} PUBLIC /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup) -endif(WIN32) - target_link_libraries(${PROJECT_NAME} commandline hyperion @@ -70,18 +52,16 @@ target_link_libraries(${PROJECT_NAME} Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets - ${hyperiond_POWER_MNG_DBUS} ) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus QUIET) +if(Qt${QT_VERSION_MAJOR}DBus_FOUND) + target_link_libraries(${PROJECT_NAME} "Qt${QT_VERSION_MAJOR}::DBus") +endif() + if(ENABLE_EFFECTENGINE) target_link_libraries(${PROJECT_NAME} effectengine python) - - if (NOT CMAKE_VERSION VERSION_LESS "3.12") - target_link_libraries( ${PROJECT_NAME} ${Python3_LIBRARIES} ) - else() - target_link_libraries( ${PROJECT_NAME} ${PYTHON_LIBRARIES} ) - endif() -endif () +endif() if(ENABLE_FLATBUF_SERVER) target_link_libraries(${PROJECT_NAME} flatbufserver) @@ -91,71 +71,71 @@ if(ENABLE_PROTOBUF_SERVER) target_link_libraries(${PROJECT_NAME} protoserver) endif() -if (ENABLE_AMLOGIC) - target_link_libraries(${PROJECT_NAME} - #Qt${QT_VERSION_MAJOR}::Core - pcre16 dl z - ) +if(ENABLE_AMLOGIC) + target_link_libraries(${PROJECT_NAME} pcre16 dl z) endif(ENABLE_AMLOGIC) -if (ENABLE_DISPMANX) +if(ENABLE_DISPMANX) target_link_libraries(${PROJECT_NAME} dispmanx-grabber) endif (ENABLE_DISPMANX) -if (ENABLE_FB) +if(ENABLE_FB) target_link_libraries(${PROJECT_NAME} framebuffer-grabber) endif (ENABLE_FB) -if (ENABLE_OSX) +if(ENABLE_OSX) target_link_libraries(${PROJECT_NAME} osx-grabber) endif (ENABLE_OSX) -if (ENABLE_V4L2) +if(ENABLE_V4L2) target_link_libraries(${PROJECT_NAME} v4l2-grabber) -endif () +endif() -if (ENABLE_MF) +if(ENABLE_MF) target_link_libraries(${PROJECT_NAME} mf-grabber) endif (ENABLE_MF) -if (ENABLE_AUDIO) +if(ENABLE_AUDIO) target_link_libraries(hyperiond audio-grabber) endif() -if (ENABLE_AMLOGIC) +if(ENABLE_AMLOGIC) target_link_libraries(${PROJECT_NAME} amlogic-grabber) endif (ENABLE_AMLOGIC) -if (ENABLE_X11) +if(ENABLE_X11) if(APPLE) include_directories("/opt/X11/include") endif(APPLE) target_link_libraries(${PROJECT_NAME} x11-grabber) endif (ENABLE_X11) -if (ENABLE_XCB) +if(ENABLE_XCB) target_link_libraries(${PROJECT_NAME} xcb-grabber) endif (ENABLE_XCB) -if (ENABLE_QT) +if(ENABLE_QT) target_link_libraries(${PROJECT_NAME} qt-grabber) endif (ENABLE_QT) -if (ENABLE_DX) - include_directories(${DIRECTX9_INCLUDE_DIRS}) +if(ENABLE_DX) target_link_libraries(${PROJECT_NAME} directx-grabber) endif (ENABLE_DX) -if (ENABLE_CEC) - target_link_libraries(${PROJECT_NAME} cechandler) +if(ENABLE_CEC) + target_link_libraries(${PROJECT_NAME} cechandler) endif (ENABLE_CEC) -if (ENABLE_MDNS) +if(ENABLE_MDNS) target_link_libraries(${PROJECT_NAME} mdns) endif() -if (APPLE) - set_target_properties( ${PROJECT_NAME} PROPERTIES +##################################### +########### Install steps ########### +##################################### + +if(APPLE) + set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/cmake/osxbundle/Info.plist.in MACOSX_BUNDLE_BUNDLE_NAME "Hyperion" @@ -168,69 +148,83 @@ if (APPLE) MACOSX_BUNDLE_LONG_VERSION_STRING ${HYPERION_VERSION} ) - install ( TARGETS ${PROJECT_NAME} DESTINATION . COMPONENT "Hyperion") + install (TARGETS ${PROJECT_NAME} DESTINATION . COMPONENT "Hyperion") elseif(NOT WIN32) - install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "Hyperion" ) - install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT "Hyperion" ) - install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "share/hyperion/effects" COMPONENT "Hyperion" ) - install ( FILES ${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png DESTINATION "share/hyperion/icons" COMPONENT "Hyperion" ) - - # Desktop file for Hyperion - install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond_128.png DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion" ) - install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond.desktop DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion" ) + # install Hyperion/service files/effect folder + install (TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "Hyperion") + install (DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion" COMPONENT "Hyperion") + install (FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "share/hyperion/effects" COMPONENT "Hyperion") + + # install Hyperion icons + set(ICON_SIZES 16 22 24 32 36 48 64 72 96 128 192 256 512) + foreach(size ${ICON_SIZES}) + set(ICONS_FROM "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-${size}px.png") + set(ICONS_TO "share/hyperion/icons/${size}x${size}/apps/") + install(FILES ${ICONS_FROM} DESTINATION ${ICONS_TO} RENAME "hyperion.png" COMPONENT "Hyperion") + endforeach(size) + + # install desktop/appstream file + install (FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperion.metainfo.xml DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion") + install (FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperion.desktop DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion") else() - install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "Hyperion" ) - install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "effects" COMPONENT "Hyperion" ) - - #set( CMAKE_INSTALL_UCRT_LIBRARIES TRUE ) - #set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE ) - #include( InstallRequiredSystemLibraries ) + install (TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "Hyperion") + install (FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "effects" COMPONENT "Hyperion") endif() -if (CMAKE_HOST_UNIX AND NOT APPLE) - install( CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "Hyperion" ) - install( FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME ${PROJECT_NAME} COMPONENT "Hyperion" ) - install( CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "Hyperion" ) - install( FILES ${CMAKE_SOURCE_DIR}/bin/scripts/updateHyperionUser.sh DESTINATION "share/hyperion/scripts" COMPONENT "Hyperion" ) +if(CMAKE_HOST_UNIX AND NOT APPLE) + install(CODE "execute_process(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\")" COMPONENT "Hyperion") + install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME ${PROJECT_NAME} COMPONENT "Hyperion") + install(CODE "file (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "Hyperion") + install(FILES ${CMAKE_SOURCE_DIR}/bin/scripts/updateHyperionUser.sh DESTINATION "share/hyperion/scripts" COMPONENT "Hyperion") endif() +###################################### +########## Additional steps ########## +###################################### + # Deploy Qt DLLs into the binary folder. # This is necessary for starting the application from within the IDE -if (WIN32) +if(WIN32) get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY) find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}") - if (NOT WINDEPLOYQT_EXECUTABLE) + if(NOT WINDEPLOYQT_EXECUTABLE) find_program(WINDEPLOYQT_EXECUTABLE windeployqt) endif() - if (WINDEPLOYQT_EXECUTABLE AND NOT CMAKE_GITHUB_ACTION) + if(WINDEPLOYQT_EXECUTABLE AND NOT CMAKE_GITHUB_ACTION) set(WINDEPLOYQT_PARAMS_RUNTIME --verbose 0 --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler) message(STATUS "Found windeployqt: ${WINDEPLOYQT_EXECUTABLE} PATH_HINT:${QT_BIN_DIR}") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} ${WINDEPLOYQT_PARAMS_RUNTIME} "$") endif() find_package(OpenSSL REQUIRED) - if (OPENSSL_FOUND) + if(OPENSSL_FOUND) string(REGEX MATCHALL "[0-9]+" openssl_versions "${OPENSSL_VERSION}") list(GET openssl_versions 0 openssl_version_major) list(GET openssl_versions 1 openssl_version_minor) - set(library_suffix "-${openssl_version_major}_${openssl_version_minor}") - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - string(APPEND library_suffix "-x64") + set(open_ssl_version_suffix) + if(openssl_version_major VERSION_EQUAL 1 AND openssl_version_minor VERSION_EQUAL 1) + set(open_ssl_version_suffix "-1_1") + else() + set(open_ssl_version_suffix "-3") + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + string(APPEND open_ssl_version_suffix "-x64") endif() find_file(OPENSSL_SSL - NAMES "libssl${library_suffix}.dll" + NAMES "libssl${open_ssl_version_suffix}.dll" PATHS ${OPENSSL_INCLUDE_DIR}/.. ${OPENSSL_INCLUDE_DIR}/../bin NO_DEFAULT_PATH ) find_file(OPENSSL_CRYPTO - NAMES "libcrypto${library_suffix}.dll" + NAMES "libcrypto${open_ssl_version_suffix}.dll" PATHS ${OPENSSL_INCLUDE_DIR}/.. ${OPENSSL_INCLUDE_DIR}/../bin NO_DEFAULT_PATH ) @@ -248,11 +242,11 @@ if(ENABLE_DEPLOY_DEPENDENCIES) # Deploy all dependencies for package creation include(${CMAKE_SOURCE_DIR}/cmake/Dependencies.cmake) - if (APPLE) #macOS + if(APPLE) #macOS DeployMacOS(${PROJECT_NAME}) elseif (NOT WIN32) # Linux DeployLinux(${PROJECT_NAME}) elseif(WIN32) # Windows DeployWindows(${PROJECT_NAME}) - endif () + endif() endif(ENABLE_DEPLOY_DEPENDENCIES) diff --git a/src/hyperiond/hyperiond.h b/src/hyperiond/hyperiond.h index 2a2927460..c8b631130 100644 --- a/src/hyperiond/hyperiond.h +++ b/src/hyperiond/hyperiond.h @@ -7,62 +7,62 @@ #include #ifdef ENABLE_DISPMANX - #include + #include #else typedef QObject DispmanxWrapper; #endif #if defined(ENABLE_V4L2) || defined(ENABLE_MF) - #include + #include #else typedef QObject VideoWrapper; #endif #ifdef ENABLE_FB - #include + #include #else typedef QObject FramebufferWrapper; #endif #ifdef ENABLE_AMLOGIC - #include + #include #else typedef QObject AmlogicWrapper; #endif #ifdef ENABLE_OSX - #include + #include #else typedef QObject OsxWrapper; #endif #ifdef ENABLE_X11 - #include + #include #else typedef QObject X11Wrapper; #endif #ifdef ENABLE_XCB - #include + #include #else typedef QObject XcbWrapper; #endif #ifdef ENABLE_QT - #include + #include #else typedef QObject QtWrapper; #endif #ifdef ENABLE_DX - #include + #include #else typedef QObject DirectXWrapper; #endif #include #ifdef ENABLE_AUDIO - #include + #include #else typedef QObject AudioWrapper; #endif @@ -211,8 +211,8 @@ private slots: OsxWrapper* _osxGrabber; QtWrapper* _qtGrabber; DirectXWrapper* _dxGrabber; - AudioWrapper* _audioGrabber; SSDPHandler* _ssdp; + AudioWrapper* _audioGrabber; #ifdef ENABLE_CEC CECHandler* _cecHandler; #endif diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index fa9352b95..9bdda136f 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -115,7 +115,7 @@ QCoreApplication* createApplication(int &argc, char *argv[]) app->addLibraryPath(QApplication::applicationDirPath() + "/../lib"); app->setApplicationDisplayName("Hyperion"); #ifndef __APPLE__ - app->setWindowIcon(QIcon(":/hyperion-icon-32px.png")); + app->setWindowIcon(QIcon(":/hyperion-32px.png")); #endif return app; } diff --git a/src/hyperiond/systray.cpp b/src/hyperiond/systray.cpp index ab7b6c8a4..34f8de0a5 100644 --- a/src/hyperiond/systray.cpp +++ b/src/hyperiond/systray.cpp @@ -33,8 +33,8 @@ SysTray::SysTray(HyperionDaemon *hyperiond) , _hyperiond(hyperiond) , _hyperion(nullptr) , _instanceManager(HyperionIManager::getInstance()) - , _suspendHandler (hyperiond->getSuspendHandlerInstance()) , _webPort(8090) + , _suspendHandler (hyperiond->getSuspendHandlerInstance()) { Q_INIT_RESOURCE(resources); @@ -281,7 +281,7 @@ void SysTray::handleInstanceStateChange(InstanceState state, quint8 instance, co connect(quitAction, &QAction::triggered, _trayIcon, &QSystemTrayIcon::hide, Qt::DirectConnection); connect(&_colorDlg, &QColorDialog::currentColorChanged, this, &SysTray::setColor); - QIcon icon(":/hyperion-icon-32px.png"); + QIcon icon(":/hyperion-32px.png"); _trayIcon->setIcon(icon); _trayIcon->show(); setWindowIcon(icon); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e447f571..28378df6b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,17 +3,17 @@ include_directories(../libsrc) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) -MACRO (link_to_hyperion TARGET) - target_link_libraries( ${TARGET} blackborder leddevice jsonserver hyperion-utils hyperion ) +macro (link_to_hyperion TARGET) + target_link_libraries(${TARGET} blackborder leddevice jsonserver hyperion-utils hyperion) if(ENABLE_EFFECTENGINE) - target_link_libraries( ${TARGET} effectengine ) + target_link_libraries(${TARGET} effectengine) endif() -ENDMACRO() +endmacro() if(ENABLE_DEV_SPI) # Add the simple test executable 'TestSpi' add_executable(test_spi TestSpi.cpp) - target_link_libraries( test_spi leddevice hyperion-utils hyperion ) + target_link_libraries(test_spi leddevice hyperion-utils hyperion) add_executable(spidev_test spidev_test.c) add_executable(gpio2spi switchPinCtrl.c) endif(ENABLE_DEV_SPI) @@ -42,12 +42,12 @@ endif(ENABLE_X11) add_executable(test_versions TestVersions.cpp) target_link_libraries(test_versions Qt${QT_VERSION_MAJOR}::Core) -add_executable(test_image2ledsmap TestImage2LedsMap.cpp "${CMAKE_BINARY_DIR}/resources.qrc" ) +add_executable(test_image2ledsmap TestImage2LedsMap.cpp "${CMAKE_BINARY_DIR}/resources.qrc") link_to_hyperion(test_image2ledsmap) ######### These tests are broken. May they fix someone ########## -#if (ENABLE_DISPMANX) +#if(ENABLE_DISPMANX) # add_subdirectory(dispmanx2png) #endif (ENABLE_DISPMANX) diff --git a/test/dispmanx2png/CMakeLists.txt b/test/dispmanx2png/CMakeLists.txt index 7dfdd7593..80037b9bf 100644 --- a/test/dispmanx2png/CMakeLists.txt +++ b/test/dispmanx2png/CMakeLists.txt @@ -1,5 +1,5 @@ # this is only available on real pi -IF ( "${PLATFORM}" MATCHES rpi) +if("${PLATFORM}" MATCHES rpi) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED) @@ -16,4 +16,4 @@ IF ( "${PLATFORM}" MATCHES rpi) target_link_libraries(dispmanx2png dispmanx-grabber Qt${QT_VERSION_MAJOR::Gui) -ENDIF() +endif() diff --git a/test/dispmanx2png/dispmanx2png.cpp b/test/dispmanx2png/dispmanx2png.cpp index 2739f4fde..2c2a1748f 100644 --- a/test/dispmanx2png/dispmanx2png.cpp +++ b/test/dispmanx2png/dispmanx2png.cpp @@ -7,7 +7,7 @@ #include // Dispmanx grabber includes -#include +#include static bool running = true;