project(FaceAccess)
cmake_minimum_required(VERSION 3.27)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(CROSS_BUILD "build for arm." ON)

if(CROSS_BUILD)
    set(OPENSSL_ROOT /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/openssl-3.3.1)
    set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT}/include)
    set(OPENSSL_LIBRARY_DIRS ${OPENSSL_ROOT}/lib)
    
    set(ALSA_ROOT /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/libalsa-1.1.5)
    set(ALSA_INCLUDE_DIR ${ALSA_ROOT}/include)
    set(ALSA_LIBRARY_DIRS ${ALSA_ROOT}/lib)

    set(FFMPEG_ROOT /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/ffmpeg-4.1.3)
    set(FFMPEG_INCLUDE_DIR ${FFMPEG_ROOT}/include)
    set(FFMPEG_LIBRARY_DIRS ${FFMPEG_ROOT}/lib)

    set(MPP_ROOT /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/rockchip_mpp)
    set(MPP_INCLUDE_DIR ${MPP_ROOT}/include)
    set(MPP_LIBRARY_DIRS ${MPP_ROOT}/rk-libs)

    set(KINESIS_ROOT /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/amazon-kinesis-video-streams-webrtc-sdk-c)
else()
    set(BOOST_ROOT /opt/Libraries/boost_1_86_0)
    set(KINESIS_ROOT /opt/Libraries/amazon-kinesis-video-streams-webrtc-sdk-c)
    set(MBEDTLS_ROOT /opt/Libraries/mbedtls-3.6.2)
    set(NNG_ROOT /opt/Libraries/nng-1.9.0)

endif()
option(Boost_USE_STATIC_LIBS OFF)
set(OPENSSL_LIBRARIES ssl crypto)
set(FFMPEG_LIBRARY avcodec avdevice avfilter avformat avutil postproc swresample swscale)

set(MBEDTLS_INCLUDE_DIR ${MBEDTLS_ROOT}/include)
set(MBEDTLS_LIBRARY_DIRS ${MBEDTLS_ROOT}/lib)

set(NNG_INCLUDE_DIR ${NNG_ROOT}/include)
set(NNG_LIBRARY_DIRS ${NNG_ROOT}/lib)

include(FetchContent)
FetchContent_Declare(Kylin
    GIT_REPOSITORY https://amass.fun/gitea/amass/Kylin.git
)
set(KYLIN_WITH_NNG ON)
FetchContent_MakeAvailable(Kylin)

add_subdirectory(VocieProcess)
add_subdirectory(GatePass)
if(CROSS_BUILD)
    add_subdirectory(Record)
endif()
add_subdirectory(VoucherVerifyServer)
add_subdirectory(NngDebuger)