platform cleanup and cmake osx fix (#294)

* rename platform rpi-pwm to rpi. remove original rpi platform
install symlink to bin folder
create effects folder for custom effects

* fix osx jobs evaluation
This commit is contained in:
redPanther 2016-11-20 22:57:19 +01:00 committed by GitHub
parent 8f67294de6
commit 9e5903e1aa
13 changed files with 131 additions and 68 deletions

View File

@ -1,18 +1,20 @@
#!/bin/bash
# for executing in non travis environment
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr 'A-Z' 'a-z')"
PLATFORM=x86
BUILD_TYPE=Debug
# Detect number of processor cores
if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]]; then
procs=$(sysctl -n hw.ncpu | xargs)
elif [[ $TRAVIS_OS_NAME == 'linux' ]]; then
procs=$(nproc)
else
# For most modern systems, including the pi, this is a sane default
procs=4
# 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
# compile prepare
@ -20,24 +22,21 @@ mkdir build || exit 1
cd build
# Compile hyperion for tags
if [[ -n $TRAVIS_TAG ]]; then
cmake -DPLATFORM=x86 -DCMAKE_BUILD_TYPE=Release .. || exit 2
make -j$(nproc) || exit 3
[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release
# Compile hyperion for cron
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]]; then
cmake -DPLATFORM=x86 -DCMAKE_BUILD_TYPE=Debug .. || exit 4
make -j$(nproc) || exit 5
# Compile hyperion for cron - take default settings
# Compile for PR
else
cmake -DPLATFORM=x86-dev -DCMAKE_BUILD_TYPE=Debug .. || exit 6
make -j$(nproc) || exit 7
fi
# Compile for PR (no tag and no cron)
[ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
echo "compile jobs: ${JOBS:=4}"
make -j ${JOBS} || exit 3
# Build the package on Linux
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
make -j$(nproc) package || exit 8
if [[ $TRAVIS_OS_NAME == 'linux' ]]
then
make -j ${JOBS} package || exit 4
fi

View File

@ -23,7 +23,6 @@ SET ( DEFAULT_FB ON )
SET ( DEFAULT_OSX OFF )
SET ( DEFAULT_X11 OFF )
SET ( DEFAULT_SPIDEV ON )
SET ( DEFAULT_WS2812BPWM OFF )
SET ( DEFAULT_WS281XPWM OFF )
SET ( DEFAULT_V4L2 ON )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
@ -31,55 +30,34 @@ SET ( DEFAULT_USE_AVAHI_LIBS ON )
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF )
SET ( DEFAULT_TESTS OFF )
if (APPLE)
SET( PLATFORM "osx")
endif()
if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x86")
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" )
SET( PLATFORM "rpi")
EXEC_PROGRAM( "nproc" OUTPUT_VARIABLE SYSTEM_CPU_CORES )
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" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
elseif ( ("${SYSTEM_CPUINFO}" MATCHES "amlogic" OR "${SYSTEM_CPUINFO}" MATCHES "ODROID-C2") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
SET( PLATFORM "amlogic64" )
elseif( SYSTEM_CPU_CORES GREATER 1 AND "${SYSTEM_CPUINFO}" MATCHES "bcm" )
SET( PLATFORM "rpi-pwm" )
endif()
endif()
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=<rpi|pri-pwm|amlogic|amlogic64|x86>")
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|amlogic|amlogic64|x86|x86-dev|osx|osx-dev>")
endif()
endif()
if ( "${PLATFORM}" STREQUAL "rpi" )
SET ( DEFAULT_DISPMANX ON )
elseif ( "${PLATFORM}" STREQUAL "rpi-pwm" )
SET ( DEFAULT_DISPMANX ON )
SET ( DEFAULT_WS2812BPWM ON )
SET ( DEFAULT_WS281XPWM ON )
elseif ( "${PLATFORM}" STREQUAL "wetek" OR "${PLATFORM}" STREQUAL "amlogic" )
SET ( DEFAULT_AMLOGIC ON )
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
SET ( DEFAULT_AMLOGIC ON )
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS ON )
elseif ( "${PLATFORM}" STREQUAL "x86" )
SET ( DEFAULT_X11 ON )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
elseif ( "${PLATFORM}" STREQUAL "x86-dev" )
SET ( DEFAULT_X11 ON )
SET ( DEFAULT_AMLOGIC ON)
SET ( DEFAULT_WS281XPWM ON )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
SET ( DEFAULT_TESTS ON )
elseif ( "${PLATFORM}" STREQUAL "imx6" )
SET ( DEFAULT_FB ON )
endif()
message( STATUS "PLATFORM: ${PLATFORM}")
if (APPLE)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5")
if ( "${PLATFORM}" MATCHES "osx" )
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5" CACHE STRING "path to your QT5 files" )
include_directories("/opt/X11/include/")
SET ( DEFAULT_OSX ON )
SET ( DEFAULT_V4L2 OFF )
@ -88,43 +66,66 @@ if (APPLE)
SET ( DEFAULT_WS281XPWM OFF )
SET ( DEFAULT_USE_AVAHI_LIBS OFF )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
endif ()
elseif ( "${PLATFORM}" STREQUAL "rpi" )
SET ( DEFAULT_DISPMANX ON )
SET ( DEFAULT_WS281XPWM ON )
elseif ( "${PLATFORM}" STREQUAL "amlogic" )
SET ( DEFAULT_AMLOGIC ON )
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
SET ( DEFAULT_AMLOGIC ON )
SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS ON )
elseif ( "${PLATFORM}" MATCHES "x86" )
SET ( DEFAULT_X11 ON )
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
if ( "${PLATFORM}" STREQUAL "x86-dev" )
SET ( DEFAULT_AMLOGIC ON)
SET ( DEFAULT_WS281XPWM ON )
endif()
elseif ( "${PLATFORM}" STREQUAL "imx6" )
SET ( DEFAULT_FB ON )
endif()
# enable tests for -dev builds
if ( "${PLATFORM}" MATCHES "-dev" )
SET ( DEFAULT_TESTS ON )
endif()
# set the build options
option(ENABLE_AMLOGIC "Enable the AMLOGIC video grabber" ${DEFAULT_AMLOGIC} )
message(STATUS "ENABLE_AMLOGIC = " ${ENABLE_AMLOGIC})
message(STATUS "ENABLE_AMLOGIC = ${ENABLE_AMLOGIC}")
option(ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ${DEFAULT_DISPMANX} )
message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
message(STATUS "ENABLE_DISPMANX = ${ENABLE_DISPMANX}")
option(ENABLE_FB "Enable the framebuffer grabber" ${DEFAULT_FB} )
message(STATUS "ENABLE_FB = " ${ENABLE_FB})
message(STATUS "ENABLE_FB = ${ENABLE_FB}")
option(ENABLE_OSX "Enable the osx grabber" ${DEFAULT_OSX} )
message(STATUS "ENABLE_OSX = " ${ENABLE_OSX})
message(STATUS "ENABLE_OSX = ${ENABLE_OSX}")
option(ENABLE_SPIDEV "Enable the SPIDEV device" ${DEFAULT_SPIDEV} )
message(STATUS "ENABLE_SPIDEV = " ${ENABLE_SPIDEV})
message(STATUS "ENABLE_SPIDEV = ${ENABLE_SPIDEV}")
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE})
message(STATUS "ENABLE_TINKERFORGE = ${ENABLE_TINKERFORGE}")
option(ENABLE_V4L2 "Enable the V4L2 grabber" ${DEFAULT_V4L2})
message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
message(STATUS "ENABLE_V4L2 = ${ENABLE_V4L2}")
option(ENABLE_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_WS281XPWM} )
message(STATUS "ENABLE_WS281XPWM = " ${ENABLE_WS281XPWM})
message(STATUS "ENABLE_WS281XPWM = ${ENABLE_WS281XPWM}")
option(ENABLE_X11 "Enable the X11 grabber" ${DEFAULT_X11})
message(STATUS "ENABLE_X11 = " ${ENABLE_X11})
message(STATUS "ENABLE_X11 = ${ENABLE_X11}")
SET(ENABLE_QT5 ON)
option(ENABLE_TESTS "Compile additional test applications" ${DEFAULT_TESTS})
message(STATUS "ENABLE_TESTS = " ${ENABLE_TESTS})
message(STATUS "ENABLE_TESTS = ${ENABLE_TESTS}")
option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF)
message(STATUS "ENABLE_PROFILER = " ${ENABLE_PROFILER})
message(STATUS "ENABLE_PROFILER = ${ENABLE_PROFILER}")
SET ( PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto )
@ -171,6 +172,7 @@ else()
message(STATUS "No support for C++11 detected. Compilation will most likely fail on your compiler")
endif()
# add QT5 dependency
SET(QT_MIN_VERSION "5.2.0")
find_package(Qt5 COMPONENTS Core Gui Network REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
@ -180,7 +182,7 @@ IF ( "${Qt5Core_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" )
ENDIF()
#add libusb and pthreads
# Add libusb and pthreads
find_package(libusb-1.0 REQUIRED)
find_package(Threads REQUIRED)
add_definitions(${QT_DEFINITIONS})

View File

@ -27,7 +27,7 @@ CMAKE_PROTOC_FLAG="-DIMPORT_PROTOC=../build-x86x64/protoc_export.cmake"
make_release x86x64 x86
#make_release x32 x86 ${CMAKE_PROTOC_FLAG}
make_release rpi rpi-pwm -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG}
make_release rpi rpi -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG}
make_release wetek wetek -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-rpi.cmake" ${CMAKE_PROTOC_FLAG}
#make_release imx6 imx6 -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-imx6.cmake" ${CMAKE_PROTOC_FLAG}

