project(Video)

# ========================================
# Basic Definitions
# ========================================
set(${PROJECT_NAME}_VERSION_MAJOR 0)
set(${PROJECT_NAME}_VERSION_MINOR 1)

pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME})

# ========================================
# Compiler definitions
# ========================================
add_definitions(
  ${QT_DEFINITIONS}
  -DVIDEO_EXPORTS
)

# ========================================
# Include directories
# ========================================
include_directories(
  #${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video
  ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/sensor
  ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt
  ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/commun
  ${PACPUS_INCLUDE_DIR}/Pacpus
  ${PACPUS_INCLUDE_DIR}
  ${PROJECT_BINARY_DIR}
  ${QT_INCLUDE_DIR}
)

# ========================================
# Link directories
# ========================================
link_directories(
  
)

# ========================================
# List of sources
# ========================================
set(
    PROJECT_SRCS
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt/DbtPlyVisionConfig.h
    dbt/DbtPlyStereoManager.cpp
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt/DbtPlyStereoManager.h
    dbt/DbtPlyImageManager.cpp
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt/DbtPlyImageManager.h

    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/commun/ImageViewer.h
    commun/ImageViewer.cpp
    ${PLUGIN_CPP}
)

if(WIN32)
    set(PROJECT_SRCS
	${PROJECT_SRCS}
        sensor/Camera1394.cpp
        ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/sensor/Camera1394.h
    )
endif(WIN32)

if(UNIX)
    set(PROJECT_SRCS
      ${PROJECT_SRCS}
      sensor/Camera1394Unix.cpp
      ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/sensor/Camera1394Unix.h
      )
endif(UNIX)

# ========================================
# Files to MOC
# ========================================
set(
    FILES_TO_MOC
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt/DbtPlyImageManager.h
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/dbt/DbtPlyStereoManager.h
    ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/commun/ImageViewer.h
    ${PLUGIN_H}
)

if(WIN32)
    set(FILES_TO_MOC
        ${FILES_TO_MOC}
        ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/sensor/Camera1394.h
    )
endif(WIN32)

if(UNIX)
  set(FILES_TO_MOC
      ${FILES_TO_MOC}
      ${PACPUS_INCLUDE_DIR}/PacpusCityVIP/Video/sensor/Camera1394Unix.h
  )
endif(UNIX)

set(
    UI_FILES
)

# ========================================
# Call MOC
# ========================================
 qt5_wrap_cpp(
     PROJECT_MOC_SRCS
     ${FILES_TO_MOC}
 )

qt5_wrap_ui(
    PROJECT_UI_SRCS 
    ${UI_FILES}
)

# ========================================
# Build a library
# ========================================
pacpus_add_library(
    ${PROJECT_NAME} SHARED
    ${PROJECT_SRCS}
    ${PROJECT_MOC_SRCS}
    ${PROJECT_UI_SRCS}
)

# ========================================
# Libraries
# ========================================
# All the platform
target_link_libraries(
    ${PROJECT_NAME}
    ${PACPUS_LIBRARIES}
    ${QT_LIBRARIES}
)

if(WIN32)
target_link_libraries(
    ${PROJECT_NAME}
        1394camera
)
endif(WIN32)
if(UNIX)
target_link_libraries(
    ${PROJECT_NAME}
        dc1394
    )
endif(UNIX)

# ========================================
# Install
# ========================================
pacpus_install(${PROJECT_NAME})

# Installation of the headers
install(DIRECTORY ${PACPUS_INCLUDE_DIR} DESTINATION "${PACPUS_ROOT}")

# ========================================
# Folder
# ========================================
pacpus_folder(${PROJECT_NAME} "Camera")
