cmake_minimum_required(VERSION 3.1)
project(hailo_demo)

set(HAILORT_ROOT $ENV{HAILORT_ROOT})
set(ARCH $ENV{ARCH})
set(HAILORT_LIB $ENV{HAILORT_ROOT}/lib/${ARCH}/libhailort.so.$ENV{HAILORT_LIB_VER})
set(HAILORT_INCLUDE_DIR "$ENV{HAILORT_ROOT}/include")
#set(COMPILE_OPTIONS_CPP -Werror -g  -O0 -std=c++2a)
#set(COMPILE_OPTIONS_CPP -Wall -Werror -O3 -DNDEBUG  -std=c++2a)
set(COMPILE_OPTIONS_CPP -Wall -Werror -pedantic -g -O3)

message(STATUS "HAILORT_ROOT: $ENV{HAILORT_ROOT}")
message(STATUS "HAILORT_LIB: ${HAILORT_LIB}") 
message(STATUS "HAILORT_INCLUDE_DIR: ${HAILORT_INCLUDE_DIR}")

include_directories(${HAILORT_INCLUDE_DIR} ./)

find_package(Threads)
find_package( OpenCV REQUIRED )
message(STATUS "opencv libraries: ${OpenCV_LIBS}")

message(STATUS "HAILORT_LIB_VER: $ENV{HAILORT_LIB_VER}")
message(STATUS "ARCH: ${ARCH}")

file(GLOB SOURCES
    ./*.hpp
    ./*.cpp
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS_CPP})

target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${PROJECT_NAME} ${HAILORT_LIB})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
