Added flag to disable dispmanx from build

Former-commit-id: 6630f588a739a08601c0db79abd2cdf0b1c1839c
This commit is contained in:
johan 2013-11-19 23:02:41 +01:00
parent adea0895c4
commit d60cca9e20
11 changed files with 47 additions and 10 deletions

View File

@ -1,9 +1,20 @@
project(hyperion)
# define the minimum cmake version (as required by cmake) # define the minimum cmake version (as required by cmake)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
#set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake) #set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake)
# set the build options
option (ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ON)
message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
# Createt the configuration file
# configure a header file to pass some of the CMake settings
# to the source code
configure_file ("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h")
include_directories("${PROJECT_BINARY_DIR}")
# Define the main-project name # Define the main-project name
project(Hyperion) project(Hyperion)
@ -37,8 +48,9 @@ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
# add protocol buffers # add protocol buffers
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
#add libusb #add libusb and pthreads
find_package(libusb-1.0 REQUIRED) find_package(libusb-1.0 REQUIRED)
find_package(Threads REQUIRED)
#SET(QT_DONT_USE_QTGUI TRUE) #SET(QT_DONT_USE_QTGUI TRUE)
#SET(QT_USE_QTCONSOLE TRUE) #SET(QT_USE_QTCONSOLE TRUE)

4
HyperionConfig.h.in Normal file
View File

@ -0,0 +1,4 @@
// Generated config file
// Define to enable the dispmanx grabber
#cmakedefine ENABLE_DISPMANX

Binary file not shown.

View File

@ -1 +1 @@
d59ae219a9dad5cd6138c23122df5e3313e473cb 5031f4b1d3a2682b6df94ba6671bcc97f9b5a4d1

View File

@ -4,10 +4,13 @@ SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
add_subdirectory(bootsequence) add_subdirectory(bootsequence)
add_subdirectory(dispmanx-grabber)
add_subdirectory(hyperion) add_subdirectory(hyperion)
add_subdirectory(jsonserver) add_subdirectory(jsonserver)
add_subdirectory(protoserver) add_subdirectory(protoserver)
add_subdirectory(boblightserver) add_subdirectory(boblightserver)
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(xbmcvideochecker) add_subdirectory(xbmcvideochecker)
if (ENABLE_DISPMANX)
add_subdirectory(dispmanx-grabber)
endif (ENABLE_DISPMANX)

View File

@ -24,7 +24,7 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
return new RainbowBootSequence(hyperion, duration_ms); return new RainbowBootSequence(hyperion, duration_ms);
} }
else if (type == "knightrider" || type == "knight rider") else if (type == "knightrider" || type == "knight rider" || "knight_rider")
{ {
std::cout << "SELECTED BOOT SEQUENCE: " << "KITT" << std::endl; std::cout << "SELECTED BOOT SEQUENCE: " << "KITT" << std::endl;
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
@ -34,5 +34,3 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons
std::cerr << "Unknown boot-sequence selected; boot-sequence disabled." << std::endl; std::cerr << "Unknown boot-sequence selected; boot-sequence disabled." << std::endl;
return nullptr; return nullptr;
} }

View File

@ -79,4 +79,5 @@ target_link_libraries(hyperion
hyperion-utils hyperion-utils
serialport serialport
${QT_LIBRARIES} ${QT_LIBRARIES}
${LIBUSB_1_LIBRARIES}) ${LIBUSB_1_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})

View File

@ -168,7 +168,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &message)
item["priority"] = priority; item["priority"] = priority;
if (priorityInfo.timeoutTime_ms != -1) if (priorityInfo.timeoutTime_ms != -1)
{ {
item["duration_ms"] = priorityInfo.timeoutTime_ms - now; item["duration_ms"] = Json::Value::UInt(priorityInfo.timeoutTime_ms - now);
} }
} }

View File

@ -5,8 +5,11 @@ add_executable(hyperiond
target_link_libraries(hyperiond target_link_libraries(hyperiond
bootsequence bootsequence
hyperion hyperion
dispmanx-grabber
xbmcvideochecker xbmcvideochecker
jsonserver jsonserver
protoserver protoserver
boblightserver) boblightserver)
if (ENABLE_DISPMANX)
target_link_libraries(hyperiond dispmanx-grabber)
endif (ENABLE_DISPMANX)

View File

@ -6,6 +6,9 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QResource> #include <QResource>
// config includes
#include "HyperionConfig.h"
// Json-Schema includes // Json-Schema includes
#include <utils/jsonschema/JsonFactory.h> #include <utils/jsonschema/JsonFactory.h>
@ -15,8 +18,10 @@
// Bootsequence includes // Bootsequence includes
#include <bootsequence/BootSequenceFactory.h> #include <bootsequence/BootSequenceFactory.h>
#ifdef ENABLE_DISPMANX
// Dispmanx grabber includes // Dispmanx grabber includes
#include <dispmanx-grabber/DispmanxWrapper.h> #include <dispmanx-grabber/DispmanxWrapper.h>
#endif
// XBMC Video checker includes // XBMC Video checker includes
#include <xbmcvideochecker/XBMCVideoChecker.h> #include <xbmcvideochecker/XBMCVideoChecker.h>
@ -118,6 +123,7 @@ int main(int argc, char** argv)
std::cout << "XBMC video checker created and started" << std::endl; std::cout << "XBMC video checker created and started" << std::endl;
} }
#ifdef ENABLE_DISPMANX
// Construct and start the frame-grabber if the configuration is present // Construct and start the frame-grabber if the configuration is present
DispmanxWrapper * dispmanx = nullptr; DispmanxWrapper * dispmanx = nullptr;
if (config.isMember("framegrabber")) if (config.isMember("framegrabber"))
@ -137,6 +143,12 @@ int main(int argc, char** argv)
dispmanx->start(); dispmanx->start();
std::cout << "Frame grabber created and started" << std::endl; std::cout << "Frame grabber created and started" << std::endl;
} }
#else
if (config.isMember("framegrabber"))
{
std::cerr << "The dispmanx framegrabber can not be instantiated, becuse it has been left out from the build" << std::endl;
}
#endif
// Create Json server if configuration is present // Create Json server if configuration is present
JsonServer * jsonServer = nullptr; JsonServer * jsonServer = nullptr;
@ -171,7 +183,9 @@ int main(int argc, char** argv)
// Delete all component // Delete all component
delete bootSequence; delete bootSequence;
#ifdef ENABLE_DISPMANX
delete dispmanx; delete dispmanx;
#endif
delete xbmcVideoChecker; delete xbmcVideoChecker;
delete jsonServer; delete jsonServer;
delete protoServer; delete protoServer;

View File

@ -27,7 +27,9 @@ add_executable(test_image2ledsmap
target_link_libraries(test_image2ledsmap target_link_libraries(test_image2ledsmap
hyperion) hyperion)
add_subdirectory(dispmanx2png) if (ENABLE_DISPMANX)
add_subdirectory(dispmanx2png)
endif (ENABLE_DISPMANX)
add_executable(test_blackborderdetector add_executable(test_blackborderdetector
TestBlackBorderDetector.cpp) TestBlackBorderDetector.cpp)