cmake_minimum_required(VERSION 3.16)

project(PassengerStatistics)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(CROSS_BUILD "build for embeded product." ON)

if(CROSS_BUILD)
  set(Libraries_ROOT /opt/aarch64-v01c01-linux-gnu-gcc/lib)
  set(OpenCV_DIR ${Libraries_ROOT}/opencv-4.11.0/lib/cmake/opencv4)
  set(LibDataChannel_DIR ${Libraries_ROOT}/libdatachannel-0.22.6/lib/cmake/LibDataChannel)
  set(OPENSSL_ROOT_DIR ${Libraries_ROOT}/openssl-3.5.0)
  set(OPENSSL_LIBRARY_DIRS ${OPENSSL_ROOT_DIR}/libs)
  set(SCTP_ROOT ${Libraries_ROOT}/usrsctp-0.9.5.0)
  set(SCTP_LIBRARIES ${SCTP_ROOT}/lib/libusrsctp.a)
else()
  set(Libraries_ROOT /opt/Libraries)
endif()

set(BOOST_ROOT ${Libraries_ROOT}/boost_1_88_0)
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS log serialization)

set(MbedTLS_DIR ${Libraries_ROOT}/mbedtls-3.6.3/lib/cmake/MbedTLS)
set(nng_DIR ${Libraries_ROOT}/nng-1.10.1/lib/cmake/nng)

set(ZLMediaKit_ROOT /opt/aarch64-v01c01-linux-gnu-gcc/lib/ZLMediaKit)
set(ZLMediaKit_INCLUDE_DIR ${ZLMediaKit_ROOT}/include)
set(ZLMediaKit_LIBRARY_DIRS ${ZLMediaKit_ROOT}/lib)

if(CROSS_BUILD)
  add_subdirectory(Main)
endif()
add_subdirectory(Tools)

include(FetchContent)

FetchContent_Declare(Kylin
    GIT_REPOSITORY ssh://git@gitea.amass.fun:2022/amass/Kylin.git
)
set(ENABLE_ROUTER ON)
set(ENABLE_NNG ON)
FetchContent_MakeAvailable(Kylin)