11
effects/readme.txt Normal file
View File

@ -0,0 +1,11 @@
This folder is for your personal effects.
If you want to modify effect parameters only, use the effect configurator from the webinterface.
If you want to develop your own effects, place python and json files here.
If you need examples or want to modify python file for hyperion included effect- You can export the included effects:
hyperiond --export-effects <existing path to export>
e.g.
hyperiond --export-effects /usr/share/hyperion/effects

View File

@ -42,3 +42,9 @@ target_link_libraries(${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -44,3 +44,9 @@ target_link_libraries( ${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -42,3 +42,9 @@ target_link_libraries( ${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -42,3 +42,9 @@ target_link_libraries( ${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -33,3 +33,9 @@ target_link_libraries(${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Gui Core Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -45,3 +45,9 @@ target_link_libraries(${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -45,3 +45,9 @@ target_link_libraries(${PROJECT_NAME}
qt5_use_modules(${PROJECT_NAME} Core Gui Network)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "${PLATFORM}" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -41,3 +41,11 @@ endif ()
install ( TARGETS hyperiond DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT "${PLATFORM}" )
install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "share/hyperion/effects" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/hyperiond\" \"${CMAKE_BINARY_DIR}/symlink_hyperiond\" )" COMPONENT "${PLATFORM}" )
install(FILES ${CMAKE_BINARY_DIR}/symlink_hyperiond DESTINATION "bin" RENAME hyperiond COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_hyperiond )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)

View File

@ -78,7 +78,7 @@ int main(int argc, char** argv)
Option & exportConfigOption = parser.add<Option> (0x0, "export-config", "export default config to file");
Option & exportEfxOption = parser.add<Option> (0x0, "export-effects", "export effects to given path");
parser.addPositionalArgument("config-files", QCoreApplication::translate("main", "Configuration files"), "[files...]");
parser.addPositionalArgument("config-files", QCoreApplication::translate("main", "Configuration file"), "config.file");
parser.process(app);
@ -186,6 +186,7 @@ int main(int argc, char** argv)
if (configFiles.size() == 0)
{
Error(log, "Missing required configuration file. Usage: hyperiond <options ...> config.file");
parser.showHelp(0);
return 1;
}
if (configFiles.size() > 1)