project(DbtPlyCPTComponent)

################################################################################
add_definitions( -DDBTPLYCPTCOMPONENT_EXPORTS )

################################################################################
# FILES
pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME})

#set(CMAKE_BUILD_TYPE Debug)
include_directories(${PACPUSINCLUDE_DIRECTORY})
include_directories(${PACPUSINCLUDE_DIRECTORY}/extlib/qwt-5.2.1)
link_directories(${PACPUSLIB_DIRECTORY})
link_directories(${PACPUSBIN_DIRECTORY})

message(STATUS PLUGIN_H=${PLUGIN_H})
message(STATUS PLUGIN_CPP=${PLUGIN_CPP})

################################################################################
set(HDRS
    DbtPlyCPTComponent.h
    ../PoseViewer/PoseViewer.h
)

set(SRCS
    DbtPlyCPTComponent.cpp
    ../PoseViewer/PoseViewer.cpp
)

set(FILES_TO_MOC
    DbtPlyCPTComponent.h
    ../PoseViewer/PoseViewer.h
)

qt4_wrap_cpp(MOCED_SOURCES
    ${PLUGIN_H}
    ${FILES_TO_MOC}
)
################################################################################
# BUILD AND LINK
add_library(${PROJECT_NAME} SHARED
  ${HDRS}
  ${SRCS}
  
  ${PLUGIN_CPP}
  ${MOCED_SOURCES}
)
# LIBS
list(APPEND LIBS
    optimized dbiteplayerlib debug dbiteplayerlib_d
    optimized FileLib debug FileLib_d
    optimized PacpusLib debug PacpusLib_d
    optimized PacpusTools debug PacpusTools_d
    optimized NMEA0183LIB debug NMEA0183LIB_d
    ${QT_LIBRARIES}
)
if(WIN32)
    list(APPEND LIBS
        optimized ROAD_TIME debug ROAD_TIME_d
    )
endif()
# LINK
target_link_libraries(${PROJECT_NAME} ${LIBS})
# PROPERTIES
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d")
# FOLDERS
if(PACPUS_FOLDERS)
    set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "DbtPly")
endif()

################################################################################
# INSTALL
install(TARGETS ${PROJECT_NAME}
    RUNTIME DESTINATION ${PACPUSBIN_DIRECTORY}
    LIBRARY DESTINATION ${PACPUSBIN_DIRECTORY}
    ARCHIVE DESTINATION ${PACPUSLIB_DIRECTORY}
)
