###
#
#  This file is part of the ViTE project.
#
#  This software is governed by the CeCILL-A license under French law
#  and abiding by the rules of distribution of free software. You can
#  use, modify and/or redistribute the software under the terms of the
#  CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
#  URL: "http://www.cecill.info".
#
#    @version 1.2.0
#    @authors COULOMB Kevin
#    @authors FAVERGE Mathieu
#    @authors JAZEIX Johnny
#    @authors LAGRASSE Olivier
#    @authors MARCOUEILLE Jule
#    @authors NOISETTE Pascal
#    @authors REDONDY Arthur
#    @authors VUCHENER Clément
#    @authors RICHART Nicolas
#

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

configure_file(
    "Configuration.in"
    "Configuration.hpp"
)

set (MATRIXVISUALIZER_hdrs
    MatrixVisualizer.hpp
    Configuration.hpp
    Helper.hpp

    Parsers/Parser.hpp
    Parsers/SymbolParser.hpp
    Parsers/OrderParser.hpp
    Parsers/ValuesParser.hpp

    Formats/SymbolMatrix.hpp
    Parsers/Readers/Pastix.hpp

    Windows/MatrixWindow.hpp
    Windows/MatrixGLWidget.hpp

    Common/Zooming.hpp
)

set (MATRIXVISUALIZER_srcs
    MatrixVisualizer.cpp
    Helper.cpp

    Formats/SymbolMatrix.cpp

    Parsers/SymbolParser.cpp
    Parsers/OrderParser.cpp
    Parsers/ValuesParser.cpp
    Parsers/Readers/Pastix.cpp

    Windows/MatrixWindow.cpp
    Windows/MatrixGLWidget.cpp

    Common/Zooming.cpp
)

set (MATRIXVISUALIZER_forms_tmp
    Plugin.ui
)

IF(USE_QT5)
  QT5_WRAP_UI(MATRIXVISUALIZER_forms
      ${MATRIXVISUALIZER_forms_tmp}
  )
else(USE_QT5)
  QT4_WRAP_UI(MATRIXVISUALIZER_forms
      ${MATRIXVISUALIZER_forms_tmp}
  )
endif(USE_QT5)

include_directories(${CMAKE_BINARY_DIR}/plugins/MatrixVisualizer)

add_library(MatrixVisualizer SHARED ${MATRIXVISUALIZER_srcs} ${MATRIXVISUALIZER_forms})

#############################################
#              QT5
#############################################
IF(USE_QT5)
  qt5_use_modules(MatrixVisualizer Widgets Core Xml OpenGL UiTools)
ELSE(USE_QT5)
  qt4_use_modules(MatrixVisualizer Core Xml OpenGL UiTools)
ENDIF(USE_QT5)

TARGET_LINK_LIBRARIES(MatrixVisualizer
  ${QT_LIBRARIES}
  ${OPENGL_gl_LIBRARY}
  ${OPENGL_glu_LIBRARY}
  ${Boost_LIBRARIES}
  )

IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  TARGET_LINK_LIBRARIES(MatrixVisualizer
    rt
    )
  ADD_DEFINITIONS("-DBOOST_GZIP")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

IF(VITE_ENABLE_VBO)
  TARGET_LINK_LIBRARIES(MatrixVisualizer
    ${GLEW_LIBRARY}
    )
ENDIF(VITE_ENABLE_VBO)

install(TARGETS MatrixVisualizer DESTINATION $ENV{HOME}/.vite)
