2013-11-22 14:42:02 +01:00
|
|
|
# Define the main-project name
|
|
|
|
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
|
|
|
|
2013-08-13 19:45:17 +02:00
|
|
|
#set(CMAKE_TOOLCHAIN_FILE /opt/raspberrypi/Toolchain-RaspberryPi.cmake)
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
# set the build options
|
2014-02-07 09:20:00 +01:00
|
|
|
option(ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ON)
|
2013-11-19 23:02:41 +01:00
|
|
|
message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
|
|
|
|
|
2014-02-07 09:20:00 +01:00
|
|
|
option(ENABLE_SPIDEV "Enable the SPIDEV device" ON)
|
|
|
|
message(STATUS "ENABLE_SPIDEV = " ${ENABLE_SPIDEV})
|
|
|
|
|
2014-09-22 20:21:17 +02:00
|
|
|
option(ENABLE_WS2812BPWM "Enable the WS2812b-PWM device" OFF)
|
2014-09-19 16:37:58 +02:00
|
|
|
message(STATUS "ENABLE_WS2812BPWM = " ${ENABLE_WS2812BPWM})
|
|
|
|
|
2014-02-07 09:20:00 +01:00
|
|
|
option(ENABLE_V4L2 "Enable the V4L2 grabber" ON)
|
2014-01-04 13:24:05 +01:00
|
|
|
message(STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2})
|
|
|
|
|
2014-03-09 12:09:17 +01:00
|
|
|
option(ENABLE_TINKERFORGE "Enable the TINKERFORGE device" ON)
|
2014-03-04 20:38:54 +01:00
|
|
|
message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE})
|
|
|
|
|
2014-09-08 16:16:02 +02:00
|
|
|
option(ENABLE_PROTOBUF "Enable PROTOBUF server" ON)
|
|
|
|
message(STATUS "ENABLE_PROTOBUF = " ${ENABLE_PROTOBUF})
|
|
|
|
|
2014-09-19 16:37:58 +02:00
|
|
|
if(ENABLE_V4L2 AND NOT ENABLE_PROTOBUF)
|
2014-09-08 16:16:02 +02:00
|
|
|
message(FATAL_ERROR "V4L2 grabber requires PROTOBUF. Disable V4L2 or enable PROTOBUF")
|
2014-09-19 16:37:58 +02:00
|
|
|
endif(ENABLE_V4L2 AND NOT ENABLE_PROTOBUF)
|
2014-09-08 16:16:02 +02:00
|
|
|
|
2013-11-19 23:02:41 +01:00
|
|
|
# Createt the configuration file
|
|
|
|
# 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
|
|
|
# Add project specific cmake modules (find, etc)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
2013-11-12 14:53:39 +01:00
|
|
|
# Add specific cmake modules to find qt4 (default version finds first available QT which might not be qt4)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/qt4)
|
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)
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-11-22 11:46:40 +01:00
|
|
|
#set(CMAKE_BUILD_TYPE "Debug")
|
2013-08-03 23:24:22 +02:00
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
2013-07-26 22:38:34 +02:00
|
|
|
|
|
|
|
# enable C++11
|
2013-12-28 10:36:05 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
|
|
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11 -Wall")
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
# Configure the use of QT4
|
2013-08-15 21:11:02 +02:00
|
|
|
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED QUIET)
|
2013-08-13 11:10:45 +02:00
|
|
|
|
2014-09-08 16:16:02 +02:00
|
|
|
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)
|
2013-10-11 10:06:24 +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)
|
2013-11-13 20:15:53 +01:00
|
|
|
|
2014-03-04 20:38:54 +01:00
|
|
|
if (ENABLE_TINKERFORGE)
|
2014-03-06 21:48:11 +01:00
|
|
|
#find_package(libtinkerforge-1.0 REQUIRED)
|
2014-03-04 20:38:54 +01:00
|
|
|
endif (ENABLE_TINKERFORGE)
|
|
|
|
|
2013-08-13 11:10:45 +02:00
|
|
|
include(${QT_USE_FILE})
|
|
|
|
add_definitions(${QT_DEFINITIONS})
|
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
|
|
|
|
2013-07-26 22:38:34 +02:00
|
|
|
configure_file(bin/install_hyperion.sh ${LIBRARY_OUTPUT_PATH} @ONLY)
|
2013-07-31 17:28:01 +02:00
|
|
|
configure_file(config/hyperion.config.json ${LIBRARY_OUTPUT_PATH} @ONLY)
|
2013-11-22 11:46:40 +01:00
|
|
|
configure_file(config/hyperion_x86.config.json ${LIBRARY_OUTPUT_PATH} @ONLY)
|
2013-07-26 22:38:34 +02:00
|
|
|
|
|
|
|
# Add the source/lib directories
|
|
|
|
add_subdirectory(dependencies)
|
|
|
|
add_subdirectory(libsrc)
|
|
|
|
add_subdirectory(src)
|
2013-08-01 17:08:58 +02:00
|
|
|
add_subdirectory(test)
|
2013-09-09 22:35:03 +02:00
|
|
|
|
|
|
|
# Add the doxygen generation directory
|
|
|
|
add_subdirectory(doc)
|