diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc263c7..487b066c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,9 @@ message(STATUS "ENABLE_X11 = " ${ENABLE_X11}) option(ENABLE_QT5 "Enable QT5" OFF) message(STATUS "ENABLE_QT5 = " ${ENABLE_QT5}) +option(ENABLE_TESTS "Compile additional test applications" OFF) +message(STATUS "ENABLE_TESTS = " ${ENABLE_TESTS}) + 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) @@ -59,19 +62,26 @@ if(ENABLE_OSX AND ENABLE_DISPMANX) message(FATAL_ERROR "dispmanx grabber and osx grabber cannot be used at the same time") endif(ENABLE_OSX AND ENABLE_DISPMANX) + +SET ( PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto ) +SET ( PROTOBUF_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/proto ) + #if(ENABLE_QT5) # TODO vs ENABLE_QT4? #endif(ENABLE_QT5) # Createt the configuration file + +# Add project specific cmake modules (find, etc) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +find_package(GitVersion) + # 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}") -# Add project specific cmake modules (find, etc) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - if(ENABLE_QT5) ADD_DEFINITIONS ( -DENABLE_QT5 ) #find_package(Qt5Widgets) @@ -136,7 +146,10 @@ configure_file(config/hyperion_x86.config.json ${LIBRARY_OUTPUT_PATH} @ONLY) add_subdirectory(dependencies) add_subdirectory(libsrc) add_subdirectory(src) -add_subdirectory(test) +if (ENABLE_TESTS) + add_subdirectory(test) +endif (ENABLE_TESTS) + # Add the doxygen generation directory add_subdirectory(doc) diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index 69147bb2..ddfff53c 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -30,3 +30,4 @@ // Define to enable the osx grabber #cmakedefine ENABLE_OSX +#define HYPERION_VERSION_ID "${HYPERION_VERSION_ID}" diff --git a/cmake/FindGitVersion.cmake b/cmake/FindGitVersion.cmake new file mode 100644 index 00000000..3ce5fe93 --- /dev/null +++ b/cmake/FindGitVersion.cmake @@ -0,0 +1,9 @@ + +execute_process( COMMAND git log -1 --format=%cn-%t/%h-%ct WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE BUILD_ID ERROR_QUIET ) +execute_process( COMMAND sh -c "git branch | grep '^*' | sed 's;^*;;g' " WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION_ID ERROR_QUIET ) + +STRING ( STRIP "${BUILD_ID}" BUILD_ID ) +STRING ( STRIP "${VERSION_ID}" VERSION_ID ) +SET ( HYPERION_VERSION_ID "${VERSION_ID} (${BUILD_ID}" ) +message ( STATUS "Current Version: ${HYPERION_VERSION_ID})" ) + diff --git a/src/hyperion-aml/CMakeLists.txt b/src/hyperion-aml/CMakeLists.txt index 9d365560..9445b3ec 100644 --- a/src/hyperion-aml/CMakeLists.txt +++ b/src/hyperion-aml/CMakeLists.txt @@ -50,8 +50,15 @@ target_link_libraries(${PROJECT_NAME} pthread ) +qt4_use_modules(${PROJECT_NAME} + Core + Gui + Network) + if(ENABLE_QT5) qt5_use_modules(${PROJECT_NAME} Widgets Core Gui Network) else(ENABLE_QT5) qt4_use_modules(${PROJECT_NAME} Core Gui Network ) endif(ENABLE_QT5) + +install ( TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) diff --git a/src/hyperion-aml/hyperion-aml.cpp b/src/hyperion-aml/hyperion-aml.cpp index 42870455..4932c0dc 100644 --- a/src/hyperion-aml/hyperion-aml.cpp +++ b/src/hyperion-aml/hyperion-aml.cpp @@ -10,6 +10,9 @@ #include #include "AmlogicWrapper.h" +#include "HyperionConfig.h" + + using namespace vlofgren; // save the image as screenshot @@ -22,6 +25,11 @@ void saveScreenshot(const char * filename, const Image & image) int main(int argc, char ** argv) { + std::cout + << "hyperion-aml:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; + QCoreApplication app(argc, argv); try diff --git a/src/hyperion-dispmanx/CMakeLists.txt b/src/hyperion-dispmanx/CMakeLists.txt index 6252943c..ae4c02d2 100644 --- a/src/hyperion-dispmanx/CMakeLists.txt +++ b/src/hyperion-dispmanx/CMakeLists.txt @@ -59,3 +59,6 @@ if(ENABLE_QT5) else(ENABLE_QT5) qt4_use_modules(${PROJECT_NAME} Core Gui Network ) endif(ENABLE_QT5) + + +install ( TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) diff --git a/src/hyperion-dispmanx/hyperion-dispmanx.cpp b/src/hyperion-dispmanx/hyperion-dispmanx.cpp index e5ebf429..6f1f66ad 100644 --- a/src/hyperion-dispmanx/hyperion-dispmanx.cpp +++ b/src/hyperion-dispmanx/hyperion-dispmanx.cpp @@ -9,6 +9,8 @@ #include #include "DispmanxWrapper.h" +#include "HyperionConfig.h" + using namespace vlofgren; // save the image as screenshot @@ -21,6 +23,11 @@ void saveScreenshot(const char * filename, const Image & image) int main(int argc, char ** argv) { + std::cout + << "hyperion-dispmanx:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; + QCoreApplication app(argc, argv); try diff --git a/src/hyperion-remote/CMakeLists.txt b/src/hyperion-remote/CMakeLists.txt index 3e36d2b2..36ca8cc2 100644 --- a/src/hyperion-remote/CMakeLists.txt +++ b/src/hyperion-remote/CMakeLists.txt @@ -41,3 +41,6 @@ if(ENABLE_QT5) else(ENABLE_QT5) qt4_use_modules(${PROJECT_NAME} Core Gui Network ) endif(ENABLE_QT5) + +install ( TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) + diff --git a/src/hyperion-remote/hyperion-remote.cpp b/src/hyperion-remote/hyperion-remote.cpp index 3636721f..42df87e9 100644 --- a/src/hyperion-remote/hyperion-remote.cpp +++ b/src/hyperion-remote/hyperion-remote.cpp @@ -13,6 +13,9 @@ #include "CustomParameter.h" #include "JsonConnection.h" +#include "HyperionConfig.h" + + using namespace vlofgren; /// Count the number of true values in a list of booleans @@ -28,6 +31,11 @@ int count(std::initializer_list values) int main(int argc, char * argv[]) { + std::cout + << "hyperion-remote:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; + QCoreApplication app(argc, argv); // force the locale diff --git a/src/hyperion-v4l2/CMakeLists.txt b/src/hyperion-v4l2/CMakeLists.txt index 22e512b2..ee1882a1 100644 --- a/src/hyperion-v4l2/CMakeLists.txt +++ b/src/hyperion-v4l2/CMakeLists.txt @@ -59,3 +59,6 @@ if(ENABLE_QT5) else(ENABLE_QT5) qt4_use_modules(${PROJECT_NAME} Core Gui Network ) endif(ENABLE_QT5) + + +install ( TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) diff --git a/src/hyperion-v4l2/hyperion-v4l2.cpp b/src/hyperion-v4l2/hyperion-v4l2.cpp index ed56dbb7..22add6c7 100644 --- a/src/hyperion-v4l2/hyperion-v4l2.cpp +++ b/src/hyperion-v4l2/hyperion-v4l2.cpp @@ -24,6 +24,8 @@ #include "PixelFormatParameter.h" #include "ScreenshotHandler.h" +#include "HyperionConfig.h" + using namespace vlofgren; // save the image as screenshot @@ -36,6 +38,11 @@ void saveScreenshot(void *, const Image & image) int main(int argc, char** argv) { + std::cout + << "hyperion-v4l2:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; + QCoreApplication app(argc, argv); // force the locale diff --git a/src/hyperion-x11/CMakeLists.txt b/src/hyperion-x11/CMakeLists.txt index 13e1e1a6..69744f4f 100644 --- a/src/hyperion-x11/CMakeLists.txt +++ b/src/hyperion-x11/CMakeLists.txt @@ -60,3 +60,5 @@ if(ENABLE_QT5) else(ENABLE_QT5) qt4_use_modules(${PROJECT_NAME} Core Gui Network ) endif(ENABLE_QT5) + +install ( TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) diff --git a/src/hyperion-x11/hyperion-x11.cpp b/src/hyperion-x11/hyperion-x11.cpp index 42853af1..776b3326 100644 --- a/src/hyperion-x11/hyperion-x11.cpp +++ b/src/hyperion-x11/hyperion-x11.cpp @@ -8,6 +8,7 @@ #include "protoserver/ProtoConnectionWrapper.h" #include "X11Wrapper.h" +#include "HyperionConfig.h" using namespace vlofgren; @@ -21,6 +22,11 @@ void saveScreenshot(const char * filename, const Image & image) int main(int argc, char ** argv) { + std::cout + << "hyperion-x11:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; + QCoreApplication app(argc, argv); try diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 70c2381b..5aef74d2 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -33,3 +33,5 @@ endif (ENABLE_AMLOGIC) if (ENABLE_PROTOBUF) target_link_libraries(hyperiond protoserver) endif (ENABLE_PROTOBUF) + +install ( TARGETS hyperiond DESTINATION "${CMAKE_SOURCE_DIR}/deploy/bin" ) diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 7f658e9d..6a883ea7 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -92,11 +92,13 @@ Json::Value loadConfig(const std::string & configFile) int main(int argc, char** argv) { - std::cout << "Application build time: " << __DATE__ << " " << __TIME__ << std::endl; + std::cout + << "Hyperiond:" << std::endl + << "\tversion : " << HYPERION_VERSION_ID << std::endl + << "\tbuild time: " << __DATE__ << " " << __TIME__ << std::endl; // Initialising QCoreApplication QCoreApplication app(argc, argv); - std::cout << "QCoreApplication initialised" << std::endl; signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler);