From d60cca9e208c9c5cafc9de8e0e4b47ac72e23270 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 19 Nov 2013 23:02:41 +0100 Subject: [PATCH] Added flag to disable dispmanx from build Former-commit-id: 6630f588a739a08601c0db79abd2cdf0b1c1839c --- CMakeLists.txt | 14 +++++++++++++- HyperionConfig.h.in | 4 ++++ deploy/hyperion-remote | Bin 244044 -> 244044 bytes deploy/hyperiond.REMOVED.git-id | 2 +- libsrc/CMakeLists.txt | 5 ++++- libsrc/bootsequence/BootSequenceFactory.cpp | 4 +--- libsrc/hyperion/CMakeLists.txt | 3 ++- libsrc/jsonserver/JsonClientConnection.cpp | 2 +- src/hyperiond/CMakeLists.txt | 5 ++++- src/hyperiond/hyperiond.cpp | 14 ++++++++++++++ test/CMakeLists.txt | 4 +++- 11 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 HyperionConfig.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index db0b2303..eaf2690b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,20 @@ +project(hyperion) # define the minimum cmake version (as required by cmake) cmake_minimum_required(VERSION 2.8) #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 project(Hyperion) @@ -37,8 +48,9 @@ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET) # add protocol buffers find_package(Protobuf REQUIRED) -#add libusb +#add libusb and pthreads find_package(libusb-1.0 REQUIRED) +find_package(Threads REQUIRED) #SET(QT_DONT_USE_QTGUI TRUE) #SET(QT_USE_QTCONSOLE TRUE) diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in new file mode 100644 index 00000000..875e1193 --- /dev/null +++ b/HyperionConfig.h.in @@ -0,0 +1,4 @@ +// Generated config file + +// Define to enable the dispmanx grabber +#cmakedefine ENABLE_DISPMANX diff --git a/deploy/hyperion-remote b/deploy/hyperion-remote index 8d8588d2ce3393fa604841d2eb9ddadb67f78cd6..e1720d47dc107d9bd4dfaf620527cf585efc76bf 100755 GIT binary patch delta 39 vcmX@}iSNuOzJ?aYElf*i@LMVv85kNf7#Ud^n^+kdw{Mxjw0+AA<{1hAE5Z%+ delta 39 vcmX@}iSNuOzJ?aYElf*i@Ea)@85kNf7#Ua@8Cn^cv~QWgw0+AA<{1hAD$fn- diff --git a/deploy/hyperiond.REMOVED.git-id b/deploy/hyperiond.REMOVED.git-id index f603c0d1..1eec85ee 100644 --- a/deploy/hyperiond.REMOVED.git-id +++ b/deploy/hyperiond.REMOVED.git-id @@ -1 +1 @@ -d59ae219a9dad5cd6138c23122df5e3313e473cb \ No newline at end of file +5031f4b1d3a2682b6df94ba6671bcc97f9b5a4d1 \ No newline at end of file diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index a6874d3a..d97e6368 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -4,10 +4,13 @@ SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) add_subdirectory(bootsequence) -add_subdirectory(dispmanx-grabber) add_subdirectory(hyperion) add_subdirectory(jsonserver) add_subdirectory(protoserver) add_subdirectory(boblightserver) add_subdirectory(utils) add_subdirectory(xbmcvideochecker) + +if (ENABLE_DISPMANX) + add_subdirectory(dispmanx-grabber) +endif (ENABLE_DISPMANX) diff --git a/libsrc/bootsequence/BootSequenceFactory.cpp b/libsrc/bootsequence/BootSequenceFactory.cpp index c7674657..7ad5ae6b 100644 --- a/libsrc/bootsequence/BootSequenceFactory.cpp +++ b/libsrc/bootsequence/BootSequenceFactory.cpp @@ -24,7 +24,7 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); 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; 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; return nullptr; } - - diff --git a/libsrc/hyperion/CMakeLists.txt b/libsrc/hyperion/CMakeLists.txt index 937a8906..f87438d6 100644 --- a/libsrc/hyperion/CMakeLists.txt +++ b/libsrc/hyperion/CMakeLists.txt @@ -79,4 +79,5 @@ target_link_libraries(hyperion hyperion-utils serialport ${QT_LIBRARIES} - ${LIBUSB_1_LIBRARIES}) + ${LIBUSB_1_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/libsrc/jsonserver/JsonClientConnection.cpp b/libsrc/jsonserver/JsonClientConnection.cpp index 4af1b4dd..1c99b13d 100644 --- a/libsrc/jsonserver/JsonClientConnection.cpp +++ b/libsrc/jsonserver/JsonClientConnection.cpp @@ -168,7 +168,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &message) item["priority"] = priority; if (priorityInfo.timeoutTime_ms != -1) { - item["duration_ms"] = priorityInfo.timeoutTime_ms - now; + item["duration_ms"] = Json::Value::UInt(priorityInfo.timeoutTime_ms - now); } } diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 2f75e10b..646a8575 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -5,8 +5,11 @@ add_executable(hyperiond target_link_libraries(hyperiond bootsequence hyperion - dispmanx-grabber xbmcvideochecker jsonserver protoserver boblightserver) + +if (ENABLE_DISPMANX) + target_link_libraries(hyperiond dispmanx-grabber) +endif (ENABLE_DISPMANX) diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 4f62ada8..bc789691 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -6,6 +6,9 @@ #include #include +// config includes +#include "HyperionConfig.h" + // Json-Schema includes #include @@ -15,8 +18,10 @@ // Bootsequence includes #include +#ifdef ENABLE_DISPMANX // Dispmanx grabber includes #include +#endif // XBMC Video checker includes #include @@ -118,6 +123,7 @@ int main(int argc, char** argv) std::cout << "XBMC video checker created and started" << std::endl; } +#ifdef ENABLE_DISPMANX // Construct and start the frame-grabber if the configuration is present DispmanxWrapper * dispmanx = nullptr; if (config.isMember("framegrabber")) @@ -137,6 +143,12 @@ int main(int argc, char** argv) dispmanx->start(); 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 JsonServer * jsonServer = nullptr; @@ -171,7 +183,9 @@ int main(int argc, char** argv) // Delete all component delete bootSequence; +#ifdef ENABLE_DISPMANX delete dispmanx; +#endif delete xbmcVideoChecker; delete jsonServer; delete protoServer; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35f7a65b..5e2844e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,9 @@ add_executable(test_image2ledsmap target_link_libraries(test_image2ledsmap hyperion) -add_subdirectory(dispmanx2png) +if (ENABLE_DISPMANX) + add_subdirectory(dispmanx2png) +endif (ENABLE_DISPMANX) add_executable(test_blackborderdetector TestBlackBorderDetector.cpp)