96 lines
3.3 KiB
CMake
96 lines
3.3 KiB
CMake
cmake_minimum_required(VERSION 3.5.0)
|
|
|
|
option(HAILO_BUILD_EMULATOR "Build hailort for emulator" OFF)
|
|
option(HAILO_BUILD_UT "Build Unit Tests" OFF)
|
|
option(HAILO_INTERNAL_BUILD "Build internal hailort componments" OFF)
|
|
option(HAILO_BUILD_GSTREAMER "Compile gstreamer plugins" OFF)
|
|
option(HAILO_BUILD_EXAMPLES "Build examples" OFF)
|
|
option(HAILO_OFFLINE_COMPILATION "Don't download external dependencies" OFF)
|
|
option(HAILO_BUILD_SERVICE "Build hailort service" OFF)
|
|
option(HAILO_COMPILE_WARNING_AS_ERROR "Add compilation flag for treating compilation warnings as errors" OFF)
|
|
option(HAILO_SUPPORT_PACKAGING "Create HailoRT package (internal)" OFF)
|
|
option(HAILO_BUILD_DOC "Build doc" OFF)
|
|
|
|
if (HAILO_COMPILE_WARNING_AS_ERROR)
|
|
if(WIN32)
|
|
set(HAILORT_COMPILE_OPTIONS ${HAILORT_COMPILE_OPTIONS} /WX)
|
|
elseif(UNIX)
|
|
set(HAILORT_COMPILE_OPTIONS ${HAILORT_COMPILE_OPTIONS} -Werror)
|
|
else()
|
|
message(FATAL_ERROR "Unexpeced host, stopping build")
|
|
endif()
|
|
endif()
|
|
|
|
# Flag for emulator (FPGA/Veloce)
|
|
if(HAILO_BUILD_EMULATOR)
|
|
message(WARNING "HailoRT is building with Emulator flag on")
|
|
set(HAILORT_COMPILE_OPTIONS ${HAILORT_COMPILE_OPTIONS} -DHAILO_EMULATOR)
|
|
endif()
|
|
|
|
# Set firmware version
|
|
add_definitions( -DFIRMWARE_VERSION_MAJOR=4 )
|
|
add_definitions( -DFIRMWARE_VERSION_MINOR=20 )
|
|
add_definitions( -DFIRMWARE_VERSION_REVISION=1 )
|
|
if(HAILO_BUILD_SERVICE)
|
|
add_definitions( -DHAILO_SUPPORT_MULTI_PROCESS )
|
|
endif()
|
|
|
|
# TODO: temporary hack to support offline builds. Remove HAILO_OFFLINE_COMPILATION and use FETCHCONTENT_FULLY_DISCONNECTED
|
|
if(HAILO_OFFLINE_COMPILATION)
|
|
set(FETCHCONTENT_FULLY_DISCONNECTED ON CACHE INTERNAL "")
|
|
set(HAILO_OFFLINE_COMPILATION OFF CACHE INTERNAL "")
|
|
endif()
|
|
|
|
# TODO: move protobuf and grpc to inner cmake files
|
|
set(HAILO_EXTERNAL_DIR ${CMAKE_CURRENT_LIST_DIR}/external)
|
|
set(HAILO_EXTERNALS_CMAKE_SCRIPTS ${CMAKE_CURRENT_LIST_DIR}/cmake/external/)
|
|
include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/protobuf.cmake)
|
|
if(HAILO_BUILD_SERVICE)
|
|
include(${HAILO_EXTERNALS_CMAKE_SCRIPTS}/grpc.cmake)
|
|
endif()
|
|
|
|
set(HAILORT_INC_DIR ${PROJECT_SOURCE_DIR}/hailort/libhailort/include)
|
|
set(HAILORT_SRC_DIR ${PROJECT_SOURCE_DIR}/hailort/libhailort/src)
|
|
set(HAILORT_COMMON_DIR ${PROJECT_SOURCE_DIR}/hailort/)
|
|
set(COMMON_INC_DIR ${PROJECT_SOURCE_DIR}/common/include)
|
|
set(DRIVER_INC_DIR ${PROJECT_SOURCE_DIR}/hailort/drivers/common)
|
|
set(RPC_DIR ${PROJECT_SOURCE_DIR}/hailort/rpc)
|
|
set(HRPC_DIR ${PROJECT_SOURCE_DIR}/hailort/hrpc)
|
|
set(HRPC_PROTOCOL_DIR ${PROJECT_SOURCE_DIR}/hailort/hrpc_protocol)
|
|
set(HAILORT_SERVICE_DIR ${PROJECT_SOURCE_DIR}/hailort/hailort_service)
|
|
set(HAILORT_SERVER_DIR ${PROJECT_SOURCE_DIR}/hailort/hailort_server)
|
|
set(HAILORT_LIBUSB_DIR ${PROJECT_SOURCE_DIR}/hailort/internals/libusb-wrapper/)
|
|
|
|
if(HAILO_BUILD_SERVICE)
|
|
add_subdirectory(rpc)
|
|
endif()
|
|
|
|
add_subdirectory(common)
|
|
add_subdirectory(hrpc)
|
|
add_subdirectory(hrpc_protocol)
|
|
add_subdirectory(libhailort)
|
|
add_subdirectory(hailortcli)
|
|
if(HAILO_INTERNAL_BUILD)
|
|
add_subdirectory(tools)
|
|
add_subdirectory(internals)
|
|
endif()
|
|
|
|
if(HAILO_BUILD_SERVICE)
|
|
add_subdirectory(hailort_service)
|
|
endif()
|
|
|
|
if(HAILO_WIN_DRIVER)
|
|
add_subdirectory(drivers/win)
|
|
endif()
|
|
|
|
if(HAILO_SUPPORT_PACKAGING)
|
|
add_subdirectory(packaging)
|
|
endif()
|
|
|
|
# Compile PCIe Driver if QNX
|
|
if(CMAKE_SYSTEM_NAME STREQUAL QNX)
|
|
add_subdirectory(drivers/qnx)
|
|
endif()
|
|
|
|
add_subdirectory(hailort_server)
|