2013-11-22 14:42:02 +01:00
|
|
|
# Define the main-project name
|
2016-05-24 19:56:43 +02:00
|
|
|
project(hyperion)
|
2013-07-26 22:38:34 +02:00
|
|
|
|
|
|
|
# define the minimum cmake version (as required by cmake)
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2013-08-11 13:13:19 +02:00
|
|
|
|
2016-06-04 19:26:34 +02:00
|
|
|
IF ( POLICY CMP0026 )
|
|
|
|
CMAKE_POLICY( SET CMP0026 OLD )
|
|
|
|
ENDIF()
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-07-04 00:43:41 +02:00
|
|
|
IF ( POLICY CMP0043 )
|
|
|
|
CMAKE_POLICY( SET CMP0043 OLD )
|
|
|
|
ENDIF()
|
|
|
|
|
2016-06-24 23:22:31 +02:00
|
|
|
SET ( HYPERION_VERSION_STABLE OFF )
|
|
|
|
SET ( HYPERION_VERSION_MAJOR 2 )
|
|
|
|
SET ( HYPERION_VERSION_MINOR 0 )
|
|
|
|
SET ( HYPERION_VERSION_PATCH 0 )
|
2016-05-22 13:00:06 +02:00
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
SET ( DEFAULT_AMLOGIC OFF )
|
|
|
|
SET ( DEFAULT_DISPMANX OFF )
|
2016-07-24 15:18:34 +02:00
|
|
|
SET ( DEFAULT_FB ON )
|
2016-05-22 00:27:06 +02:00
|
|
|
SET ( DEFAULT_OSX OFF )
|
|
|
|
SET ( DEFAULT_X11 OFF )
|
2016-07-24 15:18:34 +02:00
|
|
|
SET ( DEFAULT_SPIDEV ON )
|
2016-05-22 00:27:06 +02:00
|
|
|
SET ( DEFAULT_WS2812BPWM OFF )
|
|
|
|
SET ( DEFAULT_WS281XPWM OFF )
|
2016-07-05 18:19:58 +02:00
|
|
|
SET ( DEFAULT_V4L2 ON )
|
2016-06-23 19:56:50 +02:00
|
|
|
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
|
2016-08-07 18:39:45 +02:00
|
|
|
SET ( DEFAULT_USE_AVAHI_LIBS ON )
|
2016-07-20 16:04:56 +02:00
|
|
|
SET ( DEFAULT_TESTS OFF )
|
2016-05-22 00:27:06 +02:00
|
|
|
|
2016-08-28 15:10:43 +02:00
|
|
|
if ( NOT DEFINED PLATFORM )
|
|
|
|
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
|
|
|
|
SET( PLATFORM "x86")
|
|
|
|
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" )
|
|
|
|
SET( PLATFORM "rpi")
|
|
|
|
EXEC_PROGRAM( "nproc" OUTPUT_VARIABLE SYSTEM_CPU_CORES )
|
|
|
|
FILE( READ /proc/cpuinfo SYSTEM_CPUINFO )
|
|
|
|
STRING ( TOLOWER "${SYSTEM_CPUINFO}" SYSTEM_CPUINFO )
|
|
|
|
if ( "${SYSTEM_CPUINFO}" MATCHES "amlogic" )
|
|
|
|
SET( PLATFORM "wetek" )
|
|
|
|
elseif( SYSTEM_CPU_CORES GREATER 1 AND "${SYSTEM_CPUINFO}" MATCHES "bcm" )
|
|
|
|
SET( PLATFORM "rpi-pwm" )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if ( PLATFORM )
|
|
|
|
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
|
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|pri-pwm|wetek|x86>")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if ( "${PLATFORM}" STREQUAL "rpi" )
|
|
|
|
SET ( DEFAULT_DISPMANX ON )
|
|
|
|
elseif ( "${PLATFORM}" STREQUAL "rpi-pwm" )
|
|
|
|
SET ( DEFAULT_DISPMANX ON )
|
|
|
|
SET ( DEFAULT_WS2812BPWM ON )
|
|
|
|
SET ( DEFAULT_WS281XPWM ON )
|
|
|
|
elseif ( "${PLATFORM}" STREQUAL "wetek" )
|
|
|
|
SET ( DEFAULT_AMLOGIC ON )
|
|
|
|
elseif ( "${PLATFORM}" STREQUAL "x86" )
|
|
|
|
SET ( DEFAULT_X11 ON )
|
|
|
|
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
|
|
|
elseif ( "${PLATFORM}" STREQUAL "x86-dev" )
|
|
|
|
SET ( DEFAULT_X11 ON )
|
|
|
|
SET ( DEFAULT_AMLOGIC ON)
|
|
|
|
SET ( DEFAULT_WS281XPWM ON )
|
|
|
|
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON )
|
|
|
|
SET ( DEFAULT_TESTS ON )
|
|
|
|
elseif ( "${PLATFORM}" STREQUAL "imx6" )
|
|
|
|
SET ( DEFAULT_FB ON )
|
|
|
|
endif()
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
if (APPLE)
|
2016-08-28 15:10:43 +02:00
|
|
|
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/qt5")
|
|
|
|
include_directories("/opt/X11/include/")
|
2016-07-24 15:18:34 +02:00
|
|
|
SET ( DEFAULT_OSX ON )
|
2016-08-28 15:10:43 +02:00
|
|
|
SET ( DEFAULT_V4L2 OFF )
|
2016-07-24 15:18:34 +02:00
|
|
|
SET ( DEFAULT_SPIDEV OFF )
|
|
|
|
SET ( DEFAULT_FB OFF )
|
2016-08-28 15:10:43 +02:00
|
|
|
SET ( DEFAULT_WS281XPWM OFF )
|
|
|
|
SET ( DEFAULT_USE_AVAHI_LIBS OFF )
|
|
|
|
SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF )
|
2016-05-22 00:27:06 +02:00
|
|
|
endif ()
|
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
# set the build options
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_AMLOGIC "Enable the AMLOGIC video grabber" ${DEFAULT_AMLOGIC} )
|
2015-08-07 14:37:41 +02:00
|
|
|
message(STATUS "ENABLE_AMLOGIC = " ${ENABLE_AMLOGIC})
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ${DEFAULT_DISPMANX} )
|
2013-11-19 23:02:41 +01:00
|
|
|
message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
|
2014-01-28 09:47:16 +01:00
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_FB "Enable the framebuffer grabber" ${DEFAULT_FB} )
|
2015-08-07 14:37:41 +02:00
|
|
|
message(STATUS "ENABLE_FB = " ${ENABLE_FB})
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_OSX "Enable the osx grabber" ${DEFAULT_OSX} )
|
2015-08-07 14:37:41 +02:00
|
|
|
message(STATUS "ENABLE_OSX = " ${ENABLE_OSX})
|
|
|
|
|
2016-05-24 19:56:43 +02:00
|
|
|
option(ENABLE_SPIDEV "Enable the SPIDEV device" ${DEFAULT_SPIDEV} )
|
2013-12-17 22:53:16 +01:00
|
|
|
message(STATUS "ENABLE_SPIDEV = " ${ENABLE_SPIDEV})
|
2013-11-19 23:02:41 +01:00
|
|
|
|
2015-08-07 14:37:41 +02:00
|
|
|
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
|
|
|
|
message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE})
|
2014-09-19 16:37:58 +02:00
|
|
|
|
2016-06-28 21:53:19 +02:00
|
|
|
option(ENABLE_V4L2 "Enable the V4L2 grabber" ${DEFAULT_V4L2})
|
2014-01-04 13:24:05 +01:00
|
|
|
message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_WS2812BPWM "Enable the WS2812b-PWM device" ${DEFAULT_WS2812BPWM} )
|
2015-08-07 14:37:41 +02:00
|
|
|
message(STATUS "ENABLE_WS2812BPWM = " ${ENABLE_WS2812BPWM})
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_WS281XPWM "Enable the WS281x-PWM device" ${DEFAULT_WS281XPWM} )
|
2016-03-04 09:07:02 +01:00
|
|
|
message(STATUS "ENABLE_WS281XPWM = " ${ENABLE_WS281XPWM})
|
|
|
|
|
2016-05-22 00:27:06 +02:00
|
|
|
option(ENABLE_X11 "Enable the X11 grabber" ${DEFAULT_X11})
|
2014-01-28 09:47:16 +01:00
|
|
|
message(STATUS "ENABLE_X11 = " ${ENABLE_X11})
|
|
|
|
|
2016-06-17 01:25:40 +02:00
|
|
|
SET(ENABLE_QT5 ON)
|
2016-01-06 17:31:23 +01:00
|
|
|
|
2016-07-20 16:04:56 +02:00
|
|
|
option(ENABLE_TESTS "Compile additional test applications" ${DEFAULT_TESTS})
|
2016-03-10 12:06:03 +01:00
|
|
|
message(STATUS "ENABLE_TESTS = " ${ENABLE_TESTS})
|
|
|
|
|
2016-06-05 16:08:55 +02:00
|
|
|
option(ENABLE_PROFILER "enable profiler capabilities - not for release code" OFF)
|
|
|
|
message(STATUS "ENABLE_PROFILER = " ${ENABLE_PROFILER})
|
|
|
|
|
2014-09-08 16:16:02 +02:00
|
|
|
|
2016-03-10 17:11:02 +01:00
|
|
|
SET ( PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto )
|
|
|
|
SET ( PROTOBUF_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/proto )
|
2016-03-10 12:22:44 +01:00
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
# Createt the configuration file
|
2016-03-10 06:53:21 +01:00
|
|
|
|
|
|
|
# Add project specific cmake modules (find, etc)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
|
|
|
|
find_package(GitVersion)
|
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
# configure a header file to pass some of the CMake settings
|
|
|
|
# to the source code
|
2014-02-07 09:20:00 +01:00
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/HyperionConfig.h.in" "${PROJECT_BINARY_DIR}/HyperionConfig.h")
|
2013-11-19 23:02:41 +01:00
|
|
|
include_directories("${PROJECT_BINARY_DIR}")
|
|
|
|
|
2013-07-26 22:38:34 +02:00
|
|
|
|
|
|
|
# Define the global output path of binaries
|
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
|
|
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
2016-05-24 19:56:43 +02:00
|
|
|
|
2013-07-26 22:38:34 +02:00
|
|
|
file(MAKE_DIRECTORY ${LIBRARY_OUTPUT_PATH})
|
|
|
|
file(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
|
|
|
|
|
|
|
# Add the project include directory as additional include path
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/dependencies/include)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
|
|
|
|
|
|
|
# Prefer static linking over dynamic
|
2013-11-30 16:53:14 +01:00
|
|
|
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
|
2013-07-26 22:38:34 +02:00
|
|
|
|
|
|
|
# enable C++11
|
2016-08-28 15:10:43 +02:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
if(COMPILER_SUPPORTS_CXX11)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
|
|
elseif(COMPILER_SUPPORTS_CXX0X)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
|
|
else()
|
|
|
|
message(STATUS "No support for C++11 detected. Compilation will most likely fail on your compiler")
|
|
|
|
endif()
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-06-23 19:56:50 +02:00
|
|
|
SET(QT_MIN_VERSION "5.2.0")
|
|
|
|
find_package(Qt5 COMPONENTS Core Gui Network REQUIRED)
|
2016-06-17 01:25:40 +02:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
2016-06-23 19:56:50 +02:00
|
|
|
message( STATUS "Found Qt Version: ${Qt5Core_VERSION}" )
|
|
|
|
IF ( "${Qt5Core_VERSION}" VERSION_LESS "${QT_MIN_VERSION}" )
|
|
|
|
message( FATAL_ERROR "Your Qt version is to old! Minimum required ${QT_MIN_VERSION}" )
|
|
|
|
ENDIF()
|
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
#add libusb and pthreads
|
2013-11-13 20:15:53 +01:00
|
|
|
find_package(libusb-1.0 REQUIRED)
|
2013-11-19 23:02:41 +01:00
|
|
|
find_package(Threads REQUIRED)
|
2016-06-17 01:25:40 +02:00
|
|
|
add_definitions(${QT_DEFINITIONS})
|
2016-01-06 17:31:23 +01:00
|
|
|
|
2013-12-17 22:53:16 +01:00
|
|
|
# TODO[TvdZ]: This linking directory should only be added if we are cross compiling
|
|
|
|
if(NOT APPLE)
|
|
|
|
link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)
|
|
|
|
endif()
|
2013-08-13 11:10:45 +02:00
|
|
|
|
2015-01-24 23:42:22 +01:00
|
|
|
if(ENABLE_OSX)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreGraphics")
|
|
|
|
endif()
|
|
|
|
|
2013-07-26 22:38:34 +02:00
|
|
|
# Add the source/lib directories
|
|
|
|
add_subdirectory(dependencies)
|
|
|
|
add_subdirectory(libsrc)
|
|
|
|
add_subdirectory(src)
|
2016-03-10 12:06:03 +01:00
|
|
|
if (ENABLE_TESTS)
|
|
|
|
add_subdirectory(test)
|
2016-05-22 00:27:06 +02:00
|
|
|
endif ()
|
2013-09-09 22:35:03 +02:00
|
|
|
|
|
|
|
# Add the doxygen generation directory
|
|
|
|
add_subdirectory(doc)
|
2016-05-22 00:27:06 +02:00
|
|
|
|
|
|
|
# uninstall target
|
|
|
|
configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
|
|
|
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
|
|
|
|
2016-05-22 13:00:06 +02:00
|
|
|
# enable make package - no code after this line !
|
|
|
|
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)
|
2016-06-17 01:25:40 +02:00
|
|
|
|
|
|
|
|