Merge pull request #159 from maxnet/master

Misc build improvements

Former-commit-id: fef34df57ee5ee9a26a2785215a85b1abf357721
This commit is contained in:
tvdzwan 2014-09-18 16:56:10 +02:00
commit d3211bb9d2
8 changed files with 77 additions and 44 deletions

View File

@ -19,6 +19,13 @@ message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON) option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE}) 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 # Createt the configuration file
# configure a header file to pass some of the CMake settings # configure a header file to pass some of the CMake settings
# to the source code # to the source code
@ -54,12 +61,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
# Configure the use of QT4 # Configure the use of QT4
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET) find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
# add protocol buffers (make sure to find the static version) if (ENABLE_PROTOBUF)
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) # add protocol buffers (make sure to find the static version)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
find_package(Protobuf REQUIRED) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) find_package(Protobuf REQUIRED)
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
endif (ENABLE_PROTOBUF)
#add libusb and pthreads #add libusb and pthreads
find_package(libusb-1.0 REQUIRED) find_package(libusb-1.0 REQUIRED)

View File

@ -11,3 +11,6 @@
// Define to enable the spi-device // Define to enable the spi-device
#cmakedefine ENABLE_TINKERFORGE #cmakedefine ENABLE_TINKERFORGE
// Define to enable PROTOBUF server
#cmakedefine ENABLE_PROTOBUF

View File

@ -87,6 +87,7 @@ else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}") message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
endif (NOT libusb_1_FIND_QUIETLY) endif (NOT libusb_1_FIND_QUIETLY)
else (LIBUSB_1_FOUND) else (LIBUSB_1_FOUND)
unset(LIBUSB_1_LIBRARY CACHE)
if (libusb_1_FIND_REQUIRED) if (libusb_1_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libusb") message(FATAL_ERROR "Could not find libusb")
endif (libusb_1_FIND_REQUIRED) endif (libusb_1_FIND_REQUIRED)

View File

@ -270,6 +270,16 @@ if(Q_WS_X11)
endif() 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) if(Q_WS_WIN)
set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm)

View File

@ -1,15 +1,19 @@
# Define the current source locations # Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) 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(hyperion) add_subdirectory(hyperion)
add_subdirectory(blackborder) add_subdirectory(blackborder)
add_subdirectory(jsonserver) add_subdirectory(jsonserver)
add_subdirectory(protoserver)
add_subdirectory(boblightserver) if (ENABLE_PROTOBUF)
add_subdirectory(leddevice) add_subdirectory(protoserver)
add_subdirectory(utils) endif (ENABLE_PROTOBUF)
add_subdirectory(xbmcvideochecker)
add_subdirectory(effectengine) add_subdirectory(boblightserver)
add_subdirectory(grabber) add_subdirectory(leddevice)
add_subdirectory(utils)
add_subdirectory(xbmcvideochecker)
add_subdirectory(effectengine)
add_subdirectory(grabber)

View File

@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8)
project(hyperion-remote) project(hyperion-remote)
# add protocol buffers
find_package(Protobuf REQUIRED)
# find Qt4 # find Qt4
find_package(Qt4 REQUIRED QtCore QtGui QtNetwork) find_package(Qt4 REQUIRED QtCore QtGui QtNetwork)

View File

@ -1,20 +1,23 @@
add_executable(hyperiond add_executable(hyperiond
hyperiond.cpp) hyperiond.cpp)
target_link_libraries(hyperiond target_link_libraries(hyperiond
hyperion hyperion
xbmcvideochecker xbmcvideochecker
effectengine effectengine
jsonserver jsonserver
protoserver boblightserver
boblightserver )
)
if (ENABLE_DISPMANX)
if (ENABLE_DISPMANX) target_link_libraries(hyperiond dispmanx-grabber)
target_link_libraries(hyperiond dispmanx-grabber) endif (ENABLE_DISPMANX)
endif (ENABLE_DISPMANX)
if (ENABLE_V4L2)
if (ENABLE_V4L2) target_link_libraries(hyperiond v4l2-grabber)
target_link_libraries(hyperiond v4l2-grabber) endif (ENABLE_V4L2)
endif (ENABLE_V4L2)
if (ENABLE_PROTOBUF)
target_link_libraries(hyperiond protoserver)
endif (ENABLE_PROTOBUF)

View File

@ -36,8 +36,10 @@
// JsonServer includes // JsonServer includes
#include <jsonserver/JsonServer.h> #include <jsonserver/JsonServer.h>
#ifdef ENABLE_PROTOBUF
// ProtoServer includes // ProtoServer includes
#include <protoserver/ProtoServer.h> #include <protoserver/ProtoServer.h>
#endif
// BoblightServer includes // BoblightServer includes
#include <boblightserver/BoblightServer.h> #include <boblightserver/BoblightServer.h>
@ -233,6 +235,7 @@ int main(int argc, char** argv)
std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl; std::cout << "Json server created and started on port " << jsonServer->getPort() << std::endl;
} }
#ifdef ENABLE_PROTOBUF
// Create Proto server if configuration is present // Create Proto server if configuration is present
ProtoServer * protoServer = nullptr; ProtoServer * protoServer = nullptr;
if (config.isMember("protoServer")) if (config.isMember("protoServer"))
@ -241,6 +244,7 @@ int main(int argc, char** argv)
protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt()); protoServer = new ProtoServer(&hyperion, protoServerConfig["port"].asUInt());
std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl; std::cout << "Proto server created and started on port " << protoServer->getPort() << std::endl;
} }
#endif
// Create Boblight server if configuration is present // Create Boblight server if configuration is present
BoblightServer * boblightServer = nullptr; BoblightServer * boblightServer = nullptr;
@ -264,7 +268,9 @@ int main(int argc, char** argv)
#endif #endif
delete xbmcVideoChecker; delete xbmcVideoChecker;
delete jsonServer; delete jsonServer;
#ifdef ENABLE_PROTOBUF
delete protoServer; delete protoServer;
#endif
delete boblightServer; delete boblightServer;
// leave application // leave application