mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
66 lines
2.3 KiB
CMake
66 lines
2.3 KiB
CMake
add_subdirectory(build/hidapi)
|
|
add_subdirectory(build/tinkerforge)
|
|
|
|
if(ENABLE_WS281XPWM)
|
|
add_library(ws281x
|
|
external/rpi_ws281x/mailbox.c external/rpi_ws281x/ws2811.c
|
|
external/rpi_ws281x/pwm.c external/rpi_ws281x/dma.c
|
|
external/rpi_ws281x/pcm.c
|
|
external/rpi_ws281x/rpihw.c)
|
|
endif()
|
|
|
|
set(USE_SYSTEM_FLATBUFFERS_LIBS ${DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS} CACHE BOOL "use flatbuffers library from system")
|
|
|
|
if (USE_SYSTEM_FLATBUFFERS_LIBS)
|
|
if (ENABLE_AMLOGIC)
|
|
find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc REQUIRED)
|
|
else ()
|
|
find_package(flatbuffers REQUIRED)
|
|
endif()
|
|
include_directories(${FLATBUFFERS_INCLUDE_DIRS})
|
|
else ()
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared flatbuffers library")
|
|
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "Build Flatbuffers with tests")
|
|
add_subdirectory(external/flatbuffers)
|
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
# when crosscompiling import the flatc executable targets from a file generated by a native build
|
|
option(IMPORT_FLATC "flatc export file (flatc_export.cmake) from a native build" "IMPORT_FLATC-FILE_NOT_FOUND")
|
|
include(${IMPORT_FLATC})
|
|
else()
|
|
# export the flatc compiler so it can be used when cross compiling
|
|
export(TARGETS flatc FILE "${CMAKE_BINARY_DIR}/flatc_export.cmake")
|
|
endif()
|
|
|
|
# define the include for the flatbuffers library at the parent scope
|
|
set(FLATBUFFERS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/flatbuffers/include")
|
|
set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIRS} PARENT_SCOPE)
|
|
|
|
# define the flatc executable at the parent scope
|
|
get_property(FLATBUFFERS_FLATC_EXECUTABLE TARGET flatc PROPERTY LOCATION)
|
|
set(FLATBUFFERS_FLATC_EXECUTABLE ${FLATBUFFERS_FLATC_EXECUTABLE} PARENT_SCOPE)
|
|
endif()
|
|
|
|
message(STATUS "Using flatbuffers compiler: " ${FLATBUFFERS_FLATC_EXECUTABLE})
|
|
|
|
|
|
function(compile_flattbuffer_schema SRC_FBS OUTPUT_DIR)
|
|
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
|
|
if (ENABLE_AMLOGIC)
|
|
add_custom_command(
|
|
OUTPUT ${GEN_HEADER}
|
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
|
|
--gen-object-api
|
|
-o "${OUTPUT_DIR}"
|
|
"${SRC_FBS}")
|
|
else()
|
|
add_custom_command(
|
|
OUTPUT ${GEN_HEADER}
|
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
|
|
--gen-object-api
|
|
-o "${OUTPUT_DIR}"
|
|
"${SRC_FBS}"
|
|
DEPENDS flatc)
|
|
endif()
|
|
endfunction()
|