cmake_minimum_required(VERSION 3.24)

set(CMAKE_CXX_STANDARD 17)


add_subdirectory(simple_pv)


find_package(pylon 8.1.0 REQUIRED)

find_package(PkgConfig REQUIRED)
pkg_search_module(GST REQUIRED gstreamer-1.0)
pkg_search_module(GST_APP REQUIRED gstreamer-app-1.0)
pkg_search_module(GST_VIDEO REQUIRED gstreamer-video-1.0)


find_package(OpenCV REQUIRED)

find_package(Threads REQUIRED)


add_executable(pylon-camera-server pylon-camera-server.cpp transform.h calculate.cpp calculate.h archive.cpp archive.h)

target_include_directories(pylon-camera-server PRIVATE ${GST_INCLUDE_DIRS} ${GST_APP_INCLUDE_DIRS} ${GST_VIDEO_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
target_link_libraries(pylon-camera-server PRIVATE ${GST_LIBRARIES} ${GST_APP_LIBRARIES} ${GST_VIDEO_LIBRARIES} ${OpenCV_LIBS} Threads::Threads simple_pv pylon::PylonBase pylon::PylonUtility)


add_executable(test test.cpp transform.h calculate.cpp calculate.h archive.cpp archive.h)

target_include_directories(test PRIVATE ${GST_INCLUDE_DIRS} ${GST_APP_INCLUDE_DIRS} ${GST_VIDEO_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
target_link_libraries(test PRIVATE ${GST_LIBRARIES} ${GST_APP_LIBRARIES} ${GST_VIDEO_LIBRARIES} ${OpenCV_LIBS})


install(TARGETS pylon-camera-server DESTINATION bin)
