mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Implemented compile capability for MacOS.
Former-commit-id: 86e560e0d4f03251ee08a648ffa6fd9a0e01ae78
This commit is contained in:
parent
92bb518698
commit
6f15e89d29
@ -8,7 +8,10 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# set the build options
|
||||
option (ENABLE_DISPMANX "Enable the RPi dispmanx grabber" ON)
|
||||
option (ENABLE_SPIDEV "Enable the SPIDEV device" ON)
|
||||
|
||||
message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
|
||||
message(STATUS "ENABLE_SPIDEV = " ${ENABLE_SPIDEV})
|
||||
|
||||
# Createt the configuration file
|
||||
# configure a header file to pass some of the CMake settings
|
||||
@ -53,7 +56,10 @@ find_package(Threads REQUIRED)
|
||||
|
||||
include(${QT_USE_FILE})
|
||||
add_definitions(${QT_DEFINITIONS})
|
||||
link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)
|
||||
# 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()
|
||||
|
||||
configure_file(bin/install_hyperion.sh ${LIBRARY_OUTPUT_PATH} @ONLY)
|
||||
configure_file(config/hyperion.config.json ${LIBRARY_OUTPUT_PATH} @ONLY)
|
||||
|
@ -2,3 +2,6 @@
|
||||
|
||||
// Define to enable the dispmanx grabber
|
||||
#cmakedefine ENABLE_DISPMANX
|
||||
|
||||
// Define to enable the spi-device
|
||||
#cmakedefine ENABLE_SPIDEV
|
||||
|
21
cmake/FindCoreFoundation.cmake
Normal file
21
cmake/FindCoreFoundation.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Find IOKit framework (Mac OS X).
|
||||
#
|
||||
# Define:
|
||||
# CoreFoundation_FOUND
|
||||
# CoreFoundation_INCLUDE_DIR
|
||||
# CoreFoundation_LIBRARY
|
||||
|
||||
set(CoreFoundation_FOUND false)
|
||||
set(CoreFoundation_INCLUDE_DIR)
|
||||
set(CoreFoundation_LIBRARY)
|
||||
|
||||
if(APPLE)
|
||||
# The only platform it makes sense to check for CoreFoundation
|
||||
find_library(CoreFoundation CoreFoundation)
|
||||
if(CoreFoundation)
|
||||
set(CoreFoundation_FOUND true)
|
||||
set(CoreFoundation_INCLUDE_DIR ${CoreFoundation})
|
||||
set(CoreFoundation_LIBRARY ${CoreFoundation})
|
||||
endif(CoreFoundation)
|
||||
endif(APPLE)
|
21
cmake/FindIOKit.cmake
Normal file
21
cmake/FindIOKit.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Find IOKit framework (Mac OS X).
|
||||
#
|
||||
# Define:
|
||||
# IOKit_FOUND
|
||||
# IOKit_INCLUDE_DIR
|
||||
# IOKit_LIBRARY
|
||||
|
||||
set(IOKit_FOUND false)
|
||||
set(IOKit_INCLUDE_DIR)
|
||||
set(IOKit_LIBRARY)
|
||||
|
||||
if(APPLE)
|
||||
# The only platform it makes sense to check for IOKit
|
||||
find_library(IOKit IOKit)
|
||||
if(IOKit)
|
||||
set(IOKit_FOUND true)
|
||||
set(IOKit_INCLUDE_DIR ${IOKit})
|
||||
set(IOKit_LIBRARY ${IOKit})
|
||||
endif(IOKit)
|
||||
endif(APPLE)
|
42
dependencies/build/hidapi/CMakeLists.txt
vendored
42
dependencies/build/hidapi/CMakeLists.txt
vendored
@ -1,16 +1,36 @@
|
||||
project(hidapi)
|
||||
|
||||
#add libusb and pthreads
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
# Add the 'generic' hidapi include directory
|
||||
include_directories(../../include/hidapi)
|
||||
|
||||
include_directories(
|
||||
../../include/hidapi
|
||||
${LIBUSB_1_INCLUDE_DIRS})
|
||||
if(APPLE)
|
||||
|
||||
add_library(hidapi-libusb hid-libusb.c)
|
||||
find_package(IOKit REQUIRED)
|
||||
find_package(CoreFoundation REQUIRED)
|
||||
|
||||
target_link_libraries(hidapi-libusb
|
||||
${LIBUSB_1_LIBRARIES} #apt-get install libusb-1.0-0-dev
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
include_directories($IOKit_INCLUDE_DIRS})
|
||||
include_directories($CoreFoundation_INCLUDE_DIRS})
|
||||
|
||||
# HIDAPI library specific for MacOS
|
||||
add_library(hidapi-mac hid-mac.c)
|
||||
|
||||
target_link_libraries(hidapi-mac
|
||||
${IOKit_LIBRARY}
|
||||
${CoreFoundation_LIBRARY})
|
||||
elseif(UNIX)
|
||||
# HIDAPI library based on lib-usb
|
||||
|
||||
#add libusb and pthreads
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
include_directories($LIBUSB_1_INCLUDE_DIRS})
|
||||
|
||||
add_library(hidapi-libusb hid-libusb.c)
|
||||
|
||||
target_link_libraries(hidapi-libusb
|
||||
${LIBUSB_1_LIBRARIES} #apt-get install libusb-1.0-0-dev
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
1112
dependencies/build/hidapi/hid-mac.c
vendored
Normal file
1112
dependencies/build/hidapi/hid-mac.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,6 @@ target_link_libraries(hyperion
|
||||
hyperion-utils
|
||||
leddevice
|
||||
effectengine
|
||||
hidapi-libusb
|
||||
serialport
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
// STL includes
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
|
||||
// hyperion includes
|
||||
|
@ -7,9 +7,6 @@
|
||||
// Qt includes
|
||||
#include <QTimer>
|
||||
|
||||
// Linux-SPI includes
|
||||
#include <linux/spi/spidev.h>
|
||||
|
||||
// hyperion incluse
|
||||
#include <leddevice/LedDevice.h>
|
||||
|
||||
|
@ -12,22 +12,14 @@ include_directories(
|
||||
${LIBUSB_1_INCLUDE_DIRS}) # for Lightpack device
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(Leddevice_QT_HEADERS
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h
|
||||
)
|
||||
|
||||
SET(Leddevice_HEADERS
|
||||
${CURRENT_HEADER_DIR}/LedDevice.h
|
||||
${CURRENT_HEADER_DIR}/LedDeviceFactory.h
|
||||
|
||||
${CURRENT_SOURCE_DIR}/LedSpiDevice.h
|
||||
${CURRENT_SOURCE_DIR}/LedRs232Device.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceSedu.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2811.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLightpack.h
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.h
|
||||
@ -36,20 +28,39 @@ SET(Leddevice_HEADERS
|
||||
SET(Leddevice_SOURCES
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFactory.cpp
|
||||
|
||||
${CURRENT_SOURCE_DIR}/LedSpiDevice.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedRs232Device.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceSedu.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2811.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLightpack.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceMultiLightpack.cpp
|
||||
)
|
||||
|
||||
if(ENABLE_SPIDEV)
|
||||
SET(Leddevice_QT_HEADERS
|
||||
${Leddevice_QT_HEADERS}
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.h
|
||||
)
|
||||
SET(Leddevice_HEADERS
|
||||
${Leddevice_HEADERS}
|
||||
${CURRENT_SOURCE_DIR}/LedSpiDevice.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2811.h
|
||||
)
|
||||
SET(Leddevice_SOURCES
|
||||
${Leddevice_SOURCES}
|
||||
${CURRENT_SOURCE_DIR}/LedSpiDevice.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceAdalight.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd6803.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceLpd8806.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2811.cpp
|
||||
)
|
||||
endif(ENABLE_SPIDEV)
|
||||
|
||||
|
||||
QT4_WRAP_CPP(Leddevice_HEADERS_MOC ${Leddevice_QT_HEADERS})
|
||||
|
||||
add_library(leddevice
|
||||
@ -61,9 +72,13 @@ add_library(leddevice
|
||||
|
||||
target_link_libraries(leddevice
|
||||
hyperion-utils
|
||||
hidapi-libusb
|
||||
serialport
|
||||
${LIBUSB_1_LIBRARIES} #apt-get install libusb-1.0-0-dev
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
if(APPLE)
|
||||
target_link_libraries(leddevice hidapi-mac)
|
||||
else()
|
||||
target_link_libraries(leddevice hidapi-libusb)
|
||||
endif()
|
||||
|
@ -3,12 +3,15 @@
|
||||
#include <leddevice/LedDeviceFactory.h>
|
||||
|
||||
// Local Leddevice includes
|
||||
#include "LedDeviceLpd6803.h"
|
||||
#include "LedDeviceLpd8806.h"
|
||||
#ifdef ENABLE_SPIDEV
|
||||
#include "LedDeviceLpd6803.h"
|
||||
#include "LedDeviceLpd8806.h"
|
||||
#include "LedDeviceWs2801.h"
|
||||
#include "LedDeviceWs2811.h"
|
||||
#endif
|
||||
|
||||
#include "LedDeviceSedu.h"
|
||||
#include "LedDeviceTest.h"
|
||||
#include "LedDeviceWs2801.h"
|
||||
#include "LedDeviceWs2811.h"
|
||||
#include "LedDeviceAdalight.h"
|
||||
#include "LedDevicePaintpack.h"
|
||||
#include "LedDeviceLightpack.h"
|
||||
@ -22,7 +25,9 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
||||
|
||||
LedDevice* device = nullptr;
|
||||
if (type == "ws2801" || type == "lightberry")
|
||||
if (false) {}
|
||||
#ifdef ENABLE_SPIDEV
|
||||
else if (type == "ws2801" || type == "lightberry")
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const unsigned rate = deviceConfig["rate"].asInt();
|
||||
@ -69,16 +74,6 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
|
||||
device = deviceLpd8806;
|
||||
}
|
||||
else if (type == "sedu")
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const unsigned rate = deviceConfig["rate"].asInt();
|
||||
|
||||
LedDeviceSedu* deviceSedu = new LedDeviceSedu(output, rate);
|
||||
deviceSedu->open();
|
||||
|
||||
device = deviceSedu;
|
||||
}
|
||||
else if (type == "adalight")
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
@ -89,6 +84,17 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
|
||||
device = deviceAdalight;
|
||||
}
|
||||
#endif
|
||||
else if (type == "sedu")
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const unsigned rate = deviceConfig["rate"].asInt();
|
||||
|
||||
LedDeviceSedu* deviceSedu = new LedDeviceSedu(output, rate);
|
||||
deviceSedu->open();
|
||||
|
||||
device = deviceSedu;
|
||||
}
|
||||
else if (type == "lightpack")
|
||||
{
|
||||
const std::string output = deviceConfig.get("output", "").asString();
|
||||
|
@ -1,11 +1,15 @@
|
||||
# Needed for testing non-public components
|
||||
include_directories(../libsrc)
|
||||
|
||||
# Add the simple test executable 'TestSpi'
|
||||
add_executable(test_spi
|
||||
TestSpi.cpp)
|
||||
target_link_libraries(test_spi
|
||||
hyperion)
|
||||
if(ENABLE_SPIDEV)
|
||||
# Add the simple test executable 'TestSpi'
|
||||
add_executable(test_spi TestSpi.cpp)
|
||||
target_link_libraries(test_spi hyperion)
|
||||
|
||||
add_executable(spidev_test spidev_test.c)
|
||||
|
||||
add_executable(gpio2spi switchPinCtrl.c)
|
||||
endif(ENABLE_SPIDEV)
|
||||
|
||||
add_executable(test_configfile
|
||||
TestConfigFile.cpp)
|
||||
@ -44,7 +48,3 @@ target_link_libraries(test_blackborderprocessor
|
||||
add_executable(test_qregexp TestQRegExp.cpp)
|
||||
target_link_libraries(test_qregexp
|
||||
${QT_LIBRARIES})
|
||||
|
||||
add_executable(spidev_test spidev_test.c)
|
||||
|
||||
add_executable(gpio2spi switchPinCtrl.c)
|
||||
|
Loading…
Reference in New Issue
Block a user