diff --git a/.azure.yml b/.azure.yml new file mode 100644 index 00000000..74604fea --- /dev/null +++ b/.azure.yml @@ -0,0 +1,48 @@ +jobs: +- job: Linux + pool: + vmImage: 'ubuntu-16.04' + strategy: + matrix: + AMD64 (x64): + dockerTag: 'amd64' + dockerName: 'Debian Stretch (AMD64)' + i386 (x86): + dockerTag: 'i386' + dockerName: 'Debian Stretch (i386)' + ARMv6hf (Raspberry Pi v1 & ZERO): + dockerTag: 'armv6hf' + dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)' + platform: 'rpi' + ARMv7hf (Raspberry Pi 2 & 3): + dockerTag: 'armv7hf' + dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)' + platform: 'rpi' + ARMv8 (Generic AARCH64): + dockerTag: 'aarch64' + dockerName: 'ARMv8 (Generic AARCH64)' + platform: 'amlogic' + steps: + - checkout: self + submodules: recursive + - bash: ./.ci/ci_build.sh + displayName: 'Build $(dockerName)' + env: + DOCKER_TAG: $(dockerTag) + DOCKER_NAME: $(dockerName) + PLATFORM: $(platform) + - bash: ./.ci/ci_deploy.sh + displayName: 'Upload $(dockerName)' + +- job: macOS + pool: + vmImage: 'macOS-10.13' + steps: + - checkout: self + submodules: recursive + - bash: ./.ci/ci_install.sh + displayName: 'Install dependencies' + - bash: ./.ci/ci_build.sh + displayName: 'Build macOS 10.13' + - bash: ./.ci/ci_deploy.sh + displayName: 'Upload macOS 10.13' diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh new file mode 100755 index 00000000..016dae6e --- /dev/null +++ b/.ci/ci_build.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +# detect CI +if [ -n "${TRAVIS-}" ]; then + # Travis-CI + CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')" + CI_BUILD_DIR="$TRAVIS_BUILD_DIR" +elif [ "$SYSTEM_COLLECTIONID" != "" ]; then + # Azure Pipelines + CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')" + CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY" +else + # for executing in non ci environment + CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" +fi + +# set environment variables +BUILD_TYPE="Debug" +PACKAGES="" +[ -z "${PLATFORM}" ] && PLATFORM="x11" + +# Detect number of processor cores +# default is 4 jobs +if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then + JOBS=$(sysctl -n hw.ncpu) + PLATFORM=osx +elif [[ "$CI_NAME" == 'linux' ]]; then + JOBS=$(nproc) +fi +echo "compile jobs: ${JOBS:=4}" + +# Determine cmake build type; tag builds are Release, else Debug +if [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then + BUILD_TYPE=Release +fi + +# Determine package creation; True for cron/schedule and tag builds +if [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_REASON == "Schedule" ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then + PACKAGES="package" +fi + +# Determie -dev appends to platform; +# Commented because tests are currently broken +# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev + +# Build the package on osx or docker for linux +if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then + # compile prepare + mkdir build || exit 1 + mkdir ${CI_BUILD_DIR}/deploy || exit 1 + cd build + cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2 + make -j ${JOBS} ${PACKAGES} || exit 3 + echo "---> Copy binaries and packages to folder: ${CI_BUILD_DIR}/deploy" + cp -v ${CI_BUILD_DIR}/build/bin/h* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : && + cp -v ${CI_BUILD_DIR}/build/Hyperion-* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : && + exit 0; +elif [[ "$CI_NAME" == 'linux' ]]; then + echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}" + # 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" \ + hyperionproject/hyperion-ci:$DOCKER_TAG \ + /bin/bash -c "mkdir build && cp -r source/. /build && + cd /build && mkdir build && cd build && + cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 && + make -j ${JOBS} ${PACKAGES} || exit 3 && + echo '---> Copy binaries and packages to host folder: ${CI_BUILD_DIR}/deploy' && + cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : && + cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : && + exit 0; + exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; } + + # 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_deploy.sh b/.ci/ci_deploy.sh new file mode 100755 index 00000000..df3ef780 --- /dev/null +++ b/.ci/ci_deploy.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# detect CI +if [ -n "${TRAVIS-}" ]; then + # Travis-CI + CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')" + CI_BUILD_DIR="$TRAVIS_BUILD_DIR" +elif [ "$SYSTEM_COLLECTIONID" != "" ]; then + # Azure Pipelines + CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')" + CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY" +else + # for executing in non ci environment + CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" +fi + +# sf_upload +# { +# echo "Uploading following files: ${1} to dir /hyperion-project/${2}" +# +# } + +# append current Date to filename (just packages no binaries) +appendDate() +{ + D=$(date +%Y-%m-%d) + for F in $CI_BUILD_DIR/deploy/Hy* + do + mv "$F" "${F%.*}-$D.${F##*.}" + done +} + +# append friendly name (just packages no binaries) +appendName() +{ + for F in $CI_BUILD_DIR/deploy/Hy* + do + mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}" + done +} + +# get all files to deploy (just packages no binaries) +getFiles() +{ + FILES="" + for f in $CI_BUILD_DIR/deploy/Hy*; + do FILES+="${f} "; + done; +} + +if [[ $CI_NAME == 'linux' || "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then + if [[ -n $TRAVIS_TAG ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then + echo "tag upload" + appendName + appendDate + getFiles + # sf_upload $FILES release + elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]] || [[ $BUILD_REASON == "Schedule" ]]; then + echo "cron/schedule upload" + appendName + appendDate + getFiles + # sf_upload $FILES dev/alpha + else + echo "Direct pushed no upload, PRs not possible" + fi +fi diff --git a/.ci/ci_install.sh b/.ci/ci_install.sh new file mode 100755 index 00000000..7efa31d4 --- /dev/null +++ b/.ci/ci_install.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# detect CI +if [ -n "${TRAVIS-}" ]; then + # Travis-CI + CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')" +elif [ "$SYSTEM_COLLECTIONID" != "" ]; then + # Azure Pipelines + CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')" +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 | grep $i` + outdated_output=`brew outdated | grep $i` + + if [[ ! -z "$list_output" ]]; then + if [[ ! -z "$outdated_output" ]]; then + brew upgrade $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[@]}" +elif [[ $CI_NAME != 'linux' ]]; then + echo "Unsupported platform: $CI_NAME" + exit 5 +fi diff --git a/.gitmodules b/.gitmodules index 981fff4d..31ddf173 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,8 @@ [submodule "dependencies/external/flatbuffers"] path = dependencies/external/flatbuffers url = https://github.com/google/flatbuffers + branch = master +[submodule "dependencies/external/protobuf"] + path = dependencies/external/protobuf + url = https://github.com/hyperion-project/protobuf.git + branch = master diff --git a/.travis.yml b/.travis.yml index e85acbb1..38bd18bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,11 @@ +linux: &linux + os: linux + dist: xenial + services: + - docker +osx: &osx + os: osx + cache: - ccache - directories: @@ -5,27 +13,53 @@ cache: notifications: email: false language: cpp -services: - - docker -matrix: - include: - - os: linux - dist: trusty - env: - - DOCKER_TAG=ubuntu1604 - - DOCKER_NAME="Ubuntu 16.04" - - os: linux - dist: trusty - env: - - DOCKER_TAG=cross-qemu-rpistretch - - DOCKER_NAME="Raspberry Pi" - - os: osx - osx_image: xcode8.3 - env: - - HOMEBREW_CACHE=$HOME/brew-cache + before_install: - - ./.travis/travis_install.sh + - ./.ci/ci_install.sh + +jobs: + include: + - <<: *linux + name: "AMD64 (x64)" + env: + - DOCKER_TAG=amd64 + - DOCKER_NAME="Debian Stretch (AMD64)" + - <<: *linux + name: "i386 (x86)" + env: + - DOCKER_TAG=i386 + - DOCKER_NAME="Debian Stretch (i386)" +# //////////////////////////////////////////////////////////////// +# NOTE: Temporary disabled because travis timeouts +# //////////////////////////////////////////////////////////////// +# - <<: *linux +# name: "ARMv6hf (Raspberry Pi v1 & ZERO)" +# env: +# - DOCKER_TAG=armv6hf +# - DOCKER_NAME="Debian Stretch (Raspberry Pi v1 & ZERO)" +# - PLATFORM="rpi" +# - <<: *linux +# name: "ARMv7hf (Raspberry Pi 2 & 3)" +# env: +# - DOCKER_TAG=armv7hf +# - DOCKER_NAME="Debian Stretch (Raspberry Pi 2 & 3)" +# - PLATFORM="rpi" +# - <<: *linux +# name: "ARMv8 (Generic AARCH64)" +# env: +# - DOCKER_TAG=aarch64 +# - DOCKER_NAME="ARMv8 (Generic AARCH64)" +# - PLATFORM="amlogic" +# +# //////////////////////////////////////////////////////////////// + - <<: *osx + osx_image: xcode8.3 + name: "macOS 10.12 (Xcode 8.3.3)" + env: + - HOMEBREW_CACHE=$HOME/brew-cache + script: - - ./.travis/travis_build.sh + - ./.ci/ci_build.sh after_success: - - ./.travis/travis_deploy.sh + - ./.ci/ci_deploy.sh + diff --git a/.travis/travis_build.sh b/.travis/travis_build.sh deleted file mode 100755 index ddeb569c..00000000 --- a/.travis/travis_build.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# for executing in non travis environment -[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')" - -PLATFORM=x86 -BUILD_TYPE=Debug -PACKAGES="" - -# Detect number of processor cores -# default is 4 jobs -if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]] -then - JOBS=$(sysctl -n hw.ncpu) - PLATFORM=osx -elif [[ "$TRAVIS_OS_NAME" == 'linux' ]] -then - JOBS=$(nproc) -fi -echo "compile jobs: ${JOBS:=4}" - -# Determine cmake build type; tag builds are Release, else Debug -[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release - -# Determine package creation; True for cron and tag builds -[ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] && PACKAGES=package - -# Determie -dev appends to platform; -[ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev - -# Build the package on osx -if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]] -then - # compile prepare - mkdir build || exit 1 - cd build - cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2 - make -j ${JOBS} || exit 3 -fi - -# Build the package with docker -if [[ $TRAVIS_OS_NAME == 'linux' ]] -then - echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}" - # take ownership of deploy dir - mkdir $TRAVIS_BUILD_DIR/deploy - # run docker - docker run --rm \ - -v "${TRAVIS_BUILD_DIR}/deploy:/deploy" \ - -v "${TRAVIS_BUILD_DIR}:/source:ro" \ - hyperionorg/hyperion-ci:$DOCKER_TAG \ - /bin/bash -c "mkdir build && cp -r /source/. /build && - cd /build && mkdir build && cd build && - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 && - make -j $(nproc) ${PACKAGES} || exit 3 && - echo '---> Copy binaries and packages to host folder: ${TRAVIS_BUILD_DIR}/deploy' && - cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : && - cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : && - exit 0; - exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; } - - # overwrite file owner to current user - sudo chown -fR $(stat -c "%U:%G" $TRAVIS_BUILD_DIR/deploy) $TRAVIS_BUILD_DIR/deploy -fi diff --git a/.travis/travis_deploy.sh b/.travis/travis_deploy.sh deleted file mode 100755 index 2f41c285..00000000 --- a/.travis/travis_deploy.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# sf_upload -sf_upload() -{ -echo "Uploading following files: ${1} -to dir /hyperion-project/${2}" - - /usr/bin/expect <<-EOD - spawn scp $1hyperionsf37@frs.sourceforge.net:/home/frs/project/hyperion-project/$2 - expect "*(yes/no)*" - send "yes\r" - expect "*password:*" - send "$SFPW\r" - expect eof - EOD -} - -# append current Date to filename (just packages no binaries) -appendDate() -{ - D=$(date +%Y-%m-%d) - for F in $TRAVIS_BUILD_DIR/deploy/Hy* - do - mv "$F" "${F%.*}-$D.${F##*.}" - done -} - -# append friendly name (just packages no binaries) -appendName() -{ - for F in $TRAVIS_BUILD_DIR/deploy/Hy* - do - mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}" - done -} - -# get all files to deploy (just packages no binaries) -getFiles() -{ - FILES="" - for f in $TRAVIS_BUILD_DIR/deploy/Hy*; - do FILES+="${f} "; - done; -} - -if [[ $TRAVIS_OS_NAME == 'linux' ]]; then - if [[ -n $TRAVIS_TAG ]]; then - echo "tag upload" - appendName - appendDate - getFiles - sf_upload $FILES release - elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]]; then - echo "cron upload" - appendName - appendDate - getFiles - sf_upload $FILES dev/alpha - else - echo "Direct pushed no upload, PRs not possible" - #sf_upload $FILES pr - fi -fi diff --git a/.travis/travis_install.sh b/.travis/travis_install.sh deleted file mode 100755 index 414bd412..00000000 --- a/.travis/travis_install.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# for executing in non travis environment -[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$( uname -s | tr '[:upper:]' '[:lower:]' )" - -# install osx deps for hyperion compile -if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]] -then - echo "Install OSX deps" - brew update - brew install qt5 || true - brew upgrade python3 || true - brew upgrade libusb || true - brew upgrade cmake || true - brew install doxygen || true - -# install linux deps for hyperion compile -elif [[ $TRAVIS_OS_NAME == 'linux' ]] -then - echo "Install linux deps" - #sudo apt-get -qq update - #sudo apt-get install -qq -y qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev doxygen expect -else - echo "Unsupported platform: $TRAVIS_OS_NAME" - exit 5 -fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 6615eee7..8d030199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,13 @@ IF ( POLICY CMP0026 ) CMAKE_POLICY( SET CMP0026 OLD ) ENDIF() +# Configure CCache if available +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + SET ( HYPERION_VERSION_STABLE OFF ) SET ( HYPERION_VERSION_MAJOR 2 ) SET ( HYPERION_VERSION_MINOR 0 ) @@ -24,6 +31,7 @@ SET ( DEFAULT_QT ON ) SET ( DEFAULT_WS281XPWM OFF ) SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF ) +SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) SET ( DEFAULT_TESTS OFF ) IF ( ${CMAKE_SYSTEM} MATCHES "Linux" ) @@ -164,6 +172,9 @@ message(STATUS "ENABLE_PROFILER = ${ENABLE_PROFILER}") 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 ) + # check all json files FILE ( GLOB_RECURSE HYPERION_SCHEMAS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/libsrc/*schema*.json ) SET( JSON_FILES @@ -197,9 +208,6 @@ IF ( ${CHECK_CONFIG_FAILED} ) MESSAGE (FATAL_ERROR "check of json default config failed" ) ENDIF () - -# Createt the configuration file - # Add project specific cmake modules (find, etc) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -210,7 +218,6 @@ find_package(GitVersion) configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h") 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) @@ -233,6 +240,7 @@ CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") endif() if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") @@ -242,6 +250,9 @@ else() message(STATUS "No support for C++11 detected. Compilation will most likely fail on your compiler") endif() +# Use GNU gold linker if available +include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake) + # setup -rpath to search for shared libs in BINARY/../libs folder if (UNIX AND NOT APPLE) SET(CMAKE_SKIP_BUILD_RPATH FALSE) @@ -250,6 +261,24 @@ if (UNIX AND NOT APPLE) endif () # add QT5 dependency +IF ( CMAKE_CROSSCOMPILING ) + + file(GLOB QT_BIN ${QT_BIN_PATH}) + + set(QT_MOC_EXECUTABLE ${QT_BIN}/moc) + add_executable(Qt5::moc IMPORTED) + set_property(TARGET Qt5::moc PROPERTY IMPORTED_LOCATION ${QT_MOC_EXECUTABLE}) + + set(QT_RCC_EXECUTABLE ${QT_BIN}/rcc) + add_executable(Qt5::rcc IMPORTED) + set_property(TARGET Qt5::rcc PROPERTY IMPORTED_LOCATION ${QT_RCC_EXECUTABLE}) + + message(STATUS "QT_BIN_PATH = ${QT_BIN}") + message(STATUS "QT_MOC_EXECUTABLE = ${QT_MOC_EXECUTABLE}") + message(STATUS "QT_RCC_EXECUTABLE = ${QT_RCC_EXECUTABLE}") + +ENDIF() + SET(QT_MIN_VERSION "5.5.0") find_package(Qt5 COMPONENTS Core Gui Network SerialPort REQUIRED) message( STATUS "Found Qt Version: ${Qt5Core_VERSION}" ) @@ -257,12 +286,23 @@ IF ( "${Qt5Core_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" ) message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" ) ENDIF() - # Add libusb and pthreads find_package(libusb-1.0 REQUIRED) find_package(Threads REQUIRED) add_definitions(${QT_DEFINITIONS}) +# Add jpeg library +if (ENABLE_V4L2) + find_package(JPEG) + if (JPEG_FOUND) + add_definitions(-DHAVE_JPEG) + message( STATUS "Using JPEG library: ${JPEG_LIBRARIES}") + include_directories(${JPEG_INCLUDE_DIR}) + else() + message( STATUS "JPEG library not found, MJPEG camera format won't work in V4L2 grabber.") + endif() +endif() + # TODO[TvdZ]: This linking directory should only be added if we are cross compiling #if(NOT APPLE) # link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf) diff --git a/CompileHowto.md b/CompileHowto.md index 205f9a47..b181d055 100644 --- a/CompileHowto.md +++ b/CompileHowto.md @@ -1,13 +1,21 @@ # With Docker -If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compilation for Raspberry Pi (Raspbian stretch) +If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compilation for Raspberry Pi (Debian Stretch) -To compile Hyperion for Ubuntu 16.04 (x64) or higher just execute the following command +To compile Hyperion for Debain Stretch (x64 architecture) or higher just execute the following command ``` wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh ``` -To compile Hyperion for Raspberry Pi +To compile Hyperion for i386 architecture ``` -wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t cross-qemu-rpistretch +wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386 +``` +To compile Hyperion for Raspberry Pi v1 & ZERO +``` +wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf +``` +To compile Hyperion for Raspberry Pi 2 & 3 +``` +wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf ``` The compiled binaries and packages will be available at the deploy folder next to the script Note: call the script with `./docker-compile.sh -h` for more options @@ -18,7 +26,7 @@ Note: call the script with `./docker-compile.sh -h` for more options ``` sudo apt-get update -sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev +sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev ``` **on RPI you need the videocore IV headers** @@ -27,6 +35,10 @@ sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev sudo apt-get install libraspberrypi-dev ``` +**OSMC on Raspberry Pi** +``` +sudo apt-get install rbp-userland-dev-osmc +``` **ATTENTION Win10LinuxSubsystem** we do not (/we can't) support using hyperion in linux subsystem of MS Windows 10, albeit some users tested it with success. Keep in mind to disable all linux specific led and grabber hardware via cmake. Because we use QT as framework in hyperion, serialport leds and network driven devices could work. diff --git a/CrossCompileHowto.txt b/CrossCompileHowto.txt index 82adad84..ee31b104 100644 --- a/CrossCompileHowto.txt +++ b/CrossCompileHowto.txt @@ -1,38 +1,36 @@ #!/bin/bash -#Updated: 18 August 2016, by brindosch -#Just use a clean Ubunut 14.04 and run this script +#Use a clean Raspbian Stretch Lite and Ubunut 18/19 and run this script ############## #ON TARGET #-------------- -#sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev python-dev rsync +#sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev aptitude show qt5-default rsync ############# - #ON HOST #--------- sudo apt-get update sudo apt-get upgrade -#TO-DO verify what is really required -#blacklist: lib32z1 lib32ncurses5 lib32bz2-1.0 zlib1g-dev -sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev +# !!! TO-DO verify aptitude gcc-multilib -echo 'PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >> .bashrc +sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev #--------- -export TARGET_IP=192.168.0.103 +export TARGET_IP=x.x.x.x export TARGET_USER=pi -export RASCROSS_DIR="$HOME/raspberrypi" +export CROSSROOT="$HOME/crosscompile" +export RASCROSS_DIR="$CROSSROOT/raspberrypi" export ROOTFS_DIR="$RASCROSS_DIR/rootfs" -export HYPERION_DIR="$HOME/hyperion" -#export IMX6_DIR="$HOME/hummingboard" -export TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake" +export TOOLCHAIN_DIR="$RASCROSS_DIR/tools" +export QT5_DIR="$CROSSROOT/Qt5" -export NATIVE_BUILD_DIR="$HYPERION_DIR/build" -export TARGET_BUILD_DIR="$HYPERION_DIR/build-rpi" +export HYPERION_DIR="$HOME/hyperion.ng" -mkdir -p "$ROOTFS_DIR" -rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/{lib,usr} "$ROOTFS_DIR" +mkdir -p "$ROOTFS_DIR/lib" +mkdir -p "$ROOTFS_DIR/usr" +rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/lib "$ROOTFS_DIR" +rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/usr/include "$ROOTFS_DIR/usr" +rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/usr/lib "$ROOTFS_DIR/usr" ######## RPi specific ######### @@ -40,41 +38,40 @@ mkdir -p "$RASCROSS_DIR/firmware" git clone --depth 1 https://github.com/raspberrypi/firmware.git "$RASCROSS_DIR/firmware" ln -s "$RASCROSS_DIR/firmware/hardfp/opt" "$ROOTFS_DIR/opt" -git clone --depth 1 git://github.com/raspberrypi/tools.git "$RASCROSS_DIR/tools" +mkdir -p "$TOOLCHAIN_DIR" +cd $TOOLCHAIN_DIR +wget -c https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz --no-check-certificate +tar -xvf gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz ##### End of RPi specific ###### -######## NOT TESTED ONLY INFOs ######### -######## IMX6 specific ######### -#export IMX6_DIR="$HOME/hummingboard" -#mkdir -p "$IMX6_Dir" -#cd "$IMX6_Dir" -#wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2 -#tar -xvjf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2 -#cd -##### End of IMX6 specific ###### -######## NOT TESTED ######### +######## Qt5 specific ######### + +mkdir -p "$QT5_DIR" +cd "$QT5_DIR" + +wget -c http://download.qt.io/archive/qt/5.7/5.7.1/qt-opensource-linux-x64-5.7.1.run +chmod +x $QT5_DIR/*.run + +#Display absolute installation directory to be used in Qt5 installer +echo $HOME/crosscompile/Qt5 + +./qt-opensource-linux-x64-5.7.1.run + +#Follow the dialogs and install in absolute directory of $HOME/crosscompile/Qt5 (copy from above) + +##### End of Qt5 specific ###### # get the Hyperion sources git clone --recursive https://github.com/hyperion-project/hyperion.ng.git "$HYPERION_DIR" -# do a native build (to build the flatbuffers compiler for the native platform) -mkdir -p "$NATIVE_BUILD_DIR" -cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR" - -# do the cross build -# specify the protoc export file to import the flatbuffers compiler from the native build -mkdir -p "$TARGET_BUILD_DIR" -cmake -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DIMPORT_PROTOC=$NATIVE_BUILD_DIR/protoc_export.cmake --build "$TARGET_BUILD_DIR" "$HYPERION_DIR" +# get requried submodules +cd "$HYPERION_DIR" +git fetch --recurse-submodules -j2 #compile -cd "$HYPERION_DIR/bin" -chmod +x * -cp "$HYPERION_DIR/bin/create_all_releases.sh" "$HYPERION_DIR" cd "$HYPERION_DIR" -./create_all_releases.sh +chmod +x "$HYPERION_DIR/bin/"*.sh +./bin/create_all_releases.sh ######END -#------------------------------------------------------------------------------ -#These instructions are based on tvdzwan and on the guide given by: -#http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi diff --git a/README.md b/README.md index ff1cfd7f..82a67f44 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,27 @@ -HYPERION -======== +

