diff --git a/CMakeLists.txt b/CMakeLists.txt index 46e35bf2..b6d54a8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ SET ( DEFAULT_WS281XPWM OFF ) SET ( DEFAULT_V4L2 ON ) SET ( DEFAULT_USE_SHARED_AVAHI_LIBS OFF ) SET ( DEFAULT_USE_AVAHI_LIBS ON ) +SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) SET ( DEFAULT_TESTS OFF ) if ( NOT DEFINED PLATFORM ) @@ -38,8 +39,10 @@ if ( NOT DEFINED PLATFORM ) 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" ) + if ( "${SYSTEM_CPUINFO}" MATCHES "amlogic" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4 ) + SET( PLATFORM "amlogic" ) + elseif ( "${SYSTEM_CPUINFO}" MATCHES "amlogic" AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8 ) + SET( PLATFORM "amlogic64" ) elseif( SYSTEM_CPU_CORES GREATER 1 AND "${SYSTEM_CPUINFO}" MATCHES "bcm" ) SET( PLATFORM "rpi-pwm" ) endif() @@ -47,7 +50,7 @@ if ( NOT DEFINED PLATFORM ) 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=") + message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=") endif() endif() @@ -57,8 +60,11 @@ elseif ( "${PLATFORM}" STREQUAL "rpi-pwm" ) SET ( DEFAULT_DISPMANX ON ) SET ( DEFAULT_WS2812BPWM ON ) SET ( DEFAULT_WS281XPWM ON ) -elseif ( "${PLATFORM}" STREQUAL "wetek" ) +elseif ( "${PLATFORM}" STREQUAL "wetek" OR "${PLATFORM}" STREQUAL "amlogic" ) SET ( DEFAULT_AMLOGIC ON ) +elseif ( "${PLATFORM}" STREQUAL "amlogic64" ) + SET ( DEFAULT_AMLOGIC ON ) + SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS ON ) elseif ( "${PLATFORM}" STREQUAL "x86" ) SET ( DEFAULT_X11 ON ) SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index dce78257..fd1f7ad1 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -9,7 +9,7 @@ if(ENABLE_WS281XPWM) external/rpi_ws281x/rpihw.c) endif() -set(USE_SYSTEM_PROTO_LIBS OFF CACHE BOOL "use protobuf library from system") +set(USE_SYSTEM_PROTO_LIBS ${DEFAULT_USE_SYSTEM_PROTO_LIBS} CACHE BOOL "use protobuf library from system") if (USE_SYSTEM_PROTO_LIBS) find_package(Protobuf REQUIRED) diff --git a/libsrc/grabber/amlogic/AmlogicGrabber.cpp b/libsrc/grabber/amlogic/AmlogicGrabber.cpp index 979742ff..3e575f7e 100755 --- a/libsrc/grabber/amlogic/AmlogicGrabber.cpp +++ b/libsrc/grabber/amlogic/AmlogicGrabber.cpp @@ -16,14 +16,19 @@ #include #include + // Flags copied from 'include/linux/amlogic/amports/amvideocap.h' at https://github.com/codesnake/linux-amlogic #define AMVIDEOCAP_IOC_MAGIC 'V' #define AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH _IOW(AMVIDEOCAP_IOC_MAGIC, 0x02, int) #define AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT _IOW(AMVIDEOCAP_IOC_MAGIC, 0x03, int) -// Flags copied from 'include/linux/amlogic/amports/amvstream.h' at https://github.com/codesnake/linux-amlogic -#define AMSTREAM_IOC_MAGIC 'S' -#define AMSTREAM_IOC_GET_VIDEO_DISABLE _IOR(AMSTREAM_IOC_MAGIC, 0x48, unsigned long) +#if HAVE_AML_HEADER + #include +#else + // Flags copied from 'include/linux/amlogic/amports/amvstream.h' at https://github.com/codesnake/linux-amlogic + #define AMSTREAM_IOC_MAGIC 'S' + #define AMSTREAM_IOC_GET_VIDEO_DISABLE _IOR(AMSTREAM_IOC_MAGIC, 0x48, unsigned long) +#endif AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height) : _width(std::max(160u, width)) // Minimum required width or height is 160 diff --git a/libsrc/grabber/amlogic/CMakeLists.txt b/libsrc/grabber/amlogic/CMakeLists.txt index 44126775..25f88e41 100644 --- a/libsrc/grabber/amlogic/CMakeLists.txt +++ b/libsrc/grabber/amlogic/CMakeLists.txt @@ -1,3 +1,4 @@ +INCLUDE (CheckIncludeFiles) # Define the current source locations SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber) @@ -17,6 +18,12 @@ SET(AmlogicSOURCES QT5_WRAP_CPP(AmlogicHEADERS_MOC ${AmlogicQT_HEADERS}) +CHECK_INCLUDE_FILES ("amcodec/amports/amstream.h" HAVE_AML_HEADER) +IF (${HAVE_AML_HEADER}) + ADD_DEFINITIONS( -DHAVE_AML_HEADER ) +ENDIF() + + add_library(amlogic-grabber ${AmlogicHEADERS} ${AmlogicQT_HEADERS} @@ -27,3 +34,4 @@ add_library(amlogic-grabber target_link_libraries(amlogic-grabber hyperion ${QT_LIBRARIES}) + diff --git a/libsrc/leddevice/CMakeLists.txt b/libsrc/leddevice/CMakeLists.txt index 4816ccd7..4ff82221 100755 --- a/libsrc/leddevice/CMakeLists.txt +++ b/libsrc/leddevice/CMakeLists.txt @@ -8,7 +8,7 @@ find_package(libusb-1.0 REQUIRED) #find_package(Threads REQUIRED) include_directories( - ../../include/hidapi + ${CMAKE_SOURCE_DIR}/include/hidapi ${LIBUSB_1_INCLUDE_DIRS} ) # for Lightpack device