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)
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)

View File

@ -11,3 +11,6 @@
// Define to enable the spi-device
#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}")
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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -36,8 +36,10 @@
// JsonServer includes
#include <jsonserver/JsonServer.h>
#ifdef ENABLE_PROTOBUF
// ProtoServer includes
#include <protoserver/ProtoServer.h>
#endif
// BoblightServer includes
#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;
}
#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