cmake_minimum_required (VERSION 3.0)
project (evcamera)
add_definitions(-std=c++1z -fpermissive -fPIC -ffunction-sections -fdata-sections -Wl,-gc-sections)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)

if("${VENDOR}" STREQUAL "")
    set(VENDOR "${CMAKE_SOURCE_DIR}/../vendor")
    set(SHAREDINCS "${CMAKE_SOURCE_DIR}/../include")
endif()

#set_source_files_properties(main.cc PROPERTIES COMPILE_FLAGS -g)

set(COMM_INC_DIR ${VENDOR}/shared/include ${VENDOR}/hi3518/include ${SHAREDINCS})
set(COMMON_LIB_DIR ${VENDOR}/shared/lib ${VENDOR}/hi3518/lib)
list(APPEND COMMON_LIBS fmt m dl pthread)
list(APPEND XM_LIBS XmMaQue securec XmSns_50H20AI)
include_directories(${CMAKE_SOURCE_DIR} ${PROJECT_SOURCE_DIR} ${COMM_INC_DIR})
link_directories(${COMMON_LIB_DIR} /root/xiongmai/arm-himix100-linux/target/lib/)

add_library(ntp STATIC ntp.cc)
add_library(tcp_client STATIC raw_tcp.cc)
add_library(evutils STATIC evutils.cc)
add_library(mqtthelper STATIC ../include/mqtt_helper.cc)
add_library(motion STATIC motion.cc)
add_library(smart STATIC smart.cc)
add_library(ptz STATIC ptz.cc)
add_library(record_upload STATIC record_upload.cc)
add_library(qr STATIC qr.cc jpgd.cpp ImageReaderSource.cpp) #jpg
#add_library(qr STATIC qr.cc jpgd.cpp PlanarYUVLuminanceSource.cpp) #yuv

add_executable(evcamera main.cc)
target_link_libraries(evcamera PUBLIC ntp paho-mqtt3a mqtthelper tcp_client evutils 
    smart motion record_upload ptz zmq qr zxing ${COMMON_LIBS} ${XM_LIBS})

#add_executable(test_fsm test_fsm.cc)

#add_executable(test_qr test_qr.cc)
#target_link_libraries(test_qr PUBLIC qr zxing ${COMMON_LIBS} ${XM_LIBS})