+ +

-[![Build Status](https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master)](https://travis-ci.org/hyperion-project/hyperion.ng) +

+ + + + + + + + + + + + Total alerts + + GitHub license +

-This is a pre alpha development repository for the next major version of hyperion +

This is a pre alpha development repository for the next major version of hyperion

-------- ## **Important notice!** @@ -16,6 +34,7 @@ If you want to use hyperion as 'normal user', please use [current stable version Besides of that .... Feel free to join us! We are looking always for people who wants to participate. -------- +## About Hyperion is an opensource 'AmbiLight' implementation with support for many LED devices and video grabbers. diff --git a/assets/firmware/arduino/network_bridge/udpraw_serialadalight.py b/assets/firmware/arduino/network_bridge/udpraw_serialadalight.py index 2d49363d..5c6a2dfc 100755 --- a/assets/firmware/arduino/network_bridge/udpraw_serialadalight.py +++ b/assets/firmware/arduino/network_bridge/udpraw_serialadalight.py @@ -20,7 +20,6 @@ import sys import socket import serial import serial.threaded -import time class SerialToNet(serial.threaded.Protocol): diff --git a/assets/webconfig/content/about.html b/assets/webconfig/content/about.html index 03782f95..aaaf8a10 100644 --- a/assets/webconfig/content/about.html +++ b/assets/webconfig/content/about.html @@ -34,7 +34,7 @@ createTable("","atb","about_cont"); for(var i = 0; i