From 265656cc358051e388594c0e2a0ed69102405215 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Mon, 8 Sep 2014 15:39:15 +0200 Subject: [PATCH 1/3] cmake: do not cache libusb library if libusb-1.0 headers not found Library found might be an older libusb version. Closes #158 Former-commit-id: 12783e1cfd3902954a9513ca1baf53433add742a --- cmake/Findlibusb-1.0.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Findlibusb-1.0.cmake b/cmake/Findlibusb-1.0.cmake index 26a82c4f..77474e9a 100644 --- a/cmake/Findlibusb-1.0.cmake +++ b/cmake/Findlibusb-1.0.cmake @@ -87,6 +87,7 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS) message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}") endif (NOT libusb_1_FIND_QUIETLY) else (LIBUSB_1_FOUND) + unset(LIBUSB_1_LIBRARY CACHE) if (libusb_1_FIND_REQUIRED) message(FATAL_ERROR "Could not find libusb") endif (libusb_1_FIND_REQUIRED) From 3c65b82ac1ee3b6c104cb0483f014e785681709a Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Mon, 8 Sep 2014 16:16:02 +0200 Subject: [PATCH 2/3] Allow disabling PROTOBUF support One dependency less for users that only use DISPMANX grabbing Former-commit-id: 24ea0480e3798bab692e75d82ddb9f5eccfa03c5 --- CMakeLists.txt | 21 ++++++++++----- HyperionConfig.h.in | 3 +++ libsrc/CMakeLists.txt | 34 ++++++++++++----------- src/hyperion-remote/CMakeLists.txt | 3 --- src/hyperiond/CMakeLists.txt | 43 ++++++++++++++++-------------- src/hyperiond/hyperiond.cpp | 6 +++++ 6 files changed, 66 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f4ff4f6..29c9476b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,13 @@ message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2}) option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON) message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE}) +option(ENABLE_PROTOBUF "Enable PROTOBUF server" ON) +message(STATUS "ENABLE_PROTOBUF = " ${ENABLE_PROTOBUF}) + +if (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF) + message(FATAL_ERROR "V4L2 grabber requires PROTOBUF. Disable V4L2 or enable PROTOBUF") +endif (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF) + # Createt the configuration file # configure a header file to pass some of the CMake settings # to the source code @@ -54,12 +61,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall") # Configure the use of QT4 find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET) -# add protocol buffers (make sure to find the static version) -set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -find_package(Protobuf REQUIRED) -set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) -set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) +if (ENABLE_PROTOBUF) + # add protocol buffers (make sure to find the static version) + set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + find_package(Protobuf REQUIRED) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) + set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) +endif (ENABLE_PROTOBUF) #add libusb and pthreads find_package(libusb-1.0 REQUIRED) diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index 17f040c0..ff2f4f82 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -11,3 +11,6 @@ // Define to enable the spi-device #cmakedefine ENABLE_TINKERFORGE + +// Define to enable PROTOBUF server +#cmakedefine ENABLE_PROTOBUF diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 62911dd7..680e7a53 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -1,15 +1,19 @@ - -# Define the current source locations -SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) -SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) - -add_subdirectory(hyperion) -add_subdirectory(blackborder) -add_subdirectory(jsonserver) -add_subdirectory(protoserver) -add_subdirectory(boblightserver) -add_subdirectory(leddevice) -add_subdirectory(utils) -add_subdirectory(xbmcvideochecker) -add_subdirectory(effectengine) -add_subdirectory(grabber) + +# Define the current source locations +SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) +SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc) + +add_subdirectory(hyperion) +add_subdirectory(blackborder) +add_subdirectory(jsonserver) + +if (ENABLE_PROTOBUF) + add_subdirectory(protoserver) +endif (ENABLE_PROTOBUF) + +add_subdirectory(boblightserver) +add_subdirectory(leddevice) +add_subdirectory(utils) +add_subdirectory(xbmcvideochecker) +add_subdirectory(effectengine) +add_subdirectory(grabber) diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index 676dc7d3..c934be21 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8) project(hyperion-remote) -# add protocol buffers -find_package(Protobuf REQUIRED) - # find Qt4 find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index f843b15f..49df4bfe 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -1,20 +1,23 @@ - -add_executable(hyperiond - hyperiond.cpp) - -target_link_libraries(hyperiond - hyperion - xbmcvideochecker - effectengine - jsonserver - protoserver - boblightserver -) - -if (ENABLE_DISPMANX) - target_link_libraries(hyperiond dispmanx-grabber) -endif (ENABLE_DISPMANX) - -if (ENABLE_V4L2) - target_link_libraries(hyperiond v4l2-grabber) -endif (ENABLE_V4L2) + +add_executable(hyperiond + hyperiond.cpp) + +target_link_libraries(hyperiond + hyperion + xbmcvideochecker + effectengine + jsonserver + boblightserver +) + +if (ENABLE_DISPMANX) + target_link_libraries(hyperiond dispmanx-grabber) +endif (ENABLE_DISPMANX) + +if (ENABLE_V4L2) + target_link_libraries(hyperiond v4l2-grabber) +endif (ENABLE_V4L2) + +if (ENABLE_PROTOBUF) + target_link_libraries(hyperiond protoserver) +endif (ENABLE_PROTOBUF) diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index b6365019..e7591343 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -36,8 +36,10 @@ // JsonServer includes #include +#ifdef ENABLE_PROTOBUF // ProtoServer includes #include +#endif // BoblightServer includes #include @@ -233,6 +235,7 @@ int main(int argc, char** argv) std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl; } +#ifdef ENABLE_PROTOBUF // Create Proto server if configuration is present ProtoServer * protoServer = nullptr; if (config.isMember("protoServer")) @@ -241,6 +244,7 @@ int main(int argc, char** argv) protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt()); std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl; } +#endif // Create Boblight server if configuration is present BoblightServer * boblightServer = nullptr; @@ -264,7 +268,9 @@ int main(int argc, char** argv) #endif delete xbmcVideoChecker; delete jsonServer; +#ifdef ENABLE_PROTOBUF delete protoServer; +#endif delete boblightServer; // leave application From 905f8565438480ea6676feba94cef1869e581d8a Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Mon, 8 Sep 2014 18:59:29 +0200 Subject: [PATCH 3/3] Fix linking with static Qt Embedded builds Make sure pthreads and dl get linked when building Hyperion using a static Qt Embedded library instead of Qt X11 Former-commit-id: d1e57e9192dfb6c3c42261a9ee57ebdc85bf03cd --- cmake/qt4/Qt4ConfigDependentSettings.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/qt4/Qt4ConfigDependentSettings.cmake b/cmake/qt4/Qt4ConfigDependentSettings.cmake index 6db5da18..6df28f47 100644 --- a/cmake/qt4/Qt4ConfigDependentSettings.cmake +++ b/cmake/qt4/Qt4ConfigDependentSettings.cmake @@ -270,6 +270,16 @@ if(Q_WS_X11) endif() +if(Q_WS_QWS) + set(CMAKE_THREAD_PREFER_PTHREADS 1) + find_package(Threads) + if(CMAKE_USE_PTHREADS_INIT) + set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) + endif() + + set (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS}) + +endif() if(Q_WS_WIN) set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm)