mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor/Create APT/DNF Repository (#1648)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
|
||||
# Define the current source locations
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice)
|
||||
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice)
|
||||
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice)
|
||||
|
||||
if ( ENABLE_DEV_NETWORK )
|
||||
if(ENABLE_DEV_NETWORK)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_SERIAL )
|
||||
if(ENABLE_DEV_SERIAL)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS SerialPort REQUIRED)
|
||||
endif()
|
||||
|
||||
@@ -21,7 +21,7 @@ include_directories(
|
||||
dev_tinker
|
||||
)
|
||||
|
||||
FILE ( GLOB Leddevice_SOURCES
|
||||
file (GLOB Leddevice_SOURCES
|
||||
"${CURRENT_HEADER_DIR}/*.h"
|
||||
"${CURRENT_SOURCE_DIR}/*.h"
|
||||
"${CURRENT_SOURCE_DIR}/*.cpp"
|
||||
@@ -29,49 +29,48 @@ FILE ( GLOB Leddevice_SOURCES
|
||||
"${CURRENT_SOURCE_DIR}/dev_other/*.cpp"
|
||||
)
|
||||
|
||||
if ( ENABLE_OSX OR WIN32 )
|
||||
if(ENABLE_OSX OR WIN32)
|
||||
list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.h")
|
||||
list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_NETWORK )
|
||||
FILE ( GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp")
|
||||
if(ENABLE_DEV_NETWORK)
|
||||
file (GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_SERIAL )
|
||||
FILE ( GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
|
||||
if(ENABLE_DEV_SERIAL)
|
||||
file (GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_SPI )
|
||||
FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
|
||||
if(ENABLE_DEV_SPI)
|
||||
file (GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_TINKERFORGE )
|
||||
FILE ( GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
|
||||
if(ENABLE_DEV_TINKERFORGE)
|
||||
file (GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_USB_HID )
|
||||
if(ENABLE_DEV_USB_HID)
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/include/hidapi
|
||||
${LIBUSB_1_INCLUDE_DIRS}
|
||||
)
|
||||
FILE ( GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp")
|
||||
file (GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp")
|
||||
endif()
|
||||
|
||||
if ( ENABLE_DEV_WS281XPWM )
|
||||
include_directories(../../dependencies/external/rpi_ws281x)
|
||||
FILE ( GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp")
|
||||
if(ENABLE_DEV_WS281XPWM)
|
||||
file (GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp")
|
||||
endif()
|
||||
|
||||
set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc )
|
||||
set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc)
|
||||
|
||||
SET( Leddevice_SOURCES
|
||||
set(Leddevice_SOURCES
|
||||
${Leddevice_SOURCES}
|
||||
${LedDevice_RESOURCES}
|
||||
${Leddevice_NETWORK_SOURCES}
|
||||
${Leddevice_PWM_SOURCES}
|
||||
${Leddevice_SERIAL_SOURCES}
|
||||
${Leddevice_SERIAL_SOURCES}
|
||||
${Leddevice_SPI_SOURCES}
|
||||
${Leddevice_TINKER_SOURCES}
|
||||
${Leddevice_USB_HID_SOURCES}
|
||||
@@ -79,20 +78,20 @@ SET( Leddevice_SOURCES
|
||||
|
||||
# auto generate header file that include all available leddevice headers
|
||||
# auto generate cpp file for register() calls
|
||||
FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n" )
|
||||
FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n" )
|
||||
FOREACH( f ${Leddevice_SOURCES} )
|
||||
# MESSAGE (STATUS "Add led device: ${f}")
|
||||
if ( "${f}" MATCHES "dev_.*/Led.evice.+h$" )
|
||||
file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n")
|
||||
file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n")
|
||||
foreach(f ${Leddevice_SOURCES})
|
||||
# message (STATUS "Add led device: ${f}")
|
||||
if("${f}" MATCHES "dev_.*/Led.evice.+h$")
|
||||
GET_FILENAME_COMPONENT(fname ${f} NAME)
|
||||
FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n" )
|
||||
STRING( SUBSTRING ${fname} 9 -1 dname)
|
||||
STRING( REPLACE ".h" "" dname "${dname}" )
|
||||
FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n" )
|
||||
file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n")
|
||||
string(SUBSTRING ${fname} 9 -1 dname)
|
||||
string(REPLACE ".h" "" dname "${dname}")
|
||||
file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n")
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
endforeach()
|
||||
|
||||
add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES} )
|
||||
add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES})
|
||||
|
||||
target_link_libraries(leddevice
|
||||
hyperion
|
||||
@@ -106,19 +105,19 @@ endif()
|
||||
|
||||
if(ENABLE_DEV_NETWORK)
|
||||
target_link_libraries(leddevice Qt${QT_VERSION_MAJOR}::Network ssdp)
|
||||
|
||||
if (NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
|
||||
if (MBEDTLS_LIBRARIES)
|
||||
|
||||
if(NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
|
||||
if(MBEDTLS_LIBRARIES)
|
||||
include_directories(${MBEDTLS_INCLUDE_DIR})
|
||||
target_link_libraries(leddevice ${MBEDTLS_LIBRARIES})
|
||||
target_include_directories(leddevice PRIVATE ${MBEDTLS_INCLUDE_DIR})
|
||||
endif (MBEDTLS_LIBRARIES)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
|
||||
if (MBEDTLS_MAJOR EQUAL "3")
|
||||
if(MBEDTLS_MAJOR EQUAL "3")
|
||||
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
target_compile_features(leddevice PRIVATE cxx_std_20)
|
||||
endif()
|
||||
endif()
|
||||
@@ -133,10 +132,11 @@ if(ENABLE_DEV_TINKERFORGE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DEV_WS281XPWM)
|
||||
target_include_directories(leddevice PUBLIC "${CMAKE_SOURCE_DIR}/dependencies/external/rpi_ws281x")
|
||||
target_link_libraries(leddevice ws281x)
|
||||
endif()
|
||||
|
||||
if (ENABLE_DEV_USB_HID)
|
||||
if(ENABLE_DEV_USB_HID)
|
||||
if(APPLE)
|
||||
target_link_libraries(leddevice ${LIBUSB_1_LIBRARIES} hidapi-mac)
|
||||
else()
|
||||
@@ -150,17 +150,18 @@ if (ENABLE_DEV_USB_HID)
|
||||
#include <sys/time.h>
|
||||
|
||||
int main() {
|
||||
struct timespec t;
|
||||
return clock_gettime(CLOCK_REALTIME, &t);
|
||||
struct timespec t;
|
||||
return clock_gettime(CLOCK_REALTIME, &t);
|
||||
}
|
||||
" GLIBC_HAS_CLOCK_GETTIME)
|
||||
IF(NOT GLIBC_HAS_CLOCK_GETTIME)
|
||||
if(NOT GLIBC_HAS_CLOCK_GETTIME)
|
||||
target_link_libraries(leddevice rt)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_MDNS)
|
||||
target_link_libraries(leddevice mdns)
|
||||
|
||||
target_link_libraries(leddevice mdns)
|
||||
endif()
|
||||
|
||||
|
Reference in New Issue
Block a user