cmake_minimum_required(VERSION 3.1.0)
project(lfr_image_processing VERSION 0.1.0)

include(CTest)
enable_testing()

set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package( OpenCV REQUIRED )
find_package(Threads REQUIRED)

include_directories( ${OpenCV_INCLUDE_DIRS}
    ${CMAKE_CURRENT_SOURCE_DIR}/Input 
    ${CMAKE_CURRENT_SOURCE_DIR}/Processing
    ${CMAKE_CURRENT_SOURCE_DIR}/ControlModule
    ${CMAKE_CURRENT_SOURCE_DIR}/Interpreter
    ${CMAKE_CURRENT_SOURCE_DIR}/IntersectionHandler
    ${CMAKE_CURRENT_SOURCE_DIR}/Utils
)

link_directories( ${Input_SOURCE_DIRS} 
    ${Processing_SOURCE_DIRS}
    ${ControlModule_SOURCE_DIRS}
    ${Interpreter_SOURCE_DIRS}
    ${IntersectionHandler_SOURCE_DIRS}
    ${Utils_SOURCE_DIRS}
)

add_subdirectory(Input)
add_subdirectory(Processing)
add_subdirectory(ControlModule)
add_subdirectory(Interpreter)
add_subdirectory(IntersectionHandler)
add_subdirectory(Utils)
add_subdirectory(Spielwiese)

target_include_directories(Input PRIVATE .)
target_include_directories(Processing PRIVATE .)
target_include_directories(ControlModule PRIVATE .)
target_include_directories(Interpreter PRIVATE .)
target_include_directories(IntersectionHandler PRIVATE .)
target_include_directories(Utils PRIVATE .)

add_executable(lfr_image_processing lfr.cpp autonomous_mode_main.cpp)

target_link_libraries( lfr_image_processing ${OpenCV_LIBS} Input Processing ControlModule Interpreter IntersectionHandler Utils Threads::Threads)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
