hyperion.ng/dependencies/CMakeLists.txt
Paulchen-Panther 559311e18c
remove protobuf
2018-12-30 16:43:22 +01:00

53 lines
2.0 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)
find_package(flatbuffers REQUIRED)
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})
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)
endfunction()